OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "../../../include/fpdfapi/fpdf_page.h" | 7 #include "../../../include/fpdfapi/fpdf_page.h" |
8 #include "../../../include/fpdfapi/fpdf_module.h" | 8 #include "../../../include/fpdfapi/fpdf_module.h" |
9 #include "pageint.h" | 9 #include "pageint.h" |
10 void CPDF_PageObject::Release() | 10 void CPDF_PageObject::Release() |
(...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
834 m_pDocument = (CPDF_Document*)pDocument; | 834 m_pDocument = (CPDF_Document*)pDocument; |
835 m_pFormDict = pPageDict; | 835 m_pFormDict = pPageDict; |
836 if (bPageCache) { | 836 if (bPageCache) { |
837 m_pPageRender = CPDF_ModuleMgr::Get()->GetRenderModule()->CreatePageCach
e(this); | 837 m_pPageRender = CPDF_ModuleMgr::Get()->GetRenderModule()->CreatePageCach
e(this); |
838 } | 838 } |
839 if (pPageDict == NULL) { | 839 if (pPageDict == NULL) { |
840 m_PageWidth = m_PageHeight = 100 * 1.0f; | 840 m_PageWidth = m_PageHeight = 100 * 1.0f; |
841 m_pPageResources = m_pResources = NULL; | 841 m_pPageResources = m_pResources = NULL; |
842 return; | 842 return; |
843 } | 843 } |
844 m_pResources = GetPageAttr(FX_BSTRC("Resources"))->GetDict(); | 844 CPDF_Object* pageAttr = GetPageAttr(FX_BSTRC("Resources")); |
| 845 m_pResources = pageAttr ? pageAttr->GetDict() : NULL; |
845 m_pPageResources = m_pResources; | 846 m_pPageResources = m_pResources; |
846 CPDF_Object* pRotate = GetPageAttr(FX_BSTRC("Rotate")); | 847 CPDF_Object* pRotate = GetPageAttr(FX_BSTRC("Rotate")); |
847 int rotate = 0; | 848 int rotate = 0; |
848 if (pRotate) { | 849 if (pRotate) { |
849 rotate = pRotate->GetInteger() / 90 % 4; | 850 rotate = pRotate->GetInteger() / 90 % 4; |
850 } | 851 } |
851 if (rotate < 0) { | 852 if (rotate < 0) { |
852 rotate += 4; | 853 rotate += 4; |
853 } | 854 } |
854 CPDF_Array* pMediaBox, *pCropBox; | 855 CPDF_Array* pMediaBox, *pCropBox; |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
939 } | 940 } |
940 } | 941 } |
941 CPDF_Object* CPDF_Page::GetPageAttr(FX_BSTR name) const | 942 CPDF_Object* CPDF_Page::GetPageAttr(FX_BSTR name) const |
942 { | 943 { |
943 return FPDFAPI_GetPageAttr(m_pFormDict, name); | 944 return FPDFAPI_GetPageAttr(m_pFormDict, name); |
944 } | 945 } |
945 CPDF_Form::CPDF_Form(CPDF_Document* pDoc, CPDF_Dictionary* pPageResources, CPDF_
Stream* pFormStream, CPDF_Dictionary* pParentResources) | 946 CPDF_Form::CPDF_Form(CPDF_Document* pDoc, CPDF_Dictionary* pPageResources, CPDF_
Stream* pFormStream, CPDF_Dictionary* pParentResources) |
946 { | 947 { |
947 m_pDocument = pDoc; | 948 m_pDocument = pDoc; |
948 m_pFormStream = pFormStream; | 949 m_pFormStream = pFormStream; |
949 m_pFormDict = pFormStream->GetDict(); | 950 m_pFormDict = pFormStream ? pFormStream->GetDict() : NULL; |
950 m_pResources = m_pFormDict->GetDict(FX_BSTRC("Resources")); | 951 m_pResources = m_pFormDict->GetDict(FX_BSTRC("Resources")); |
951 m_pPageResources = pPageResources; | 952 m_pPageResources = pPageResources; |
952 if (m_pResources == NULL) { | 953 if (m_pResources == NULL) { |
953 m_pResources = pParentResources; | 954 m_pResources = pParentResources; |
954 } | 955 } |
955 if (m_pResources == NULL) { | 956 if (m_pResources == NULL) { |
956 m_pResources = pPageResources; | 957 m_pResources = pPageResources; |
957 } | 958 } |
958 m_Transparency = 0; | 959 m_Transparency = 0; |
959 LoadTransInfo(); | 960 LoadTransInfo(); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1038 matrix = m_PageMatrix; | 1039 matrix = m_PageMatrix; |
1039 matrix.Concat(display_matrix); | 1040 matrix.Concat(display_matrix); |
1040 } | 1041 } |
1041 CPDF_ParseOptions::CPDF_ParseOptions() | 1042 CPDF_ParseOptions::CPDF_ParseOptions() |
1042 { | 1043 { |
1043 m_bTextOnly = FALSE; | 1044 m_bTextOnly = FALSE; |
1044 m_bMarkedContent = TRUE; | 1045 m_bMarkedContent = TRUE; |
1045 m_bSeparateForm = TRUE; | 1046 m_bSeparateForm = TRUE; |
1046 m_bDecodeInlineImage = FALSE; | 1047 m_bDecodeInlineImage = FALSE; |
1047 } | 1048 } |
OLD | NEW |