summaryrefslogtreecommitdiff
path: root/core/fpdfapi/edit
diff options
context:
space:
mode:
authorHenrique Nakashima <hnakashima@chromium.org>2018-10-10 23:17:03 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-10-10 23:17:03 +0000
commit673b90ad5b21a3d17e64ef65d7053d582920fcbe (patch)
treed113f769e004a52f3789f36f73d4f5d99098a9fa /core/fpdfapi/edit
parentfc41e77c97173592ea2abb88c3f6f4dc7c43349d (diff)
downloadpdfium-673b90ad5b21a3d17e64ef65d7053d582920fcbe.tar.xz
Rename CPDF_ContentMark to CPDF_ContentMarks.
Also change variable names and member names of this type. This better reflects the fact that this class contains all the marks in a page objects, not just one mark. Change-Id: I4fe3d2620e78cbe423f18634f19fa82530d7efe1 Reviewed-on: https://pdfium-review.googlesource.com/c/43813 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Diffstat (limited to 'core/fpdfapi/edit')
-rw-r--r--core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp36
-rw-r--r--core/fpdfapi/edit/cpdf_pagecontentgenerator.h10
2 files changed, 23 insertions, 23 deletions
diff --git a/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp b/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp
index 946364d6d7..b0f0ca686a 100644
--- a/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp
+++ b/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp
@@ -15,7 +15,7 @@
#include "core/fpdfapi/edit/cpdf_pagecontentmanager.h"
#include "core/fpdfapi/edit/cpdf_stringarchivestream.h"
#include "core/fpdfapi/font/cpdf_font.h"
-#include "core/fpdfapi/page/cpdf_contentmark.h"
+#include "core/fpdfapi/page/cpdf_contentmarks.h"
#include "core/fpdfapi/page/cpdf_docpagedata.h"
#include "core/fpdfapi/page/cpdf_image.h"
#include "core/fpdfapi/page/cpdf_imageobject.h"
@@ -97,9 +97,9 @@ CPDF_PageContentGenerator::GenerateModifiedStreams() {
// Start regenerating dirty streams.
std::map<int32_t, std::unique_ptr<std::ostringstream>> streams;
std::set<int32_t> empty_streams;
- std::unique_ptr<const CPDF_ContentMark> empty_content_mark =
- pdfium::MakeUnique<CPDF_ContentMark>();
- std::map<int32_t, const CPDF_ContentMark*> current_content_mark;
+ std::unique_ptr<const CPDF_ContentMarks> empty_content_marks =
+ pdfium::MakeUnique<CPDF_ContentMarks>();
+ std::map<int32_t, const CPDF_ContentMarks*> current_content_marks;
for (int32_t dirty_stream : all_dirty_streams) {
std::unique_ptr<std::ostringstream> buf =
@@ -114,7 +114,7 @@ CPDF_PageContentGenerator::GenerateModifiedStreams() {
streams[dirty_stream] = std::move(buf);
empty_streams.insert(dirty_stream);
- current_content_mark[dirty_stream] = empty_content_mark.get();
+ current_content_marks[dirty_stream] = empty_content_marks.get();
}
// Process the page objects, write into each dirty stream.
@@ -126,8 +126,8 @@ CPDF_PageContentGenerator::GenerateModifiedStreams() {
std::ostringstream* buf = it->second.get();
empty_streams.erase(stream_index);
- current_content_mark[stream_index] = ProcessContentMarks(
- buf, pPageObj.Get(), current_content_mark[stream_index]);
+ current_content_marks[stream_index] = ProcessContentMarks(
+ buf, pPageObj.Get(), current_content_marks[stream_index]);
ProcessPageObject(buf, pPageObj.Get());
}
@@ -138,7 +138,7 @@ CPDF_PageContentGenerator::GenerateModifiedStreams() {
// Clear to show that this stream needs to be deleted.
buf->str("");
} else {
- FinishMarks(buf, current_content_mark[dirty_stream]);
+ FinishMarks(buf, current_content_marks[dirty_stream]);
// Return graphics to original state
*buf << "Q\n";
@@ -212,19 +212,19 @@ ByteString CPDF_PageContentGenerator::RealizeResource(
bool CPDF_PageContentGenerator::ProcessPageObjects(std::ostringstream* buf) {
bool bDirty = false;
- std::unique_ptr<const CPDF_ContentMark> empty_content_mark =
- pdfium::MakeUnique<CPDF_ContentMark>();
- const CPDF_ContentMark* content_mark = empty_content_mark.get();
+ std::unique_ptr<const CPDF_ContentMarks> empty_content_marks =
+ pdfium::MakeUnique<CPDF_ContentMarks>();
+ const CPDF_ContentMarks* content_marks = empty_content_marks.get();
for (auto& pPageObj : m_pageObjects) {
if (m_pObjHolder->IsPage() && !pPageObj->IsDirty())
continue;
bDirty = true;
- content_mark = ProcessContentMarks(buf, pPageObj.Get(), content_mark);
+ content_marks = ProcessContentMarks(buf, pPageObj.Get(), content_marks);
ProcessPageObject(buf, pPageObj.Get());
}
- FinishMarks(buf, content_mark);
+ FinishMarks(buf, content_marks);
return bDirty;
}
@@ -236,11 +236,11 @@ void CPDF_PageContentGenerator::UpdateStreamlessPageObjects(
}
}
-const CPDF_ContentMark* CPDF_PageContentGenerator::ProcessContentMarks(
+const CPDF_ContentMarks* CPDF_PageContentGenerator::ProcessContentMarks(
std::ostringstream* buf,
const CPDF_PageObject* pPageObj,
- const CPDF_ContentMark* pPrev) {
- const CPDF_ContentMark* pNext = &pPageObj->m_ContentMark;
+ const CPDF_ContentMarks* pPrev) {
+ const CPDF_ContentMarks* pNext = &pPageObj->m_ContentMarks;
size_t first_different = pPrev->FindFirstDifference(pNext);
@@ -290,11 +290,11 @@ const CPDF_ContentMark* CPDF_PageContentGenerator::ProcessContentMarks(
void CPDF_PageContentGenerator::FinishMarks(
std::ostringstream* buf,
- const CPDF_ContentMark* pContentMark) {
+ const CPDF_ContentMarks* pContentMarks) {
// Technically we should iterate backwards to close from the top to the
// bottom, but since the EMC operators do not identify which mark they are
// closing, it does not matter.
- for (size_t i = 0; i < pContentMark->CountItems(); ++i)
+ for (size_t i = 0; i < pContentMarks->CountItems(); ++i)
*buf << "EMC\n";
}
diff --git a/core/fpdfapi/edit/cpdf_pagecontentgenerator.h b/core/fpdfapi/edit/cpdf_pagecontentgenerator.h
index 029a77935b..ead3950f88 100644
--- a/core/fpdfapi/edit/cpdf_pagecontentgenerator.h
+++ b/core/fpdfapi/edit/cpdf_pagecontentgenerator.h
@@ -16,7 +16,7 @@
#include "core/fxcrt/fx_system.h"
#include "core/fxcrt/unowned_ptr.h"
-class CPDF_ContentMark;
+class CPDF_ContentMarks;
class CPDF_Document;
class CPDF_ImageObject;
class CPDF_Object;
@@ -45,11 +45,11 @@ class CPDF_PageContentGenerator {
ByteString GetOrCreateDefaultGraphics() const;
ByteString RealizeResource(const CPDF_Object* pResource,
const ByteString& bsType) const;
- const CPDF_ContentMark* ProcessContentMarks(std::ostringstream* buf,
- const CPDF_PageObject* pPageObj,
- const CPDF_ContentMark* pPrev);
+ const CPDF_ContentMarks* ProcessContentMarks(std::ostringstream* buf,
+ const CPDF_PageObject* pPageObj,
+ const CPDF_ContentMarks* pPrev);
void FinishMarks(std::ostringstream* buf,
- const CPDF_ContentMark* pContentMark);
+ const CPDF_ContentMarks* pContentMarks);
// Returns a map from content stream index to new stream data. Unmodified
// streams are not touched.