diff options
author | Tom Sepez <tsepez@chromium.org> | 2016-10-14 17:45:56 -0700 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2016-10-14 17:45:56 -0700 |
commit | c25a4219431c90a95233a08f25eecc921abbf3ed (patch) | |
tree | bd2ad923d527440785c19623fe2d19cc1a70a92d /core/fpdfdoc/cpvt_generateap.cpp | |
parent | 62f367348ff8ff1e64c6f52c1ee5f77c3a89edc1 (diff) | |
download | pdfium-c25a4219431c90a95233a08f25eecc921abbf3ed.tar.xz |
Revert "Update CPDF_IndirectObjectHolder APIs for unique objects."
This reverts commit 3ba098595ae56b64eacc0c25ab76b89a4d78d920.
TBR=thestig@chromium.org,weili@chromium.org
Review URL: https://codereview.chromium.org/2424533003 .
Diffstat (limited to 'core/fpdfdoc/cpvt_generateap.cpp')
-rw-r--r-- | core/fpdfdoc/cpvt_generateap.cpp | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/core/fpdfdoc/cpvt_generateap.cpp b/core/fpdfdoc/cpvt_generateap.cpp index 24827e3f22..28b436a05c 100644 --- a/core/fpdfdoc/cpvt_generateap.cpp +++ b/core/fpdfdoc/cpvt_generateap.cpp @@ -58,12 +58,13 @@ bool GenerateWidgetAP(CPDF_Document* pDoc, CPDF_Dictionary* pFontDict = pDRFontDict->GetDictFor(sFontName.Mid(1)); if (!pFontDict) { - pFontDict = pDoc->AddIndirectDictionary(pDoc->GetByteStringPool()); + pFontDict = new CPDF_Dictionary(pDoc->GetByteStringPool()); pFontDict->SetNameFor("Type", "Font"); pFontDict->SetNameFor("Subtype", "Type1"); pFontDict->SetNameFor("BaseFont", "Helvetica"); pFontDict->SetNameFor("Encoding", "WinAnsiEncoding"); - pDRFontDict->SetReferenceFor(sFontName.Mid(1), pDoc, pFontDict); + pDRFontDict->SetReferenceFor(sFontName.Mid(1), pDoc, + pDoc->AddIndirectObject(pFontDict)); } CPDF_Font* pDefFont = pDoc->LoadFont(pFontDict); if (!pDefFont) @@ -167,8 +168,8 @@ bool GenerateWidgetAP(CPDF_Document* pDoc, } CPDF_Stream* pNormalStream = pAPDict->GetStreamFor("N"); if (!pNormalStream) { - pNormalStream = pDoc->AddIndirectStream(); - pAPDict->SetReferenceFor("N", pDoc, pNormalStream); + pNormalStream = new CPDF_Stream; + pAPDict->SetReferenceFor("N", pDoc, pDoc->AddIndirectObject(pNormalStream)); } CPDF_Dictionary* pStreamDict = pNormalStream->GetDict(); if (pStreamDict) { @@ -182,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"); @@ -432,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"); @@ -556,8 +559,7 @@ CPDF_Dictionary* GenerateExtGStateDict(const CPDF_Dictionary& pAnnotDict, CPDF_Dictionary* GenerateResourceFontDict(CPDF_Document* pDoc, const CFX_ByteString& sFontDictName) { - CPDF_Dictionary* pFontDict = - pDoc->AddIndirectDictionary(pDoc->GetByteStringPool()); + CPDF_Dictionary* pFontDict = new CPDF_Dictionary(pDoc->GetByteStringPool()); pFontDict->SetNameFor("Type", "Font"); pFontDict->SetNameFor("Subtype", "Type1"); pFontDict->SetNameFor("BaseFont", "Helvetica"); @@ -565,7 +567,8 @@ CPDF_Dictionary* GenerateResourceFontDict(CPDF_Document* pDoc, CPDF_Dictionary* pResourceFontDict = new CPDF_Dictionary(pDoc->GetByteStringPool()); - pResourceFontDict->SetReferenceFor(sFontDictName, pDoc, pFontDict); + pResourceFontDict->SetReferenceFor(sFontDictName, pDoc, + pDoc->AddIndirectObject(pFontDict)); return pResourceFontDict; } @@ -593,9 +596,9 @@ void GenerateAndSetAPDict(CPDF_Document* pDoc, CPDF_Dictionary* pAPDict = new CPDF_Dictionary(pDoc->GetByteStringPool()); pAnnotDict->SetFor("AP", pAPDict); - CPDF_Stream* pNormalStream = pDoc->AddIndirectStream(); + CPDF_Stream* pNormalStream = new CPDF_Stream; pNormalStream->SetData(sAppStream.GetBuffer(), sAppStream.GetSize()); - pAPDict->SetReferenceFor("N", pDoc, pNormalStream); + pAPDict->SetReferenceFor("N", pDoc, pDoc->AddIndirectObject(pNormalStream)); CPDF_Dictionary* pStreamDict = pNormalStream->GetDict(); pStreamDict->SetIntegerFor("FormType", 1); |