diff options
Diffstat (limited to 'core/fpdfapi/edit')
-rw-r--r-- | core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp | 18 | ||||
-rw-r--r-- | core/fpdfapi/edit/cpdf_pagecontentgenerator.h | 6 |
2 files changed, 12 insertions, 12 deletions
diff --git a/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp b/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp index 66a47406f5..ad1ffaf687 100644 --- a/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp +++ b/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp @@ -34,21 +34,19 @@ CPDF_PageContentGenerator::CPDF_PageContentGenerator(CPDF_Page* pPage) CPDF_PageContentGenerator::~CPDF_PageContentGenerator() {} -FX_BOOL CPDF_PageContentGenerator::InsertPageObject( - CPDF_PageObject* pPageObject) { - return pPageObject && m_pageObjects.Add(pPageObject); +void CPDF_PageContentGenerator::InsertPageObject(CPDF_PageObject* pPageObject) { + if (pPageObject) + m_pageObjects.push_back(pPageObject); } void CPDF_PageContentGenerator::GenerateContent() { CFX_ByteTextBuf buf; - CPDF_Dictionary* pPageDict = m_pPage->m_pFormDict; - for (int i = 0; i < m_pageObjects.GetSize(); ++i) { - CPDF_PageObject* pPageObj = m_pageObjects[i]; - if (!pPageObj || !pPageObj->IsImage()) { - continue; - } - ProcessImage(buf, pPageObj->AsImage()); + for (CPDF_PageObject* pPageObj : m_pageObjects) { + CPDF_ImageObject* pImageObject = pPageObj->AsImage(); + if (pImageObject) + ProcessImage(buf, pImageObject); } + CPDF_Dictionary* pPageDict = m_pPage->m_pFormDict; CPDF_Object* pContent = pPageDict ? pPageDict->GetDirectObjectFor("Contents") : nullptr; if (pContent) diff --git a/core/fpdfapi/edit/cpdf_pagecontentgenerator.h b/core/fpdfapi/edit/cpdf_pagecontentgenerator.h index 1470ca8e83..ce605f0dfe 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 <vector> + #include "core/fpdfapi/parser/cpdf_document.h" #include "core/fxcrt/fx_basic.h" #include "core/fxcrt/fx_coordinates.h" @@ -22,7 +24,7 @@ class CPDF_PageContentGenerator { explicit CPDF_PageContentGenerator(CPDF_Page* pPage); ~CPDF_PageContentGenerator(); - FX_BOOL InsertPageObject(CPDF_PageObject* pPageObject); + void InsertPageObject(CPDF_PageObject* pPageObject); void GenerateContent(); void TransformContent(CFX_Matrix& matrix); @@ -37,7 +39,7 @@ class CPDF_PageContentGenerator { CPDF_Page* m_pPage; CPDF_Document* m_pDocument; - CFX_ArrayTemplate<CPDF_PageObject*> m_pageObjects; + std::vector<CPDF_PageObject*> m_pageObjects; }; #endif // CORE_FPDFAPI_EDIT_CPDF_PAGECONTENTGENERATOR_H_ |