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/parser/cpdf_document.h" | 7 #include "core/fpdfapi/parser/cpdf_document.h" |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <set> | 10 #include <set> |
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
627 m_pRootDict->SetReferenceFor("Pages", this, AddIndirectObject(pPages)); | 627 m_pRootDict->SetReferenceFor("Pages", this, AddIndirectObject(pPages)); |
628 m_pInfoDict = new CPDF_Dictionary(m_pByteStringPool); | 628 m_pInfoDict = new CPDF_Dictionary(m_pByteStringPool); |
629 AddIndirectObject(m_pInfoDict); | 629 AddIndirectObject(m_pInfoDict); |
630 } | 630 } |
631 | 631 |
632 CPDF_Dictionary* CPDF_Document::CreateNewPage(int iPage) { | 632 CPDF_Dictionary* CPDF_Document::CreateNewPage(int iPage) { |
633 CPDF_Dictionary* pDict = new CPDF_Dictionary(m_pByteStringPool); | 633 CPDF_Dictionary* pDict = new CPDF_Dictionary(m_pByteStringPool); |
634 pDict->SetNameFor("Type", "Page"); | 634 pDict->SetNameFor("Type", "Page"); |
635 uint32_t dwObjNum = AddIndirectObject(pDict); | 635 uint32_t dwObjNum = AddIndirectObject(pDict); |
636 if (!InsertNewPage(iPage, pDict)) { | 636 if (!InsertNewPage(iPage, pDict)) { |
637 ReleaseIndirectObject(dwObjNum); | 637 DeleteIndirectObject(dwObjNum); |
638 return nullptr; | 638 return nullptr; |
639 } | 639 } |
640 return pDict; | 640 return pDict; |
641 } | 641 } |
642 | 642 |
643 bool CPDF_Document::InsertDeletePDFPage(CPDF_Dictionary* pPages, | 643 bool CPDF_Document::InsertDeletePDFPage(CPDF_Dictionary* pPages, |
644 int nPagesToGo, | 644 int nPagesToGo, |
645 CPDF_Dictionary* pPageDict, | 645 CPDF_Dictionary* pPageDict, |
646 bool bInsert, | 646 bool bInsert, |
647 std::set<CPDF_Dictionary*>* pVisited) { | 647 std::set<CPDF_Dictionary*>* pVisited) { |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1009 pBBox, pLogFont->lfWeight / 5); | 1009 pBBox, pLogFont->lfWeight / 5); |
1010 pFontDesc->SetIntegerFor("CapHeight", capheight); | 1010 pFontDesc->SetIntegerFor("CapHeight", capheight); |
1011 pFontDict->SetReferenceFor("FontDescriptor", this, | 1011 pFontDict->SetReferenceFor("FontDescriptor", this, |
1012 AddIndirectObject(pFontDesc)); | 1012 AddIndirectObject(pFontDesc)); |
1013 hFont = SelectObject(hDC, hFont); | 1013 hFont = SelectObject(hDC, hFont); |
1014 DeleteObject(hFont); | 1014 DeleteObject(hFont); |
1015 DeleteDC(hDC); | 1015 DeleteDC(hDC); |
1016 return LoadFont(pBaseDict); | 1016 return LoadFont(pBaseDict); |
1017 } | 1017 } |
1018 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 1018 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
OLD | NEW |