| 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 "core/fpdfapi/fpdf_parser/include/cpdf_document.h" | 7 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 return; | 108 return; |
| 109 } | 109 } |
| 110 pIndirectObj = GetIndirectObject(m_pParser->GetInfoObjNum()); | 110 pIndirectObj = GetIndirectObject(m_pParser->GetInfoObjNum()); |
| 111 m_pInfoDict = pIndirectObj ? pIndirectObj->GetDict() : nullptr; | 111 m_pInfoDict = pIndirectObj ? pIndirectObj->GetDict() : nullptr; |
| 112 CPDF_Array* pIDArray = m_pParser->GetIDArray(); | 112 CPDF_Array* pIDArray = m_pParser->GetIDArray(); |
| 113 if (pIDArray) { | 113 if (pIDArray) { |
| 114 m_ID1 = pIDArray->GetStringAt(0); | 114 m_ID1 = pIDArray->GetStringAt(0); |
| 115 m_ID2 = pIDArray->GetStringAt(1); | 115 m_ID2 = pIDArray->GetStringAt(1); |
| 116 } | 116 } |
| 117 uint32_t dwPageCount = 0; | 117 uint32_t dwPageCount = 0; |
| 118 CPDF_Object* pCount = pLinearized->GetElement("N"); | 118 CPDF_Object* pCount = pLinearized->GetObjectBy("N"); |
| 119 if (ToNumber(pCount)) | 119 if (ToNumber(pCount)) |
| 120 dwPageCount = pCount->GetInteger(); | 120 dwPageCount = pCount->GetInteger(); |
| 121 | 121 |
| 122 m_PageList.SetSize(dwPageCount); | 122 m_PageList.SetSize(dwPageCount); |
| 123 CPDF_Object* pNo = pLinearized->GetElement("P"); | 123 CPDF_Object* pNo = pLinearized->GetObjectBy("P"); |
| 124 if (ToNumber(pNo)) | 124 if (ToNumber(pNo)) |
| 125 m_dwFirstPageNo = pNo->GetInteger(); | 125 m_dwFirstPageNo = pNo->GetInteger(); |
| 126 | 126 |
| 127 CPDF_Object* pObjNum = pLinearized->GetElement("O"); | 127 CPDF_Object* pObjNum = pLinearized->GetObjectBy("O"); |
| 128 if (ToNumber(pObjNum)) | 128 if (ToNumber(pObjNum)) |
| 129 m_dwFirstPageObjNum = pObjNum->GetInteger(); | 129 m_dwFirstPageObjNum = pObjNum->GetInteger(); |
| 130 } | 130 } |
| 131 void CPDF_Document::LoadPages() { | 131 void CPDF_Document::LoadPages() { |
| 132 m_PageList.SetSize(RetrievePageCount()); | 132 m_PageList.SetSize(RetrievePageCount()); |
| 133 } | 133 } |
| 134 CPDF_Document::~CPDF_Document() { | 134 CPDF_Document::~CPDF_Document() { |
| 135 if (m_pDocPage) { | 135 if (m_pDocPage) { |
| 136 CPDF_ModuleMgr::Get()->GetPageModule()->ReleaseDoc(this); | 136 CPDF_ModuleMgr::Get()->GetPageModule()->ReleaseDoc(this); |
| 137 CPDF_ModuleMgr::Get()->GetPageModule()->ClearStockFont(this); | 137 CPDF_ModuleMgr::Get()->GetPageModule()->ClearStockFont(this); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 return -1; | 229 return -1; |
| 230 } | 230 } |
| 231 uint32_t count = pNode->GetIntegerBy("Count"); | 231 uint32_t count = pNode->GetIntegerBy("Count"); |
| 232 if (count <= skip_count) { | 232 if (count <= skip_count) { |
| 233 skip_count -= count; | 233 skip_count -= count; |
| 234 index += count; | 234 index += count; |
| 235 return -1; | 235 return -1; |
| 236 } | 236 } |
| 237 if (count && count == pKidList->GetCount()) { | 237 if (count && count == pKidList->GetCount()) { |
| 238 for (uint32_t i = 0; i < count; i++) { | 238 for (uint32_t i = 0; i < count; i++) { |
| 239 if (CPDF_Reference* pKid = ToReference(pKidList->GetElement(i))) { | 239 if (CPDF_Reference* pKid = ToReference(pKidList->GetObjectAt(i))) { |
| 240 if (pKid->GetRefObjNum() == objnum) { | 240 if (pKid->GetRefObjNum() == objnum) { |
| 241 m_PageList.SetAt(index + i, objnum); | 241 m_PageList.SetAt(index + i, objnum); |
| 242 return index + i; | 242 return index + i; |
| 243 } | 243 } |
| 244 } | 244 } |
| 245 } | 245 } |
| 246 } | 246 } |
| 247 for (uint32_t i = 0; i < pKidList->GetCount(); i++) { | 247 for (uint32_t i = 0; i < pKidList->GetCount(); i++) { |
| 248 CPDF_Dictionary* pKid = pKidList->GetDictAt(i); | 248 CPDF_Dictionary* pKid = pKidList->GetDictAt(i); |
| 249 if (!pKid) { | 249 if (!pKid) { |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 } | 347 } |
| 348 | 348 |
| 349 void CPDF_Document::ClearRenderFont() { | 349 void CPDF_Document::ClearRenderFont() { |
| 350 if (!m_pDocRender) | 350 if (!m_pDocRender) |
| 351 return; | 351 return; |
| 352 | 352 |
| 353 CFX_FontCache* pCache = m_pDocRender->GetFontCache(); | 353 CFX_FontCache* pCache = m_pDocRender->GetFontCache(); |
| 354 if (pCache) | 354 if (pCache) |
| 355 pCache->FreeCache(FALSE); | 355 pCache->FreeCache(FALSE); |
| 356 } | 356 } |
| OLD | NEW |