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