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

Unified Diff: core/fpdfdoc/cpvt_generateap.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 | « core/fpdfdoc/cpvt_fontmap.cpp ('k') | fpdfsdk/cpdfsdk_baannot.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfdoc/cpvt_generateap.cpp
diff --git a/core/fpdfdoc/cpvt_generateap.cpp b/core/fpdfdoc/cpvt_generateap.cpp
index d7c8bec3a14d663510a97cf4c12fa5ce7aeffaa7..f7ece9bc35db644a4d79ef878dd74b3bc5750bf9 100644
--- a/core/fpdfdoc/cpvt_generateap.cpp
+++ b/core/fpdfdoc/cpvt_generateap.cpp
@@ -63,8 +63,8 @@ bool GenerateWidgetAP(CPDF_Document* pDoc,
pFontDict->SetNameFor("Subtype", "Type1");
pFontDict->SetNameFor("BaseFont", "Helvetica");
pFontDict->SetNameFor("Encoding", "WinAnsiEncoding");
- pDoc->AddIndirectObject(pFontDict);
- pDRFontDict->SetReferenceFor(sFontName.Mid(1), pDoc, pFontDict);
+ pDRFontDict->SetReferenceFor(sFontName.Mid(1), pDoc,
+ pDoc->AddIndirectObject(pFontDict));
}
CPDF_Font* pDefFont = pDoc->LoadFont(pFontDict);
if (!pDefFont)
@@ -169,8 +169,7 @@ bool GenerateWidgetAP(CPDF_Document* pDoc,
CPDF_Stream* pNormalStream = pAPDict->GetStreamFor("N");
if (!pNormalStream) {
pNormalStream = new CPDF_Stream;
- int32_t objnum = pDoc->AddIndirectObject(pNormalStream);
- pAnnotDict->GetDictFor("AP")->SetReferenceFor("N", pDoc, objnum);
+ pAPDict->SetReferenceFor("N", pDoc, pDoc->AddIndirectObject(pNormalStream));
}
CPDF_Dictionary* pStreamDict = pNormalStream->GetDict();
if (pStreamDict) {
@@ -184,7 +183,8 @@ bool GenerateWidgetAP(CPDF_Document* pDoc,
pStreamResList->SetFor("Font", pStreamResFontList);
}
if (!pStreamResFontList->KeyExist(sFontName))
- pStreamResFontList->SetReferenceFor(sFontName, pDoc, pFontDict);
+ pStreamResFontList->SetReferenceFor(sFontName, pDoc,
+ pFontDict->GetObjNum());
} else {
pStreamDict->SetFor("Resources", pFormDict->GetDictFor("DR")->Clone());
pStreamResList = pStreamDict->GetDictFor("Resources");
@@ -434,7 +434,8 @@ bool GenerateWidgetAP(CPDF_Document* pDoc,
pStreamResList->SetFor("Font", pStreamResFontList);
}
if (!pStreamResFontList->KeyExist(sFontName))
- pStreamResFontList->SetReferenceFor(sFontName, pDoc, pFontDict);
+ pStreamResFontList->SetReferenceFor(sFontName, pDoc,
+ pFontDict->GetObjNum());
} else {
pStreamDict->SetFor("Resources", pFormDict->GetDictFor("DR")->Clone());
pStreamResList = pStreamDict->GetDictFor("Resources");
@@ -562,10 +563,10 @@ CPDF_Dictionary* GenerateResourceFontDict(CPDF_Document* pDoc,
pFontDict->SetNameFor("Subtype", "Type1");
pFontDict->SetNameFor("BaseFont", "Helvetica");
pFontDict->SetNameFor("Encoding", "WinAnsiEncoding");
- pDoc->AddIndirectObject(pFontDict);
CPDF_Dictionary* pResourceFontDict = new CPDF_Dictionary;
- pResourceFontDict->SetReferenceFor(sFontDictName, pDoc, pFontDict);
+ pResourceFontDict->SetReferenceFor(sFontDictName, pDoc,
+ pDoc->AddIndirectObject(pFontDict));
return pResourceFontDict;
}
@@ -593,9 +594,8 @@ void GenerateAndSetAPDict(CPDF_Document* pDoc,
pAnnotDict->SetFor("AP", pAPDict);
CPDF_Stream* pNormalStream = new CPDF_Stream;
- int32_t objnum = pDoc->AddIndirectObject(pNormalStream);
- pAnnotDict->GetDictFor("AP")->SetReferenceFor("N", pDoc, objnum);
pNormalStream->SetData(sAppStream.GetBuffer(), sAppStream.GetSize());
+ pAPDict->SetReferenceFor("N", pDoc, pDoc->AddIndirectObject(pNormalStream));
CPDF_Dictionary* pStreamDict = pNormalStream->GetDict();
pStreamDict->SetIntegerFor("FormType", 1);
« no previous file with comments | « core/fpdfdoc/cpvt_fontmap.cpp ('k') | fpdfsdk/cpdfsdk_baannot.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698