Index: core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp |
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp |
index 127fb932502b72d94e8be2550a14da63e1ba460a..ffa5e62a0784a671662e4b7c4c97936b8b8d372f 100644 |
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp |
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp |
@@ -418,11 +418,9 @@ void CPDF_StreamContentParser::Handle_BeginMarkedContent_Dictionary() { |
} |
bDirect = FALSE; |
} |
- if (pProperty->GetType() != PDFOBJ_DICTIONARY) { |
- return; |
+ if (CPDF_Dictionary* pDict = pProperty->AsDictionary()) { |
+ m_CurContentMark.GetModify()->AddMark(tag, pDict, bDirect); |
} |
- m_CurContentMark.GetModify()->AddMark(tag, (CPDF_Dictionary*)pProperty, |
- bDirect); |
} |
void CPDF_StreamContentParser::Handle_BeginMarkedContent() { |
if (!m_Options.m_bMarkedContent) { |
@@ -487,7 +485,7 @@ static CFX_ByteStringC _PDF_FindFullName(const _FX_BSTR* table, |
void _PDF_ReplaceAbbr(CPDF_Object* pObj) { |
switch (pObj->GetType()) { |
case PDFOBJ_DICTIONARY: { |
- CPDF_Dictionary* pDict = (CPDF_Dictionary*)pObj; |
+ CPDF_Dictionary* pDict = pObj->AsDictionary(); |
FX_POSITION pos = pDict->GetStartPos(); |
while (pos) { |
CFX_ByteString key; |
@@ -550,7 +548,7 @@ static CFX_ByteStringC _PDF_FindAbbrName(const _FX_BSTR* table, |
void _PDF_ReplaceFull(CPDF_Object* pObj) { |
switch (pObj->GetType()) { |
case PDFOBJ_DICTIONARY: { |
- CPDF_Dictionary* pDict = (CPDF_Dictionary*)pObj; |
+ CPDF_Dictionary* pDict = pObj->AsDictionary(); |
FX_POSITION pos = pDict->GetStartPos(); |
while (pos) { |
CFX_ByteString key; |
@@ -886,8 +884,8 @@ void CPDF_StreamContentParser::Handle_SetGray_Stroke() { |
void CPDF_StreamContentParser::Handle_SetExtendGraphState() { |
CFX_ByteString name = GetString(0); |
CPDF_Dictionary* pGS = |
- (CPDF_Dictionary*)FindResourceObj(FX_BSTRC("ExtGState"), name); |
- if (pGS == NULL || pGS->GetType() != PDFOBJ_DICTIONARY) { |
+ ToDictionary(FindResourceObj(FX_BSTRC("ExtGState"), name)); |
+ if (!pGS) { |
m_bResourceMissing = TRUE; |
return; |
} |
@@ -1217,11 +1215,12 @@ CPDF_Object* CPDF_StreamContentParser::FindResourceObj( |
} |
CPDF_Font* CPDF_StreamContentParser::FindFont(const CFX_ByteString& name) { |
CPDF_Dictionary* pFontDict = |
- (CPDF_Dictionary*)FindResourceObj(FX_BSTRC("Font"), name); |
- if (pFontDict == NULL || pFontDict->GetType() != PDFOBJ_DICTIONARY) { |
+ ToDictionary(FindResourceObj(FX_BSTRC("Font"), name)); |
+ if (!pFontDict) { |
m_bResourceMissing = TRUE; |
return CPDF_Font::GetStockFont(m_pDocument, FX_BSTRC("Helvetica")); |
} |
+ |
CPDF_Font* pFont = m_pDocument->LoadFont(pFontDict); |
if (pFont && pFont->GetType3Font()) { |
pFont->GetType3Font()->SetPageResources(m_pResources); |
@@ -1261,8 +1260,8 @@ 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->GetType() != PDFOBJ_DICTIONARY && |
- pPattern->GetType() != PDFOBJ_STREAM)) { |
+ if (pPattern == NULL || |
+ (!pPattern->IsDictionary() && pPattern->GetType() != PDFOBJ_STREAM)) { |
m_bResourceMissing = TRUE; |
return NULL; |
} |