| 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 #include "../../../include/fpdfapi/fpdf_page.h" | 9 #include "../../../include/fpdfapi/fpdf_page.h" |
| 10 #include "../../../../third_party/numerics/safe_math.h" | 10 #include "../../../../third_party/numerics/safe_math.h" |
| (...skipping 4163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4174 FX_BOOL CPDF_DataAvail::HaveResourceAncestor(CPDF_Dictionary *pDict) | 4174 FX_BOOL CPDF_DataAvail::HaveResourceAncestor(CPDF_Dictionary *pDict) |
| 4175 { | 4175 { |
| 4176 CPDF_Object *pParent = pDict->GetElement("Parent"); | 4176 CPDF_Object *pParent = pDict->GetElement("Parent"); |
| 4177 if (!pParent) { | 4177 if (!pParent) { |
| 4178 return FALSE; | 4178 return FALSE; |
| 4179 } | 4179 } |
| 4180 CPDF_Dictionary *pParentDict = pParent->GetDict(); | 4180 CPDF_Dictionary *pParentDict = pParent->GetDict(); |
| 4181 if (!pParentDict) { | 4181 if (!pParentDict) { |
| 4182 return FALSE; | 4182 return FALSE; |
| 4183 } | 4183 } |
| 4184 CPDF_Object *pRet = pParentDict->GetElement("Resource"); | 4184 CPDF_Object *pRet = pParentDict->GetElement("Resources"); |
| 4185 if (pRet) { | 4185 if (pRet) { |
| 4186 m_pPageResource = pRet; | 4186 m_pPageResource = pRet; |
| 4187 return TRUE; | 4187 return TRUE; |
| 4188 } else { | 4188 } else { |
| 4189 return HaveResourceAncestor(pParentDict); | 4189 return HaveResourceAncestor(pParentDict); |
| 4190 } | 4190 } |
| 4191 } | 4191 } |
| 4192 FX_BOOL CPDF_DataAvail::IsPageAvail(FX_INT32 iPage, IFX_DownloadHints* pHints) | 4192 FX_BOOL CPDF_DataAvail::IsPageAvail(FX_INT32 iPage, IFX_DownloadHints* pHints) |
| 4193 { | 4193 { |
| 4194 if (!m_pDocument) { | 4194 if (!m_pDocument) { |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4280 } | 4280 } |
| 4281 if (m_bPageLoadedOK) { | 4281 if (m_bPageLoadedOK) { |
| 4282 if (!m_bAnnotsLoad) { | 4282 if (!m_bAnnotsLoad) { |
| 4283 if (!CheckPageAnnots(iPage, pHints)) { | 4283 if (!CheckPageAnnots(iPage, pHints)) { |
| 4284 return FALSE; | 4284 return FALSE; |
| 4285 } | 4285 } |
| 4286 m_bAnnotsLoad = TRUE; | 4286 m_bAnnotsLoad = TRUE; |
| 4287 } | 4287 } |
| 4288 } | 4288 } |
| 4289 if (m_pPageDict && !m_bNeedDownLoadResource) { | 4289 if (m_pPageDict && !m_bNeedDownLoadResource) { |
| 4290 CPDF_Object *pRes = m_pPageDict->GetElement("Resource"); | 4290 m_pPageResource = m_pPageDict->GetElement("Resources"); |
| 4291 if (!pRes) { | 4291 if (!m_pPageResource) { |
| 4292 m_bNeedDownLoadResource = HaveResourceAncestor(m_pPageDict); | 4292 m_bNeedDownLoadResource = HaveResourceAncestor(m_pPageDict); |
| 4293 } else { |
| 4294 m_bNeedDownLoadResource = TRUE; |
| 4293 } | 4295 } |
| 4294 m_bNeedDownLoadResource = FALSE; | |
| 4295 } | 4296 } |
| 4296 if (m_bNeedDownLoadResource) { | 4297 if (m_bNeedDownLoadResource) { |
| 4297 FX_BOOL bRet = CheckResources(pHints); | 4298 FX_BOOL bRet = CheckResources(pHints); |
| 4298 if (!bRet) { | 4299 if (!bRet) { |
| 4299 return FALSE; | 4300 return FALSE; |
| 4300 } | 4301 } |
| 4301 m_bNeedDownLoadResource = FALSE; | 4302 m_bNeedDownLoadResource = FALSE; |
| 4302 } | 4303 } |
| 4303 m_bPageLoadedOK = FALSE; | 4304 m_bPageLoadedOK = FALSE; |
| 4304 m_bAnnotsLoad = FALSE; | 4305 m_bAnnotsLoad = FALSE; |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4405 { | 4406 { |
| 4406 FX_INT32 iSize = m_childNode.GetSize(); | 4407 FX_INT32 iSize = m_childNode.GetSize(); |
| 4407 for (FX_INT32 i = 0; i < iSize; ++i) { | 4408 for (FX_INT32 i = 0; i < iSize; ++i) { |
| 4408 CPDF_PageNode *pNode = (CPDF_PageNode*)m_childNode[i]; | 4409 CPDF_PageNode *pNode = (CPDF_PageNode*)m_childNode[i]; |
| 4409 if (pNode) { | 4410 if (pNode) { |
| 4410 delete pNode; | 4411 delete pNode; |
| 4411 } | 4412 } |
| 4412 } | 4413 } |
| 4413 m_childNode.RemoveAll(); | 4414 m_childNode.RemoveAll(); |
| 4414 } | 4415 } |
| OLD | NEW |