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_page/pageint.h" | 7 #include "core/fpdfapi/fpdf_page/pageint.h" |
8 | 8 |
9 #include "core/fdrm/crypto/include/fx_crypt.h" | 9 #include "core/fdrm/crypto/include/fx_crypt.h" |
| 10 #include "core/fpdfapi/fpdf_font/cpdf_type1font.h" |
10 #include "core/fpdfapi/fpdf_font/font_int.h" | 11 #include "core/fpdfapi/fpdf_font/font_int.h" |
| 12 #include "core/fpdfapi/fpdf_page/cpdf_pattern.h" |
| 13 #include "core/fpdfapi/fpdf_page/cpdf_shadingpattern.h" |
| 14 #include "core/fpdfapi/fpdf_page/cpdf_tilingpattern.h" |
| 15 #include "core/fpdfapi/fpdf_page/include/cpdf_image.h" |
11 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" | 16 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" |
12 #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" | 17 #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" |
13 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" | 18 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" |
| 19 #include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h" |
14 #include "core/fpdfapi/include/cpdf_modulemgr.h" | 20 #include "core/fpdfapi/include/cpdf_modulemgr.h" |
15 #include "core/fpdfapi/ipdf_pagemodule.h" | 21 #include "core/fpdfapi/ipdf_pagemodule.h" |
16 | 22 |
17 namespace { | 23 namespace { |
18 | 24 |
19 class CPDF_PageModule : public IPDF_PageModule { | 25 class CPDF_PageModule : public IPDF_PageModule { |
20 public: | 26 public: |
21 CPDF_PageModule() | 27 CPDF_PageModule() |
22 : m_StockGrayCS(nullptr, PDFCS_DEVICEGRAY), | 28 : m_StockGrayCS(nullptr, PDFCS_DEVICEGRAY), |
23 m_StockRGBCS(nullptr, PDFCS_DEVICERGB), | 29 m_StockRGBCS(nullptr, PDFCS_DEVICERGB), |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 | 90 |
85 CPDF_Font* CPDF_Document::LoadFont(CPDF_Dictionary* pFontDict) { | 91 CPDF_Font* CPDF_Document::LoadFont(CPDF_Dictionary* pFontDict) { |
86 ASSERT(pFontDict); | 92 ASSERT(pFontDict); |
87 return GetValidatePageData()->GetFont(pFontDict, FALSE); | 93 return GetValidatePageData()->GetFont(pFontDict, FALSE); |
88 } | 94 } |
89 | 95 |
90 CPDF_StreamAcc* CPDF_Document::LoadFontFile(CPDF_Stream* pStream) { | 96 CPDF_StreamAcc* CPDF_Document::LoadFontFile(CPDF_Stream* pStream) { |
91 return GetValidatePageData()->GetFontFileStreamAcc(pStream); | 97 return GetValidatePageData()->GetFontFileStreamAcc(pStream); |
92 } | 98 } |
93 | 99 |
94 CPDF_ColorSpace* _CSFromName(const CFX_ByteString& name); | |
95 CPDF_ColorSpace* CPDF_Document::LoadColorSpace(CPDF_Object* pCSObj, | 100 CPDF_ColorSpace* CPDF_Document::LoadColorSpace(CPDF_Object* pCSObj, |
96 CPDF_Dictionary* pResources) { | 101 CPDF_Dictionary* pResources) { |
97 return GetValidatePageData()->GetColorSpace(pCSObj, pResources); | 102 return GetValidatePageData()->GetColorSpace(pCSObj, pResources); |
98 } | 103 } |
99 CPDF_Pattern* CPDF_Document::LoadPattern(CPDF_Object* pPatternObj, | 104 CPDF_Pattern* CPDF_Document::LoadPattern(CPDF_Object* pPatternObj, |
100 FX_BOOL bShading, | 105 FX_BOOL bShading, |
101 const CFX_Matrix* matrix) { | 106 const CFX_Matrix* matrix) { |
102 return GetValidatePageData()->GetPattern(pPatternObj, bShading, matrix); | 107 return GetValidatePageData()->GetPattern(pPatternObj, bShading, matrix); |
103 } | 108 } |
104 CPDF_IccProfile* CPDF_Document::LoadIccProfile(CPDF_Stream* pStream) { | 109 CPDF_IccProfile* CPDF_Document::LoadIccProfile(CPDF_Stream* pStream) { |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 } | 320 } |
316 | 321 |
317 CPDF_ColorSpace* CPDF_DocPageData::GetColorSpace( | 322 CPDF_ColorSpace* CPDF_DocPageData::GetColorSpace( |
318 CPDF_Object* pCSObj, | 323 CPDF_Object* pCSObj, |
319 const CPDF_Dictionary* pResources) { | 324 const CPDF_Dictionary* pResources) { |
320 if (!pCSObj) | 325 if (!pCSObj) |
321 return nullptr; | 326 return nullptr; |
322 | 327 |
323 if (pCSObj->IsName()) { | 328 if (pCSObj->IsName()) { |
324 CFX_ByteString name = pCSObj->GetConstString(); | 329 CFX_ByteString name = pCSObj->GetConstString(); |
325 CPDF_ColorSpace* pCS = _CSFromName(name); | 330 CPDF_ColorSpace* pCS = CPDF_ColorSpace::ColorspaceFromName(name); |
326 if (!pCS && pResources) { | 331 if (!pCS && pResources) { |
327 CPDF_Dictionary* pList = pResources->GetDictBy("ColorSpace"); | 332 CPDF_Dictionary* pList = pResources->GetDictBy("ColorSpace"); |
328 if (pList) { | 333 if (pList) { |
329 pCSObj = pList->GetElementValue(name); | 334 pCSObj = pList->GetElementValue(name); |
330 return GetColorSpace(pCSObj, nullptr); | 335 return GetColorSpace(pCSObj, nullptr); |
331 } | 336 } |
332 } | 337 } |
333 if (!pCS || !pResources) | 338 if (!pCS || !pResources) |
334 return pCS; | 339 return pCS; |
335 | 340 |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
605 } | 610 } |
606 | 611 |
607 CPDF_CountedPattern* CPDF_DocPageData::FindPatternPtr( | 612 CPDF_CountedPattern* CPDF_DocPageData::FindPatternPtr( |
608 CPDF_Object* pPatternObj) const { | 613 CPDF_Object* pPatternObj) const { |
609 if (!pPatternObj) | 614 if (!pPatternObj) |
610 return nullptr; | 615 return nullptr; |
611 | 616 |
612 auto it = m_PatternMap.find(pPatternObj); | 617 auto it = m_PatternMap.find(pPatternObj); |
613 return it != m_PatternMap.end() ? it->second : nullptr; | 618 return it != m_PatternMap.end() ? it->second : nullptr; |
614 } | 619 } |
OLD | NEW |