diff options
author | Henrique Nakashima <hnakashima@chromium.org> | 2018-06-12 22:00:25 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-06-12 22:00:25 +0000 |
commit | 81a3085b250deafd18a2183a311cc57e2ec1c6f0 (patch) | |
tree | acb64876cc05144da98690ea4d6b118045514120 /core/fpdfapi/edit/cpdf_pagecontentgenerator.h | |
parent | 62d8ebeee58c5da29102e61d25b28967a1b2aa04 (diff) | |
download | pdfium-81a3085b250deafd18a2183a311cc57e2ec1c6f0.tar.xz |
Refactor modification of Contents in CPDF_PageContentGenerator.
This is a pure refactor, there should be no change in behavior. It
prepares for the next CL, which will allow modification of content
streams.
Bug: pdfium:1051
Change-Id: I01ca3e897efe423e89df75e1f31cd67539cc3d08
Reviewed-on: https://pdfium-review.googlesource.com/34470
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fpdfapi/edit/cpdf_pagecontentgenerator.h')
-rw-r--r-- | core/fpdfapi/edit/cpdf_pagecontentgenerator.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/core/fpdfapi/edit/cpdf_pagecontentgenerator.h b/core/fpdfapi/edit/cpdf_pagecontentgenerator.h index a6cf215734..677d29267b 100644 --- a/core/fpdfapi/edit/cpdf_pagecontentgenerator.h +++ b/core/fpdfapi/edit/cpdf_pagecontentgenerator.h @@ -7,6 +7,8 @@ #ifndef CORE_FPDFAPI_EDIT_CPDF_PAGECONTENTGENERATOR_H_ #define CORE_FPDFAPI_EDIT_CPDF_PAGECONTENTGENERATOR_H_ +#include <map> +#include <memory> #include <sstream> #include <vector> @@ -41,6 +43,23 @@ class CPDF_PageContentGenerator { ByteString RealizeResource(const CPDF_Object* pResource, const ByteString& bsType); + // Returns a map from content stream index to new stream data. Unmodified + // streams are not touched. + std::map<int32_t, std::unique_ptr<std::ostringstream>> + GenerateModifiedStreams(); + + // Generate new stream data with all dirty page objects. + bool GenerateStreamWithNewObjects(std::ostringstream* buf); + + // Add buffer as a stream in page's 'Contents' + void UpdateContentStreams( + std::map<int32_t, std::unique_ptr<std::ostringstream>>* buf); + + // Set the stream index of all page objects with stream index == + // |CPDF_PageObject::kNoContentStream|. These are new objects that had not + // been parsed from or written to any content stream yet. + void UpdateStreamlessPageObjects(int new_content_stream_index); + UnownedPtr<CPDF_PageObjectHolder> const m_pObjHolder; UnownedPtr<CPDF_Document> const m_pDocument; std::vector<UnownedPtr<CPDF_PageObject>> m_pageObjects; |