summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2015-10-22 15:34:16 -0400
committerDan Sinclair <dsinclair@chromium.org>2015-10-22 15:34:16 -0400
commit338805f1366dcdf9a5b48cf591541cf98d7490f1 (patch)
tree161b722bbb0628b290084b20fa8aa8f1d436c896 /core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
parentc6d8683dbdd922c86375fb0520d420de13d683ed (diff)
downloadpdfium-338805f1366dcdf9a5b48cf591541cf98d7490f1.tar.xz
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 .
Diffstat (limited to 'core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp')
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp11
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;
}