Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Side by Side Diff: core/src/fpdfapi/fpdf_page/fpdf_page_image.cpp

Issue 1410343003: [Merge to XFA] Revert "Revert "Add type cast definitions for CPDF_Dictionary."" (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Rebase to origin/xfa Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp ('k') | core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698