summaryrefslogtreecommitdiff
path: root/core/fpdfapi/edit
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfapi/edit')
-rw-r--r--core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp13
-rw-r--r--core/fpdfapi/edit/cpdf_pagecontentgenerator.h7
2 files changed, 11 insertions, 9 deletions
diff --git a/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp b/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp
index 8238414e64..fe65e5916c 100644
--- a/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp
+++ b/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp
@@ -52,7 +52,7 @@ CPDF_PageContentGenerator::CPDF_PageContentGenerator(CPDF_Page* pPage)
: m_pPage(pPage), m_pDocument(m_pPage->m_pDocument.Get()) {
for (const auto& pObj : *pPage->GetPageObjectList()) {
if (pObj)
- m_pageObjects.push_back(pObj.get());
+ m_pageObjects.emplace_back(pObj.get());
}
}
@@ -60,7 +60,7 @@ CPDF_PageContentGenerator::~CPDF_PageContentGenerator() {}
void CPDF_PageContentGenerator::GenerateContent() {
CFX_ByteTextBuf buf;
- for (CPDF_PageObject* pPageObj : m_pageObjects) {
+ for (auto& pPageObj : m_pageObjects) {
if (CPDF_ImageObject* pImageObject = pPageObj->AsImage())
ProcessImage(&buf, pImageObject);
else if (CPDF_PathObject* pPathObj = pPageObj->AsPath())
@@ -76,7 +76,7 @@ void CPDF_PageContentGenerator::GenerateContent() {
CPDF_Stream* pStream = m_pDocument->NewIndirect<CPDF_Stream>();
pStream->SetData(buf.GetBuffer(), buf.GetLength());
- pPageDict->SetNewFor<CPDF_Reference>("Contents", m_pDocument,
+ pPageDict->SetNewFor<CPDF_Reference>("Contents", m_pDocument.Get(),
pStream->GetObjNum());
}
@@ -87,7 +87,7 @@ CFX_ByteString CPDF_PageContentGenerator::RealizeResource(
if (!m_pPage->m_pResources) {
m_pPage->m_pResources = m_pDocument->NewIndirect<CPDF_Dictionary>();
m_pPage->m_pFormDict->SetNewFor<CPDF_Reference>(
- "Resources", m_pDocument, m_pPage->m_pResources->GetObjNum());
+ "Resources", m_pDocument.Get(), m_pPage->m_pResources->GetObjNum());
}
CPDF_Dictionary* pResList = m_pPage->m_pResources->GetDictFor(bsType);
if (!pResList)
@@ -102,7 +102,8 @@ CFX_ByteString CPDF_PageContentGenerator::RealizeResource(
}
idnum++;
}
- pResList->SetNewFor<CPDF_Reference>(name, m_pDocument, dwResourceObjNum);
+ pResList->SetNewFor<CPDF_Reference>(name, m_pDocument.Get(),
+ dwResourceObjNum);
return name;
}
@@ -246,7 +247,7 @@ void CPDF_PageContentGenerator::ProcessText(CFX_ByteTextBuf* buf,
*buf << "BT " << pTextObj->GetTextMatrix() << " Tm ";
CPDF_Font* pFont = pTextObj->GetFont();
if (!pFont)
- pFont = CPDF_Font::GetStockFont(m_pDocument, "Helvetica");
+ pFont = CPDF_Font::GetStockFont(m_pDocument.Get(), "Helvetica");
FontData fontD;
if (pFont->IsType1Font())
fontD.type = "Type1";
diff --git a/core/fpdfapi/edit/cpdf_pagecontentgenerator.h b/core/fpdfapi/edit/cpdf_pagecontentgenerator.h
index 73e75187e4..6c54d3130e 100644
--- a/core/fpdfapi/edit/cpdf_pagecontentgenerator.h
+++ b/core/fpdfapi/edit/cpdf_pagecontentgenerator.h
@@ -9,6 +9,7 @@
#include <vector>
+#include "core/fxcrt/cfx_unowned_ptr.h"
#include "core/fxcrt/fx_basic.h"
#include "core/fxcrt/fx_system.h"
@@ -36,9 +37,9 @@ class CPDF_PageContentGenerator {
CFX_ByteString RealizeResource(uint32_t dwResourceObjNum,
const CFX_ByteString& bsType);
- CPDF_Page* const m_pPage;
- CPDF_Document* const m_pDocument;
- std::vector<CPDF_PageObject*> m_pageObjects;
+ CFX_UnownedPtr<CPDF_Page> const m_pPage;
+ CFX_UnownedPtr<CPDF_Document> const m_pDocument;
+ std::vector<CFX_UnownedPtr<CPDF_PageObject>> m_pageObjects;
};
#endif // CORE_FPDFAPI_EDIT_CPDF_PAGECONTENTGENERATOR_H_