| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 } | 50 } |
| 51 } | 51 } |
| 52 CPDF_Image* CPDF_Image::Clone() | 52 CPDF_Image* CPDF_Image::Clone() |
| 53 { | 53 { |
| 54 if (m_pStream->GetObjNum()) { | 54 if (m_pStream->GetObjNum()) { |
| 55 return m_pDocument->GetPageData()->GetImage(m_pStream); | 55 return m_pDocument->GetPageData()->GetImage(m_pStream); |
| 56 } | 56 } |
| 57 CPDF_Image* pImage = new CPDF_Image(m_pDocument); | 57 CPDF_Image* pImage = new CPDF_Image(m_pDocument); |
| 58 pImage->LoadImageF((CPDF_Stream*)((CPDF_Object*)m_pStream)->Clone(), m_bInli
ne); | 58 pImage->LoadImageF((CPDF_Stream*)((CPDF_Object*)m_pStream)->Clone(), m_bInli
ne); |
| 59 if (m_bInline) { | 59 if (m_bInline) { |
| 60 CPDF_Dictionary *pInlineDict = (CPDF_Dictionary*)m_pInlineDict->Clone(TR
UE); | 60 CPDF_Dictionary *pInlineDict = (CPDF_Dictionary*)m_pInlineDict->Clone(tr
ue); |
| 61 pImage->SetInlineDict(pInlineDict); | 61 pImage->SetInlineDict(pInlineDict); |
| 62 } | 62 } |
| 63 return pImage; | 63 return pImage; |
| 64 } | 64 } |
| 65 CPDF_Image::CPDF_Image(CPDF_Document* pDoc) | 65 CPDF_Image::CPDF_Image(CPDF_Document* pDoc) |
| 66 { | 66 { |
| 67 m_pDocument = pDoc; | 67 m_pDocument = pDoc; |
| 68 m_pStream = NULL; | 68 m_pStream = NULL; |
| 69 m_pOC = NULL; | 69 m_pOC = NULL; |
| 70 m_bInline = FALSE; | 70 m_bInline = false; |
| 71 m_pInlineDict = NULL; | 71 m_pInlineDict = NULL; |
| 72 m_pDIBSource = NULL; | 72 m_pDIBSource = NULL; |
| 73 m_pMask = NULL; | 73 m_pMask = NULL; |
| 74 m_MatteColor = 0; | 74 m_MatteColor = 0; |
| 75 } | 75 } |
| 76 CPDF_Image::~CPDF_Image() | 76 CPDF_Image::~CPDF_Image() |
| 77 { | 77 { |
| 78 if (m_bInline) { | 78 if (m_bInline) { |
| 79 if (m_pStream) { | 79 if (m_pStream) { |
| 80 m_pStream->Release(); | 80 m_pStream->Release(); |
| 81 } | 81 } |
| 82 if (m_pInlineDict) { | 82 if (m_pInlineDict) { |
| 83 m_pInlineDict->Release(); | 83 m_pInlineDict->Release(); |
| 84 } | 84 } |
| 85 } | 85 } |
| 86 } | 86 } |
| 87 FX_BOOL CPDF_Image::LoadImageF(CPDF_Stream* pStream, FX_BOOL bInline) | 87 bool CPDF_Image::LoadImageF(CPDF_Stream* pStream, bool bInline) |
| 88 { | 88 { |
| 89 m_pStream = pStream; | 89 m_pStream = pStream; |
| 90 if (m_bInline && m_pInlineDict) { | 90 if (m_bInline && m_pInlineDict) { |
| 91 m_pInlineDict->Release(); | 91 m_pInlineDict->Release(); |
| 92 m_pInlineDict = NULL; | 92 m_pInlineDict = NULL; |
| 93 } | 93 } |
| 94 m_bInline = bInline; | 94 m_bInline = bInline; |
| 95 CPDF_Dictionary* pDict = pStream->GetDict(); | 95 CPDF_Dictionary* pDict = pStream->GetDict(); |
| 96 if (m_bInline) { | 96 if (m_bInline) { |
| 97 m_pInlineDict = (CPDF_Dictionary*)pDict->Clone(); | 97 m_pInlineDict = (CPDF_Dictionary*)pDict->Clone(); |
| 98 } | 98 } |
| 99 m_pOC = pDict->GetDict(FX_BSTRC("OC")); | 99 m_pOC = pDict->GetDict(FX_BSTRC("OC")); |
| 100 m_bIsMask = !pDict->KeyExist(FX_BSTRC("ColorSpace")) || pDict->GetInteger(FX
_BSTRC("ImageMask")); | 100 m_bIsMask = !pDict->KeyExist(FX_BSTRC("ColorSpace")) || pDict->GetInteger(FX
_BSTRC("ImageMask")); |
| 101 m_bInterpolate = pDict->GetInteger(FX_BSTRC("Interpolate")); | 101 m_bInterpolate = pDict->GetInteger(FX_BSTRC("Interpolate")); |
| 102 m_Height = pDict->GetInteger(FX_BSTRC("Height")); | 102 m_Height = pDict->GetInteger(FX_BSTRC("Height")); |
| 103 m_Width = pDict->GetInteger(FX_BSTRC("Width")); | 103 m_Width = pDict->GetInteger(FX_BSTRC("Width")); |
| 104 return TRUE; | 104 return true; |
| 105 } | 105 } |
| OLD | NEW |