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 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 m_dwFirstPageObjNum(0), | 418 m_dwFirstPageObjNum(0), |
419 m_pDocPage(new CPDF_DocPageData(this)), | 419 m_pDocPage(new CPDF_DocPageData(this)), |
420 m_pDocRender(new CPDF_DocRenderData(this)), | 420 m_pDocRender(new CPDF_DocRenderData(this)), |
421 m_pByteStringPool(pdfium::MakeUnique<CFX_ByteStringPool>()) { | 421 m_pByteStringPool(pdfium::MakeUnique<CFX_ByteStringPool>()) { |
422 if (pParser) | 422 if (pParser) |
423 SetLastObjNum(m_pParser->GetLastObjNum()); | 423 SetLastObjNum(m_pParser->GetLastObjNum()); |
424 } | 424 } |
425 | 425 |
426 CPDF_Document::~CPDF_Document() { | 426 CPDF_Document::~CPDF_Document() { |
427 delete m_pDocPage; | 427 delete m_pDocPage; |
428 CPDF_ModuleMgr::Get()->GetPageModule()->ClearStockFont(this); | 428 if (CPDF_ModuleMgr::Get()->GetPageModule()) { |
| 429 CPDF_ModuleMgr::Get()->GetPageModule()->ClearStockFont(this); |
| 430 } |
429 m_pByteStringPool.DeleteObject(); // Make weak. | 431 m_pByteStringPool.DeleteObject(); // Make weak. |
430 } | 432 } |
431 | 433 |
432 CPDF_Object* CPDF_Document::ParseIndirectObject(uint32_t objnum) { | 434 CPDF_Object* CPDF_Document::ParseIndirectObject(uint32_t objnum) { |
433 return m_pParser ? m_pParser->ParseIndirectObject(this, objnum) : nullptr; | 435 return m_pParser ? m_pParser->ParseIndirectObject(this, objnum) : nullptr; |
434 } | 436 } |
435 | 437 |
436 void CPDF_Document::LoadDocInternal() { | 438 void CPDF_Document::LoadDocInternal() { |
437 SetLastObjNum(m_pParser->GetLastObjNum()); | 439 SetLastObjNum(m_pParser->GetLastObjNum()); |
438 | 440 |
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1013 pBBox, pLogFont->lfWeight / 5); | 1015 pBBox, pLogFont->lfWeight / 5); |
1014 pFontDesc->SetIntegerFor("CapHeight", capheight); | 1016 pFontDesc->SetIntegerFor("CapHeight", capheight); |
1015 pFontDict->SetReferenceFor("FontDescriptor", this, | 1017 pFontDict->SetReferenceFor("FontDescriptor", this, |
1016 AddIndirectObject(pFontDesc)); | 1018 AddIndirectObject(pFontDesc)); |
1017 hFont = SelectObject(hDC, hFont); | 1019 hFont = SelectObject(hDC, hFont); |
1018 DeleteObject(hFont); | 1020 DeleteObject(hFont); |
1019 DeleteDC(hDC); | 1021 DeleteDC(hDC); |
1020 return LoadFont(pBaseDict); | 1022 return LoadFont(pBaseDict); |
1021 } | 1023 } |
1022 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 1024 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
OLD | NEW |