Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(146)

Side by Side Diff: core/fpdfapi/fpdf_parser/cpdf_document.cpp

Issue 2275593002: IndirectObjectHolder API updates (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Missed one Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <memory> 9 #include <memory>
10 #include <set> 10 #include <set>
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 m_dwFirstPageObjNum(0), 492 m_dwFirstPageObjNum(0),
493 m_pDocPage(new CPDF_DocPageData(this)), 493 m_pDocPage(new CPDF_DocPageData(this)),
494 m_pDocRender(new CPDF_DocRenderData(this)) {} 494 m_pDocRender(new CPDF_DocRenderData(this)) {}
495 495
496 CPDF_Document::~CPDF_Document() { 496 CPDF_Document::~CPDF_Document() {
497 delete m_pDocPage; 497 delete m_pDocPage;
498 CPDF_ModuleMgr::Get()->GetPageModule()->ClearStockFont(this); 498 CPDF_ModuleMgr::Get()->GetPageModule()->ClearStockFont(this);
499 } 499 }
500 500
501 void CPDF_Document::LoadDocInternal() { 501 void CPDF_Document::LoadDocInternal() {
502 m_LastObjNum = m_pParser->GetLastObjNum(); 502 SetLastObjNum(m_pParser->GetLastObjNum());
503 503
504 CPDF_Object* pRootObj = GetIndirectObject(m_pParser->GetRootObjNum()); 504 CPDF_Object* pRootObj = GetOrParseIndirectObject(m_pParser->GetRootObjNum());
505 if (!pRootObj) 505 if (!pRootObj)
506 return; 506 return;
507 507
508 m_pRootDict = pRootObj->GetDict(); 508 m_pRootDict = pRootObj->GetDict();
509 if (!m_pRootDict) 509 if (!m_pRootDict)
510 return; 510 return;
511 511
512 CPDF_Object* pInfoObj = GetIndirectObject(m_pParser->GetInfoObjNum()); 512 CPDF_Object* pInfoObj = GetOrParseIndirectObject(m_pParser->GetInfoObjNum());
513 if (pInfoObj) 513 if (pInfoObj)
514 m_pInfoDict = pInfoObj->GetDict(); 514 m_pInfoDict = pInfoObj->GetDict();
515 if (CPDF_Array* pIDArray = m_pParser->GetIDArray()) { 515 if (CPDF_Array* pIDArray = m_pParser->GetIDArray()) {
516 m_ID1 = pIDArray->GetStringAt(0); 516 m_ID1 = pIDArray->GetStringAt(0);
517 m_ID2 = pIDArray->GetStringAt(1); 517 m_ID2 = pIDArray->GetStringAt(1);
518 } 518 }
519 } 519 }
520 520
521 void CPDF_Document::LoadDoc() { 521 void CPDF_Document::LoadDoc() {
522 LoadDocInternal(); 522 LoadDocInternal();
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 } 582 }
583 return nullptr; 583 return nullptr;
584 } 584 }
585 585
586 CPDF_Dictionary* CPDF_Document::GetPage(int iPage) { 586 CPDF_Dictionary* CPDF_Document::GetPage(int iPage) {
587 if (iPage < 0 || iPage >= m_PageList.GetSize()) 587 if (iPage < 0 || iPage >= m_PageList.GetSize())
588 return nullptr; 588 return nullptr;
589 589
590 if (m_bLinearized && (iPage == m_iFirstPageNo)) { 590 if (m_bLinearized && (iPage == m_iFirstPageNo)) {
591 if (CPDF_Dictionary* pDict = 591 if (CPDF_Dictionary* pDict =
592 ToDictionary(GetIndirectObject(m_dwFirstPageObjNum))) { 592 ToDictionary(GetOrParseIndirectObject(m_dwFirstPageObjNum))) {
593 return pDict; 593 return pDict;
594 } 594 }
595 } 595 }
596 596
597 int objnum = m_PageList.GetAt(iPage); 597 int objnum = m_PageList.GetAt(iPage);
598 if (objnum) { 598 if (objnum) {
599 if (CPDF_Dictionary* pDict = ToDictionary(GetIndirectObject(objnum))) 599 if (CPDF_Dictionary* pDict = ToDictionary(GetOrParseIndirectObject(objnum)))
600 return pDict; 600 return pDict;
601 } 601 }
602 602
603 CPDF_Dictionary* pRoot = GetRoot(); 603 CPDF_Dictionary* pRoot = GetRoot();
604 if (!pRoot) 604 if (!pRoot)
605 return nullptr; 605 return nullptr;
606 606
607 CPDF_Dictionary* pPages = pRoot->GetDictBy("Pages"); 607 CPDF_Dictionary* pPages = pRoot->GetDictBy("Pages");
608 if (!pPages) 608 if (!pPages)
609 return nullptr; 609 return nullptr;
(...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after
1443 } 1443 }
1444 } 1444 }
1445 pFontDesc->SetAtInteger("StemV", fStemV); 1445 pFontDesc->SetAtInteger("StemV", fStemV);
1446 AddIndirectObject(pFontDesc); 1446 AddIndirectObject(pFontDesc);
1447 pFontDict->SetAtReference("FontDescriptor", this, pFontDesc); 1447 pFontDict->SetAtReference("FontDescriptor", this, pFontDesc);
1448 CFRelease(traits); 1448 CFRelease(traits);
1449 CFRelease(languages); 1449 CFRelease(languages);
1450 return LoadFont(pBaseDict); 1450 return LoadFont(pBaseDict);
1451 } 1451 }
1452 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ 1452 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
OLDNEW
« no previous file with comments | « core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp ('k') | core/fpdfapi/fpdf_parser/cpdf_indirect_object_holder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698