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

Unified Diff: fpdfsdk/fpdf_flatten.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 | « fpdfsdk/formfiller/cba_fontmap.cpp ('k') | fpdfsdk/fpdf_transformpage.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/fpdf_flatten.cpp
diff --git a/fpdfsdk/fpdf_flatten.cpp b/fpdfsdk/fpdf_flatten.cpp
index aa21b280edcc5d3a5ae85a656ec7a85ec4b44aaa..5ee485855b32360fee9c8bfd889a4dafeb992b11 100644
--- a/fpdfsdk/fpdf_flatten.cpp
+++ b/fpdfsdk/fpdf_flatten.cpp
@@ -195,12 +195,11 @@ void SetPageContents(CFX_ByteString key,
if (!key.IsEmpty()) {
CPDF_Stream* pNewContents =
new CPDF_Stream(nullptr, 0, new CPDF_Dictionary);
- pPage->SetReferenceFor("Contents", pDocument,
- pDocument->AddIndirectObject(pNewContents));
-
CFX_ByteString sStream;
sStream.Format("q 1 0 0 1 0 0 cm /%s Do Q", key.c_str());
pNewContents->SetData(sStream.raw_str(), sStream.GetLength());
+ pPage->SetReferenceFor("Contents", pDocument,
+ pDocument->AddIndirectObject(pNewContents));
}
return;
}
@@ -234,18 +233,17 @@ void SetPageContents(CFX_ByteString key,
if (!pContentsArray)
return;
- uint32_t dwObjNum = pDocument->AddIndirectObject(pContentsArray);
- pPage->SetReferenceFor("Contents", pDocument, dwObjNum);
+ pPage->SetReferenceFor("Contents", pDocument,
+ pDocument->AddIndirectObject(pContentsArray));
if (!key.IsEmpty()) {
CPDF_Stream* pNewContents =
new CPDF_Stream(nullptr, 0, new CPDF_Dictionary);
- dwObjNum = pDocument->AddIndirectObject(pNewContents);
- pContentsArray->AddReference(pDocument, dwObjNum);
-
CFX_ByteString sStream;
sStream.Format("q 1 0 0 1 0 0 cm /%s Do Q", key.c_str());
pNewContents->SetData(sStream.raw_str(), sStream.GetLength());
+ pContentsArray->AddReference(pDocument,
+ pDocument->AddIndirectObject(pNewContents));
}
}
@@ -482,15 +480,14 @@ DLLEXPORT int STDCALL FPDFPage_Flatten(FPDF_PAGE page, int nFlag) {
CFX_ByteString sFormName;
sFormName.Format("F%d", i);
- uint32_t dwStreamObjNum = pDocument->AddIndirectObject(pObj);
- pXObject->SetReferenceFor(sFormName, pDocument, dwStreamObjNum);
+ pXObject->SetReferenceFor(sFormName, pDocument,
+ pDocument->AddIndirectObject(pObj));
CPDF_StreamAcc acc;
acc.LoadAllData(pNewXObject);
const uint8_t* pData = acc.GetData();
CFX_ByteString sStream(pData, acc.GetSize());
- CFX_ByteString sTemp;
if (matrix.IsIdentity()) {
matrix.a = 1.0f;
@@ -501,6 +498,7 @@ DLLEXPORT int STDCALL FPDFPage_Flatten(FPDF_PAGE page, int nFlag) {
matrix.f = 0.0f;
}
+ CFX_ByteString sTemp;
CFX_Matrix m = GetMatrix(rcAnnot, rcStream, matrix);
sTemp.Format("q %f 0 0 %f %f %f cm /%s Do Q\n", m.a, m.d, m.e, m.f,
sFormName.c_str());
« no previous file with comments | « fpdfsdk/formfiller/cba_fontmap.cpp ('k') | fpdfsdk/fpdf_transformpage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698