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

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

Issue 1426713002: Make m_pShadingObj a CPDF_Stream instead of CPDF_Object. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 1 month 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 "pageint.h" 8 #include "pageint.h"
9 9
10 CPDF_Pattern::CPDF_Pattern(const CFX_AffineMatrix* pParentMatrix) 10 CPDF_Pattern::CPDF_Pattern(const CFX_AffineMatrix* pParentMatrix)
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 const CFX_AffineMatrix* parentMatrix) 64 const CFX_AffineMatrix* parentMatrix)
65 : CPDF_Pattern(parentMatrix) { 65 : CPDF_Pattern(parentMatrix) {
66 m_PatternType = PATTERN_SHADING; 66 m_PatternType = PATTERN_SHADING;
67 m_pPatternObj = bShading ? NULL : pPatternObj; 67 m_pPatternObj = bShading ? NULL : pPatternObj;
68 m_pDocument = pDoc; 68 m_pDocument = pDoc;
69 m_bShadingObj = bShading; 69 m_bShadingObj = bShading;
70 if (!bShading) { 70 if (!bShading) {
71 CPDF_Dictionary* pDict = m_pPatternObj->GetDict(); 71 CPDF_Dictionary* pDict = m_pPatternObj->GetDict();
72 ASSERT(pDict != NULL); 72 ASSERT(pDict != NULL);
73 m_Pattern2Form = pDict->GetMatrix(FX_BSTRC("Matrix")); 73 m_Pattern2Form = pDict->GetMatrix(FX_BSTRC("Matrix"));
74 m_pShadingObj = pDict->GetElementValue(FX_BSTRC("Shading")); 74 m_pShadingObj = ToStream(pDict->GetElementValue(FX_BSTRC("Shading")));
75 if (parentMatrix) { 75 if (parentMatrix) {
76 m_Pattern2Form.Concat(*parentMatrix); 76 m_Pattern2Form.Concat(*parentMatrix);
77 } 77 }
78 } else { 78 } else {
79 m_pShadingObj = pPatternObj; 79 m_pShadingObj = ToStream(pPatternObj);
80 } 80 }
81 m_ShadingType = 0; 81 m_ShadingType = 0;
82 m_pCS = NULL; 82 m_pCS = NULL;
83 m_nFuncs = 0; 83 m_nFuncs = 0;
84 for (int i = 0; i < 4; i++) { 84 for (int i = 0; i < 4; i++) {
85 m_pFunctions[i] = NULL; 85 m_pFunctions[i] = NULL;
86 } 86 }
87 m_pCountedCS = NULL; 87 m_pCountedCS = NULL;
88 } 88 }
89 CPDF_ShadingPattern::~CPDF_ShadingPattern() { 89 CPDF_ShadingPattern::~CPDF_ShadingPattern() {
(...skipping 12 matching lines...) Expand all
102 m_pCS = NULL; 102 m_pCS = NULL;
103 m_pCountedCS = NULL; 103 m_pCountedCS = NULL;
104 m_nFuncs = 0; 104 m_nFuncs = 0;
105 } 105 }
106 FX_BOOL CPDF_ShadingPattern::Load() { 106 FX_BOOL CPDF_ShadingPattern::Load() {
107 if (m_ShadingType != 0) { 107 if (m_ShadingType != 0) {
108 return TRUE; 108 return TRUE;
109 } 109 }
110 CPDF_Dictionary* pShadingDict = 110 CPDF_Dictionary* pShadingDict =
111 m_pShadingObj ? m_pShadingObj->GetDict() : NULL; 111 m_pShadingObj ? m_pShadingObj->GetDict() : NULL;
112 if (pShadingDict == NULL) { 112 if (pShadingDict == NULL) {
dsinclair 2015/10/26 19:58:02 We bail out here and fail to Load the shading patt
113 return FALSE; 113 return FALSE;
114 } 114 }
115 if (m_nFuncs) { 115 if (m_nFuncs) {
116 for (int i = 0; i < m_nFuncs; i++) 116 for (int i = 0; i < m_nFuncs; i++)
117 delete m_pFunctions[i]; 117 delete m_pFunctions[i];
118 m_nFuncs = 0; 118 m_nFuncs = 0;
119 } 119 }
120 CPDF_Object* pFunc = pShadingDict->GetElementValue(FX_BSTRC("Function")); 120 CPDF_Object* pFunc = pShadingDict->GetElementValue(FX_BSTRC("Function"));
121 if (pFunc) { 121 if (pFunc) {
122 if (CPDF_Array* pArray = pFunc->AsArray()) { 122 if (CPDF_Array* pArray = pFunc->AsArray()) {
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 } 287 }
288 } 288 }
289 stream.m_BitStream.SkipBits(stream.m_nComps * stream.m_nCompBits * 289 stream.m_BitStream.SkipBits(stream.m_nComps * stream.m_nCompBits *
290 color_count); 290 color_count);
291 if (bGouraud) 291 if (bGouraud)
292 stream.m_BitStream.ByteAlign(); 292 stream.m_BitStream.ByteAlign();
293 } 293 }
294 rect.Transform(pMatrix); 294 rect.Transform(pMatrix);
295 return rect; 295 return rect;
296 } 296 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698