summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/fpdf_transformpage.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2015-10-26 16:54:39 -0400
committerDan Sinclair <dsinclair@chromium.org>2015-10-26 16:54:39 -0400
commitbf81c14cdb2b336a62f97119315f6bc43502e840 (patch)
treec9bc0f23a2cc60307b77a69851733ed85c87196f /fpdfsdk/src/fpdf_transformpage.cpp
parent15ce59a0f34278b6b222675c77b25e3e0c50139f (diff)
downloadpdfium-bf81c14cdb2b336a62f97119315f6bc43502e840.tar.xz
Merge to XFA: Revert "Revert "Add type cast definitions for CPDF_Reference.""
This reverts commit 7e155865c90cc1115cc7193b7646a341d8f9093e. Add type cast definitions for CPDF_Reference. This Cl adds ToReference, CPDF_Object::AsReference and CPDF_Object::IsReference and updates the src to use them as needed. BUG=pdfium:201 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1418923005 . (cherry picked from commit 6ee3484bcb413f4cce303e237fe15e2bdaf51ade) Review URL: https://codereview.chromium.org/1410073007 .
Diffstat (limited to 'fpdfsdk/src/fpdf_transformpage.cpp')
-rw-r--r--fpdfsdk/src/fpdf_transformpage.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/fpdfsdk/src/fpdf_transformpage.cpp b/fpdfsdk/src/fpdf_transformpage.cpp
index 20713fe07d..8a835fb220 100644
--- a/fpdfsdk/src/fpdf_transformpage.cpp
+++ b/fpdfsdk/src/fpdf_transformpage.cpp
@@ -135,8 +135,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFPage_TransFormWithClip(FPDF_PAGE page,
CPDF_Reference* pRef = new CPDF_Reference(pDoc, pStream->GetObjNum());
pContentArray->InsertAt(0, pRef);
pContentArray->AddReference(pDoc, pEndStream);
- } else if (pContentObj && pContentObj->GetType() == PDFOBJ_REFERENCE) {
- CPDF_Reference* pReference = (CPDF_Reference*)pContentObj;
+ } else if (CPDF_Reference* pReference = ToReference(pContentObj)) {
CPDF_Object* pDirectObj = pReference->GetDirect();
if (pDirectObj) {
if (CPDF_Array* pArray = pDirectObj->AsArray()) {
@@ -165,7 +164,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFPage_TransFormWithClip(FPDF_PAGE page,
CPDF_Dictionary* pDict = nullptr;
CFX_ByteString key;
CPDF_Object* pObj = pPattenDict->GetNextElement(pos, key);
- if (pObj->GetType() == PDFOBJ_REFERENCE)
+ if (pObj->IsReference())
pObj = pObj->GetDirect();
if (pObj->IsDictionary())
@@ -306,8 +305,7 @@ DLLEXPORT void STDCALL FPDFPage_InsertClipPath(FPDF_PAGE page,
pContentArray = pArray;
CPDF_Reference* pRef = new CPDF_Reference(pDoc, pStream->GetObjNum());
pContentArray->InsertAt(0, pRef);
- } else if (pContentObj && pContentObj->GetType() == PDFOBJ_REFERENCE) {
- CPDF_Reference* pReference = (CPDF_Reference*)pContentObj;
+ } else if (CPDF_Reference* pReference = ToReference(pContentObj)) {
CPDF_Object* pDirectObj = pReference->GetDirect();
if (pDirectObj) {
if (CPDF_Array* pArray = pDirectObj->AsArray()) {