diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2015-10-22 16:45:48 -0400 |
---|---|---|
committer | Dan Sinclair <dsinclair@chromium.org> | 2015-10-22 16:45:48 -0400 |
commit | aa435ba7fe0aacd9102e8c73311c5382ca112439 (patch) | |
tree | d37573646c6135126d3971358024a70ee222fb21 /core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp | |
parent | 2b11dc1220746d2f6f97a940fc9e4235c8ed4975 (diff) | |
download | pdfium-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 'core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp')
-rw-r--r-- | core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp index 7aa2cf8aa3..3295b7f9e0 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp @@ -716,12 +716,12 @@ void CPDF_StreamContentParser::Handle_ExecuteXObject() { return; } } - CPDF_Stream* pXObject = - (CPDF_Stream*)FindResourceObj(FX_BSTRC("XObject"), name); - if (pXObject == NULL || pXObject->GetType() != PDFOBJ_STREAM) { + CPDF_Stream* pXObject = ToStream(FindResourceObj(FX_BSTRC("XObject"), name)); + if (!pXObject) { m_bResourceMissing = TRUE; return; } + CFX_ByteStringC type = pXObject->GetDict() ? pXObject->GetDict()->GetConstString(FX_BSTRC("Subtype")) @@ -1151,7 +1151,7 @@ void CPDF_StreamContentParser::Handle_ShadeFill() { bbox = m_BBox; } if (pShading->m_ShadingType >= 4) { - bbox.Intersect(_GetShadingBBox((CPDF_Stream*)pShading->m_pShadingObj, + bbox.Intersect(_GetShadingBBox(ToStream(pShading->m_pShadingObj), pShading->m_ShadingType, &pObj->m_Matrix, pShading->m_pFunctions, pShading->m_nFuncs, pShading->m_pCS)); @@ -1262,8 +1262,7 @@ CPDF_Pattern* CPDF_StreamContentParser::FindPattern(const CFX_ByteString& name, FX_BOOL bShading) { CPDF_Object* pPattern = FindResourceObj( bShading ? FX_BSTRC("Shading") : FX_BSTRC("Pattern"), name); - if (pPattern == NULL || - (!pPattern->IsDictionary() && pPattern->GetType() != PDFOBJ_STREAM)) { + if (!pPattern || (!pPattern->IsDictionary() && !pPattern->IsStream())) { m_bResourceMissing = TRUE; return NULL; } |