Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(771)

Unified Diff: core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp

Issue 2361713002: Remove some objnum locals with AddIndirectObject (Closed)
Patch Set: Same treatment for arrays Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | core/fpdfapi/fpdf_page/cpdf_image.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp
diff --git a/core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp b/core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp
index 7acd368683e16eb144f83445ed2cdfb041d7f81e..29c5940f5e75aa4e25b687d70295a2dbef0252a9 100644
--- a/core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp
+++ b/core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp
@@ -50,13 +50,13 @@ void CPDF_PageContentGenerator::GenerateContent() {
}
CPDF_Object* pContent =
pPageDict ? pPageDict->GetDirectObjectFor("Contents") : nullptr;
- if (pContent) {
+ if (pContent)
pPageDict->RemoveFor("Contents");
- }
+
CPDF_Stream* pStream = new CPDF_Stream;
pStream->SetData(buf.GetBuffer(), buf.GetLength());
- m_pDocument->AddIndirectObject(pStream);
- pPageDict->SetReferenceFor("Contents", m_pDocument, pStream->GetObjNum());
+ pPageDict->SetReferenceFor("Contents", m_pDocument,
+ m_pDocument->AddIndirectObject(pStream));
}
CFX_ByteString CPDF_PageContentGenerator::RealizeResource(
@@ -64,15 +64,15 @@ CFX_ByteString CPDF_PageContentGenerator::RealizeResource(
const CFX_ByteString& bsType) {
if (!m_pPage->m_pResources) {
m_pPage->m_pResources = new CPDF_Dictionary;
- int objnum = m_pDocument->AddIndirectObject(m_pPage->m_pResources);
- m_pPage->m_pFormDict->SetReferenceFor("Resources", m_pDocument, objnum);
+ m_pPage->m_pFormDict->SetReferenceFor(
+ "Resources", m_pDocument,
+ m_pDocument->AddIndirectObject(m_pPage->m_pResources));
}
CPDF_Dictionary* pResList = m_pPage->m_pResources->GetDictFor(bsType);
if (!pResList) {
pResList = new CPDF_Dictionary;
m_pPage->m_pResources->SetFor(bsType, pResList);
}
- m_pDocument->AddIndirectObject(pResourceObj);
CFX_ByteString name;
int idnum = 1;
while (1) {
@@ -82,7 +82,8 @@ CFX_ByteString CPDF_PageContentGenerator::RealizeResource(
}
idnum++;
}
- pResList->SetReferenceFor(name, m_pDocument, pResourceObj->GetObjNum());
+ pResList->SetReferenceFor(name, m_pDocument,
+ m_pDocument->AddIndirectObject(pResourceObj));
return name;
}
@@ -170,7 +171,6 @@ void CPDF_PageContentGenerator::TransformContent(CFX_Matrix& matrix) {
}
CPDF_Stream* pStream = new CPDF_Stream;
pStream->SetData(buf.GetBuffer(), buf.GetLength());
- m_pDocument->AddIndirectObject(pStream);
- m_pPage->m_pFormDict->SetReferenceFor("Contents", m_pDocument,
- pStream->GetObjNum());
+ m_pPage->m_pFormDict->SetReferenceFor(
+ "Contents", m_pDocument, m_pDocument->AddIndirectObject(pStream));
}
« no previous file with comments | « no previous file | core/fpdfapi/fpdf_page/cpdf_image.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698