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_parser.h" | 7 #include "../../../include/fpdfapi/fpdf_parser.h" |
8 #include "../../../include/fpdfapi/fpdf_module.h" | 8 #include "../../../include/fpdfapi/fpdf_module.h" |
9 | 9 |
10 | 10 |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 } | 136 } |
137 } | 137 } |
138 return NULL; | 138 return NULL; |
139 } | 139 } |
140 | 140 |
141 CPDF_Dictionary* CPDF_Document::GetPage(int iPage) { | 141 CPDF_Dictionary* CPDF_Document::GetPage(int iPage) { |
142 if (iPage < 0 || iPage >= m_PageList.GetSize()) | 142 if (iPage < 0 || iPage >= m_PageList.GetSize()) |
143 return nullptr; | 143 return nullptr; |
144 | 144 |
145 if (m_bLinearized && (iPage == (int)m_dwFirstPageNo)) { | 145 if (m_bLinearized && (iPage == (int)m_dwFirstPageNo)) { |
146 CPDF_Object* pObj = GetIndirectObject(m_dwFirstPageObjNum); | 146 if (CPDF_Dictionary* pDict = |
147 if (pObj && pObj->GetType() == PDFOBJ_DICTIONARY) { | 147 ToDictionary(GetIndirectObject(m_dwFirstPageObjNum))) |
148 return static_cast<CPDF_Dictionary*>(pObj); | 148 return pDict; |
149 } | |
150 } | 149 } |
151 | 150 |
152 int objnum = m_PageList.GetAt(iPage); | 151 int objnum = m_PageList.GetAt(iPage); |
153 if (objnum) { | 152 if (objnum) { |
154 CPDF_Object* pObj = GetIndirectObject(objnum); | 153 if (CPDF_Dictionary* pDict = ToDictionary(GetIndirectObject(objnum))) |
155 if (pObj && pObj->GetType() == PDFOBJ_DICTIONARY) { | 154 return pDict; |
156 return static_cast<CPDF_Dictionary*>(pObj); | |
157 } | |
158 } | 155 } |
159 | 156 |
160 CPDF_Dictionary* pRoot = GetRoot(); | 157 CPDF_Dictionary* pRoot = GetRoot(); |
161 if (!pRoot) | 158 if (!pRoot) |
162 return nullptr; | 159 return nullptr; |
163 | 160 |
164 CPDF_Dictionary* pPages = pRoot->GetDict(FX_BSTRC("Pages")); | 161 CPDF_Dictionary* pPages = pRoot->GetDict(FX_BSTRC("Pages")); |
165 if (!pPages) | 162 if (!pPages) |
166 return nullptr; | 163 return nullptr; |
167 | 164 |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 void CPDF_Document::ClearPageData() { | 354 void CPDF_Document::ClearPageData() { |
358 if (m_pDocPage) { | 355 if (m_pDocPage) { |
359 CPDF_ModuleMgr::Get()->GetPageModule()->ClearDoc(this); | 356 CPDF_ModuleMgr::Get()->GetPageModule()->ClearDoc(this); |
360 } | 357 } |
361 } | 358 } |
362 void CPDF_Document::ClearRenderData() { | 359 void CPDF_Document::ClearRenderData() { |
363 if (m_pDocRender) { | 360 if (m_pDocRender) { |
364 CPDF_ModuleMgr::Get()->GetRenderModule()->ClearDocData(m_pDocRender); | 361 CPDF_ModuleMgr::Get()->GetRenderModule()->ClearDocData(m_pDocRender); |
365 } | 362 } |
366 } | 363 } |
OLD | NEW |