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 "../../../include/fpdfapi/fpdf_page.h" | 7 #include "../../../include/fpdfapi/fpdf_page.h" |
8 #include "../../../include/fpdfapi/fpdf_pageobj.h" | 8 #include "../../../include/fpdfapi/fpdf_pageobj.h" |
9 #include "pageint.h" | 9 #include "pageint.h" |
10 CPDF_ImageObject::CPDF_ImageObject() { | 10 CPDF_ImageObject::CPDF_ImageObject() { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 } | 45 } |
46 } | 46 } |
47 CPDF_Image* CPDF_Image::Clone() { | 47 CPDF_Image* CPDF_Image::Clone() { |
48 if (m_pStream->GetObjNum()) { | 48 if (m_pStream->GetObjNum()) { |
49 return m_pDocument->GetPageData()->GetImage(m_pStream); | 49 return m_pDocument->GetPageData()->GetImage(m_pStream); |
50 } | 50 } |
51 CPDF_Image* pImage = new CPDF_Image(m_pDocument); | 51 CPDF_Image* pImage = new CPDF_Image(m_pDocument); |
52 pImage->LoadImageF((CPDF_Stream*)((CPDF_Object*)m_pStream)->Clone(), | 52 pImage->LoadImageF((CPDF_Stream*)((CPDF_Object*)m_pStream)->Clone(), |
53 m_bInline); | 53 m_bInline); |
54 if (m_bInline) { | 54 if (m_bInline) { |
55 CPDF_Dictionary* pInlineDict = (CPDF_Dictionary*)m_pInlineDict->Clone(TRUE); | 55 pImage->SetInlineDict(ToDictionary(m_pInlineDict->Clone(TRUE))); |
56 pImage->SetInlineDict(pInlineDict); | |
57 } | 56 } |
58 return pImage; | 57 return pImage; |
59 } | 58 } |
60 CPDF_Image::CPDF_Image(CPDF_Document* pDoc) { | 59 CPDF_Image::CPDF_Image(CPDF_Document* pDoc) { |
61 m_pDocument = pDoc; | 60 m_pDocument = pDoc; |
62 m_pStream = NULL; | 61 m_pStream = NULL; |
63 m_pOC = NULL; | 62 m_pOC = NULL; |
64 m_bInline = FALSE; | 63 m_bInline = FALSE; |
65 m_pInlineDict = NULL; | 64 m_pInlineDict = NULL; |
66 m_pDIBSource = NULL; | 65 m_pDIBSource = NULL; |
(...skipping 12 matching lines...) Expand all Loading... |
79 } | 78 } |
80 FX_BOOL CPDF_Image::LoadImageF(CPDF_Stream* pStream, FX_BOOL bInline) { | 79 FX_BOOL CPDF_Image::LoadImageF(CPDF_Stream* pStream, FX_BOOL bInline) { |
81 m_pStream = pStream; | 80 m_pStream = pStream; |
82 if (m_bInline && m_pInlineDict) { | 81 if (m_bInline && m_pInlineDict) { |
83 m_pInlineDict->Release(); | 82 m_pInlineDict->Release(); |
84 m_pInlineDict = NULL; | 83 m_pInlineDict = NULL; |
85 } | 84 } |
86 m_bInline = bInline; | 85 m_bInline = bInline; |
87 CPDF_Dictionary* pDict = pStream->GetDict(); | 86 CPDF_Dictionary* pDict = pStream->GetDict(); |
88 if (m_bInline) { | 87 if (m_bInline) { |
89 m_pInlineDict = (CPDF_Dictionary*)pDict->Clone(); | 88 m_pInlineDict = ToDictionary(pDict->Clone()); |
90 } | 89 } |
91 m_pOC = pDict->GetDict(FX_BSTRC("OC")); | 90 m_pOC = pDict->GetDict(FX_BSTRC("OC")); |
92 m_bIsMask = !pDict->KeyExist(FX_BSTRC("ColorSpace")) || | 91 m_bIsMask = !pDict->KeyExist(FX_BSTRC("ColorSpace")) || |
93 pDict->GetInteger(FX_BSTRC("ImageMask")); | 92 pDict->GetInteger(FX_BSTRC("ImageMask")); |
94 m_bInterpolate = pDict->GetInteger(FX_BSTRC("Interpolate")); | 93 m_bInterpolate = pDict->GetInteger(FX_BSTRC("Interpolate")); |
95 m_Height = pDict->GetInteger(FX_BSTRC("Height")); | 94 m_Height = pDict->GetInteger(FX_BSTRC("Height")); |
96 m_Width = pDict->GetInteger(FX_BSTRC("Width")); | 95 m_Width = pDict->GetInteger(FX_BSTRC("Width")); |
97 return TRUE; | 96 return TRUE; |
98 } | 97 } |
OLD | NEW |