From 571053a44f876fe970dd85ee61483b6846a2f383 Mon Sep 17 00:00:00 2001 From: Henrique Nakashima Date: Wed, 13 Jun 2018 20:52:16 +0000 Subject: Mark modified content streams as dirty in CPDF_PageObjectHolder. Bug: pdfium:1051 Change-Id: Ib3376eea32336437d148f8f9c0017d6b8f9fb556 Reviewed-on: https://pdfium-review.googlesource.com/33770 Reviewed-by: dsinclair Commit-Queue: Henrique Nakashima --- core/fpdfapi/page/cpdf_pageobjectholder.cpp | 5 +++++ core/fpdfapi/page/cpdf_pageobjectholder.h | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/core/fpdfapi/page/cpdf_pageobjectholder.cpp b/core/fpdfapi/page/cpdf_pageobjectholder.cpp index cca7565a68..3eb88ec9c0 100644 --- a/core/fpdfapi/page/cpdf_pageobjectholder.cpp +++ b/core/fpdfapi/page/cpdf_pageobjectholder.cpp @@ -119,6 +119,11 @@ bool CPDF_PageObjectHolder::RemovePageObject(CPDF_PageObject* pPageObj) { it->release(); m_PageObjectList.erase(it); + + int32_t content_stream = pPageObj->GetContentStream(); + if (content_stream >= 0) + m_DirtyStreams.insert(content_stream); + return true; } diff --git a/core/fpdfapi/page/cpdf_pageobjectholder.h b/core/fpdfapi/page/cpdf_pageobjectholder.h index 1c427913ea..d18f400568 100644 --- a/core/fpdfapi/page/cpdf_pageobjectholder.h +++ b/core/fpdfapi/page/cpdf_pageobjectholder.h @@ -9,6 +9,7 @@ #include #include +#include #include #include "core/fpdfapi/page/cpdf_pageobjectlist.h" @@ -84,6 +85,8 @@ class CPDF_PageObjectHolder { void AddImageMaskBoundingBox(const CFX_FloatRect& box); void Transform(const CFX_Matrix& matrix); CFX_FloatRect CalcBoundingBox() const; + const std::set* GetDirtyStreams() const { return &m_DirtyStreams; } + void ClearDirtyStreams() { m_DirtyStreams.clear(); } UnownedPtr m_pPageResources; UnownedPtr m_pResources; @@ -105,6 +108,9 @@ class CPDF_PageObjectHolder { std::unique_ptr m_pParser; CPDF_PageObjectList m_PageObjectList; CFX_Matrix m_LastCTM; + + // The indexes of Content streams that are dirty and need to be regenerated. + std::set m_DirtyStreams; }; #endif // CORE_FPDFAPI_PAGE_CPDF_PAGEOBJECTHOLDER_H_ -- cgit v1.2.3