Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(147)

Unified Diff: fpdfsdk/src/fpdf_transformpage.cpp

Issue 1422513004: Merge to XFA: Add type cast definitions for CPDF_Stream. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: fpdfsdk/src/fpdf_transformpage.cpp
diff --git a/fpdfsdk/src/fpdf_transformpage.cpp b/fpdfsdk/src/fpdf_transformpage.cpp
index d2ad26bf644c64ab6796d4de15212f2d67975fbd..20713fe07d4b78ee7462132dced2383b2c1f8feb 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());

Powered by Google App Engine
This is Rietveld 408576698