summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdf_transformpage.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2016-10-14 17:45:56 -0700
committerTom Sepez <tsepez@chromium.org>2016-10-14 17:45:56 -0700
commitc25a4219431c90a95233a08f25eecc921abbf3ed (patch)
treebd2ad923d527440785c19623fe2d19cc1a70a92d /fpdfsdk/fpdf_transformpage.cpp
parent62f367348ff8ff1e64c6f52c1ee5f77c3a89edc1 (diff)
downloadpdfium-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 'fpdfsdk/fpdf_transformpage.cpp')
-rw-r--r--fpdfsdk/fpdf_transformpage.cpp29
1 files changed, 17 insertions, 12 deletions
diff --git a/fpdfsdk/fpdf_transformpage.cpp b/fpdfsdk/fpdf_transformpage.cpp
index ce09da32a2..47b6cec9ea 100644
--- a/fpdfsdk/fpdf_transformpage.cpp
+++ b/fpdfsdk/fpdf_transformpage.cpp
@@ -129,13 +129,15 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFPage_TransFormWithClip(FPDF_PAGE page,
if (!pDoc)
return FALSE;
- CPDF_Stream* pStream = pDoc->AddIndirectStream(
- nullptr, 0, new CPDF_Dictionary(pDoc->GetByteStringPool()));
+ CPDF_Dictionary* pDic = new CPDF_Dictionary(pDoc->GetByteStringPool());
+ CPDF_Stream* pStream = new CPDF_Stream(nullptr, 0, pDic);
pStream->SetData(textBuf.GetBuffer(), textBuf.GetSize());
+ pDoc->AddIndirectObject(pStream);
+ pDic = new CPDF_Dictionary(pDoc->GetByteStringPool());
- CPDF_Stream* pEndStream = pDoc->AddIndirectStream(
- nullptr, 0, new CPDF_Dictionary(pDoc->GetByteStringPool()));
+ CPDF_Stream* pEndStream = new CPDF_Stream(nullptr, 0, pDic);
pEndStream->SetData((const uint8_t*)" Q", 2);
+ pDoc->AddIndirectObject(pEndStream);
CPDF_Array* pContentArray = nullptr;
CPDF_Array* pArray = ToArray(pContentObj);
@@ -154,11 +156,12 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFPage_TransFormWithClip(FPDF_PAGE page,
pContentArray->InsertAt(0, pRef);
pContentArray->AddReference(pDoc, pEndStream->GetObjNum());
} else if (pDirectObj->IsStream()) {
- pContentArray = pDoc->AddIndirectArray();
+ pContentArray = new CPDF_Array();
pContentArray->AddReference(pDoc, pStream->GetObjNum());
pContentArray->AddReference(pDoc, pDirectObj->GetObjNum());
pContentArray->AddReference(pDoc, pEndStream->GetObjNum());
- pPageDic->SetReferenceFor("Contents", pDoc, pContentArray);
+ pPageDic->SetReferenceFor("Contents", pDoc,
+ pDoc->AddIndirectObject(pContentArray));
}
}
}
@@ -302,9 +305,10 @@ DLLEXPORT void STDCALL FPDFPage_InsertClipPath(FPDF_PAGE page,
if (!pDoc)
return;
- CPDF_Stream* pStream = pDoc->AddIndirectStream(
- nullptr, 0, new CPDF_Dictionary(pDoc->GetByteStringPool()));
+ CPDF_Dictionary* pDic = new CPDF_Dictionary(pDoc->GetByteStringPool());
+ CPDF_Stream* pStream = new CPDF_Stream(nullptr, 0, pDic);
pStream->SetData(strClip.GetBuffer(), strClip.GetSize());
+ pDoc->AddIndirectObject(pStream);
CPDF_Array* pContentArray = nullptr;
CPDF_Array* pArray = ToArray(pContentObj);
@@ -321,10 +325,11 @@ DLLEXPORT void STDCALL FPDFPage_InsertClipPath(FPDF_PAGE page,
CPDF_Reference* pRef = new CPDF_Reference(pDoc, pStream->GetObjNum());
pContentArray->InsertAt(0, pRef);
} else if (pDirectObj->IsStream()) {
- pContentArray = pDoc->AddIndirectArray();
- pContentArray->AddReference(pDoc, pStream);
- pContentArray->AddReference(pDoc, pDirectObj);
- pPageDic->SetReferenceFor("Contents", pDoc, pContentArray);
+ pContentArray = new CPDF_Array();
+ pContentArray->AddReference(pDoc, pStream->GetObjNum());
+ pContentArray->AddReference(pDoc, pDirectObj->GetObjNum());
+ pPageDic->SetReferenceFor("Contents", pDoc,
+ pDoc->AddIndirectObject(pContentArray));
}
}
}