Chromium Code Reviews| 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 27 matching lines...) Expand all Loading... | |
| 38 m_Left = m_Bottom = 0; | 38 m_Left = m_Bottom = 0; |
| 39 m_Right = m_Top = 1.0f; | 39 m_Right = m_Top = 1.0f; |
| 40 m_Matrix.TransformRect(m_Left, m_Right, m_Top, m_Bottom); | 40 m_Matrix.TransformRect(m_Left, m_Right, m_Top, m_Bottom); |
| 41 } | 41 } |
| 42 void CPDF_Image::Release() { | 42 void CPDF_Image::Release() { |
| 43 if (m_bInline || (m_pStream && m_pStream->GetObjNum() == 0)) { | 43 if (m_bInline || (m_pStream && m_pStream->GetObjNum() == 0)) { |
| 44 delete this; | 44 delete this; |
| 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(ToStream(m_pStream->CPDF_Object::Clone()), m_bInline); |
|
dsinclair
2015/10/22 19:54:50
There is a Clone() override in CPDF_Stream which c
Tom Sepez
2015/10/22 20:44:44
On 2015/10/22 19:54:50, dsinclair wrote:
> There i
| |
| 53 m_bInline); | 53 if (m_bInline) |
| 54 if (m_bInline) { | |
| 55 pImage->SetInlineDict(ToDictionary(m_pInlineDict->Clone(TRUE))); | 54 pImage->SetInlineDict(ToDictionary(m_pInlineDict->Clone(TRUE))); |
| 56 } | 55 |
| 57 return pImage; | 56 return pImage; |
| 58 } | 57 } |
| 59 CPDF_Image::CPDF_Image(CPDF_Document* pDoc) { | 58 CPDF_Image::CPDF_Image(CPDF_Document* pDoc) { |
| 60 m_pDocument = pDoc; | 59 m_pDocument = pDoc; |
| 61 m_pStream = NULL; | 60 m_pStream = NULL; |
| 62 m_pOC = NULL; | 61 m_pOC = NULL; |
| 63 m_bInline = FALSE; | 62 m_bInline = FALSE; |
| 64 m_pInlineDict = NULL; | 63 m_pInlineDict = NULL; |
| 65 m_pDIBSource = NULL; | 64 m_pDIBSource = NULL; |
| 66 m_pMask = NULL; | 65 m_pMask = NULL; |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 88 m_pInlineDict = ToDictionary(pDict->Clone()); | 87 m_pInlineDict = ToDictionary(pDict->Clone()); |
| 89 } | 88 } |
| 90 m_pOC = pDict->GetDict(FX_BSTRC("OC")); | 89 m_pOC = pDict->GetDict(FX_BSTRC("OC")); |
| 91 m_bIsMask = !pDict->KeyExist(FX_BSTRC("ColorSpace")) || | 90 m_bIsMask = !pDict->KeyExist(FX_BSTRC("ColorSpace")) || |
| 92 pDict->GetInteger(FX_BSTRC("ImageMask")); | 91 pDict->GetInteger(FX_BSTRC("ImageMask")); |
| 93 m_bInterpolate = pDict->GetInteger(FX_BSTRC("Interpolate")); | 92 m_bInterpolate = pDict->GetInteger(FX_BSTRC("Interpolate")); |
| 94 m_Height = pDict->GetInteger(FX_BSTRC("Height")); | 93 m_Height = pDict->GetInteger(FX_BSTRC("Height")); |
| 95 m_Width = pDict->GetInteger(FX_BSTRC("Width")); | 94 m_Width = pDict->GetInteger(FX_BSTRC("Width")); |
| 96 return TRUE; | 95 return TRUE; |
| 97 } | 96 } |
| OLD | NEW |