diff options
author | tsepez <tsepez@chromium.org> | 2016-09-21 19:10:19 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-09-21 19:10:19 -0700 |
commit | bb577af2f17467a55c04fbff21a8f0ec1016601a (patch) | |
tree | 5a5321b1aff1bcc6ee6dc19928aa729a4ddc9a3d /fpdfsdk/fpdf_transformpage.cpp | |
parent | 7149abce42b211ad3c0eaa39a340825acd41a1ec (diff) | |
download | pdfium-bb577af2f17467a55c04fbff21a8f0ec1016601a.tar.xz |
Remove some objnum locals with AddIndirectObject
Also, it's idempotent, so simplify some logic in callers to
not care if objnum is zero.
The alternate forms are rarely used, using the objnum form
makes it clear that SetReferenceFor() can't possibly register
the object as a side-effect.
Review-Url: https://codereview.chromium.org/2361713002
Diffstat (limited to 'fpdfsdk/fpdf_transformpage.cpp')
-rw-r--r-- | fpdfsdk/fpdf_transformpage.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/fpdfsdk/fpdf_transformpage.cpp b/fpdfsdk/fpdf_transformpage.cpp index 204e49b695..68007d3ca5 100644 --- a/fpdfsdk/fpdf_transformpage.cpp +++ b/fpdfsdk/fpdf_transformpage.cpp @@ -144,7 +144,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFPage_TransFormWithClip(FPDF_PAGE page, pContentArray = pArray; CPDF_Reference* pRef = new CPDF_Reference(pDoc, pStream->GetObjNum()); pContentArray->InsertAt(0, pRef); - pContentArray->AddReference(pDoc, pEndStream); + pContentArray->AddReference(pDoc, pEndStream->GetObjNum()); } else if (CPDF_Reference* pReference = ToReference(pContentObj)) { CPDF_Object* pDirectObj = pReference->GetDirect(); if (pDirectObj) { @@ -153,12 +153,12 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFPage_TransFormWithClip(FPDF_PAGE page, pContentArray = pObjArray; CPDF_Reference* pRef = new CPDF_Reference(pDoc, pStream->GetObjNum()); pContentArray->InsertAt(0, pRef); - pContentArray->AddReference(pDoc, pEndStream); + pContentArray->AddReference(pDoc, pEndStream->GetObjNum()); } else if (pDirectObj->IsStream()) { pContentArray = new CPDF_Array(); pContentArray->AddReference(pDoc, pStream->GetObjNum()); pContentArray->AddReference(pDoc, pDirectObj->GetObjNum()); - pContentArray->AddReference(pDoc, pEndStream); + pContentArray->AddReference(pDoc, pEndStream->GetObjNum()); pPageDic->SetReferenceFor("Contents", pDoc, pDoc->AddIndirectObject(pContentArray)); } @@ -306,6 +306,7 @@ DLLEXPORT void STDCALL FPDFPage_InsertClipPath(FPDF_PAGE page, CPDF_Document* pDoc = pPage->m_pDocument; if (!pDoc) return; + pDoc->AddIndirectObject(pStream); CPDF_Array* pContentArray = nullptr; |