summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi/fpdf_page
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2015-10-26 13:02:07 -0400
committerDan Sinclair <dsinclair@chromium.org>2015-10-26 13:02:07 -0400
commit7e155865c90cc1115cc7193b7646a341d8f9093e (patch)
tree44e4351192f0af909671df95a1aac16a1609f750 /core/src/fpdfapi/fpdf_page
parent9024e026dae1af064b8467bb0f62278417fb82d1 (diff)
downloadpdfium-7e155865c90cc1115cc7193b7646a341d8f9093e.tar.xz
Revert "Add type cast definitions for CPDF_Reference."
This is causing pixel test failures on the bots. FAILURE: bug_543018_2.in FAILURE: bug_543018_1.in FAILURE: bug_524043_1.in This reverts commit 9024e026dae1af064b8467bb0f62278417fb82d1. Add type cast definitions for CPDF_Reference. This Cl adds ToReference, CPDF_Object::AsReference and CPDF_Object::IsReference and updates the src to use them as needed. BUG=pdfium:201 TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1420973002 . Review URL: https://codereview.chromium.org/1414393006 .
Diffstat (limited to 'core/src/fpdfapi/fpdf_page')
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp53
1 files changed, 38 insertions, 15 deletions
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
index b12a65a844..3295b7f9e0 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
@@ -671,28 +671,51 @@ void CPDF_StreamContentParser::Handle_ExecuteXObject() {
CFX_ByteString name = GetString(0);
if (name == m_LastImageName && m_pLastImage && m_pLastImage->GetStream() &&
m_pLastImage->GetStream()->GetObjNum()) {
- AddImage(nullptr, m_pLastImage, FALSE);
+ AddImage(NULL, m_pLastImage, FALSE);
return;
}
-
if (m_Options.m_bTextOnly) {
- if (!m_pResources)
- return;
-
- CPDF_Dictionary* pList = m_pResources->GetDict(FX_BSTRC("XObject"));
- if (!pList && m_pPageResources && m_pResources != m_pPageResources)
- pList = m_pPageResources->GetDict(FX_BSTRC("XObject"));
- if (!pList)
+ CPDF_Object* pRes = NULL;
+ if (m_pResources == NULL) {
return;
- CPDF_Reference* pRes = ToReference(pList->GetElement(name));
- if (!pRes)
- return;
-
+ }
+ if (m_pResources == m_pPageResources) {
+ CPDF_Dictionary* pList = m_pResources->GetDict(FX_BSTRC("XObject"));
+ if (pList == NULL) {
+ return;
+ }
+ pRes = pList->GetElement(name);
+ if (pRes == NULL || pRes->GetType() != PDFOBJ_REFERENCE) {
+ return;
+ }
+ } else {
+ CPDF_Dictionary* pList = m_pResources->GetDict(FX_BSTRC("XObject"));
+ if (pList == NULL) {
+ if (m_pPageResources == NULL) {
+ return;
+ }
+ CPDF_Dictionary* pList = m_pPageResources->GetDict(FX_BSTRC("XObject"));
+ if (pList == NULL) {
+ return;
+ }
+ pRes = pList->GetElement(name);
+ if (pRes == NULL || pRes->GetType() != PDFOBJ_REFERENCE) {
+ return;
+ }
+ } else {
+ pRes = pList->GetElement(name);
+ if (pRes == NULL || pRes->GetType() != PDFOBJ_REFERENCE) {
+ return;
+ }
+ }
+ }
FX_BOOL bForm;
- if (m_pDocument->IsFormStream(pRes->GetRefObjNum(), bForm) && !bForm)
+ if (m_pDocument->IsFormStream(((CPDF_Reference*)pRes)->GetRefObjNum(),
+ bForm) &&
+ !bForm) {
return;
+ }
}
-
CPDF_Stream* pXObject = ToStream(FindResourceObj(FX_BSTRC("XObject"), name));
if (!pXObject) {
m_bResourceMissing = TRUE;