summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenrique Nakashima <hnakashima@chromium.org>2018-06-13 20:52:16 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-06-13 20:52:16 +0000
commit571053a44f876fe970dd85ee61483b6846a2f383 (patch)
tree6ec57fb4aa22ef5863048c833f1a05d9426c938b
parentff94c9e01e02cb7c658eaef4641f57d5681553a5 (diff)
downloadpdfium-571053a44f876fe970dd85ee61483b6846a2f383.tar.xz
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 <dsinclair@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
-rw-r--r--core/fpdfapi/page/cpdf_pageobjectholder.cpp5
-rw-r--r--core/fpdfapi/page/cpdf_pageobjectholder.h6
2 files changed, 11 insertions, 0 deletions
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 <map>
#include <memory>
+#include <set>
#include <vector>
#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<int32_t>* GetDirtyStreams() const { return &m_DirtyStreams; }
+ void ClearDirtyStreams() { m_DirtyStreams.clear(); }
UnownedPtr<CPDF_Dictionary> m_pPageResources;
UnownedPtr<CPDF_Dictionary> m_pResources;
@@ -105,6 +108,9 @@ class CPDF_PageObjectHolder {
std::unique_ptr<CPDF_ContentParser> 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<int32_t> m_DirtyStreams;
};
#endif // CORE_FPDFAPI_PAGE_CPDF_PAGEOBJECTHOLDER_H_