summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/fpdf_transformpage.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2015-10-22 16:45:48 -0400
committerDan Sinclair <dsinclair@chromium.org>2015-10-22 16:45:48 -0400
commitaa435ba7fe0aacd9102e8c73311c5382ca112439 (patch)
treed37573646c6135126d3971358024a70ee222fb21 /fpdfsdk/src/fpdf_transformpage.cpp
parent2b11dc1220746d2f6f97a940fc9e4235c8ed4975 (diff)
downloadpdfium-aa435ba7fe0aacd9102e8c73311c5382ca112439.tar.xz
Merge to XFA: Add type cast definitions for CPDF_Stream.
This Cl adds ToStream, CPDF_Object::AsStream and CPDF_Object::IsStream and updates the src to use them as needed. BUG=pdfium:201 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1402413004 . (cherry picked from commit 338805f1366dcdf9a5b48cf591541cf98d7490f1) Review URL: https://codereview.chromium.org/1422513004 .
Diffstat (limited to 'fpdfsdk/src/fpdf_transformpage.cpp')
-rw-r--r--fpdfsdk/src/fpdf_transformpage.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/fpdfsdk/src/fpdf_transformpage.cpp b/fpdfsdk/src/fpdf_transformpage.cpp
index d2ad26bf64..20713fe07d 100644
--- a/fpdfsdk/src/fpdf_transformpage.cpp
+++ b/fpdfsdk/src/fpdf_transformpage.cpp
@@ -144,7 +144,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 (pDirectObj->GetType() == PDFOBJ_STREAM) {
+ } else if (pDirectObj->IsStream()) {
pContentArray = new CPDF_Array();
pContentArray->AddReference(pDoc, pStream->GetObjNum());
pContentArray->AddReference(pDoc, pDirectObj->GetObjNum());
@@ -162,16 +162,17 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFPage_TransFormWithClip(FPDF_PAGE page,
if (pPattenDict) {
FX_POSITION pos = pPattenDict->GetStartPos();
while (pos) {
- CPDF_Dictionary* pDict = NULL;
+ CPDF_Dictionary* pDict = nullptr;
CFX_ByteString key;
CPDF_Object* pObj = pPattenDict->GetNextElement(pos, key);
if (pObj->GetType() == PDFOBJ_REFERENCE)
pObj = pObj->GetDirect();
- if (pObj->IsDictionary()) {
+
+ if (pObj->IsDictionary())
pDict = pObj->AsDictionary();
- } else if (pObj->GetType() == PDFOBJ_STREAM) {
- pDict = ((CPDF_Stream*)pObj)->GetDict();
- } else
+ else if (CPDF_Stream* pStream = pObj->AsStream())
+ pDict = pStream->GetDict();
+ else
continue;
CFX_AffineMatrix m = pDict->GetMatrix(FX_BSTRC("Matrix"));
@@ -313,7 +314,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 (pDirectObj->GetType() == PDFOBJ_STREAM) {
+ } else if (pDirectObj->IsStream()) {
pContentArray = new CPDF_Array();
pContentArray->AddReference(pDoc, pStream->GetObjNum());
pContentArray->AddReference(pDoc, pDirectObj->GetObjNum());