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

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

Issue 1422253002: Merge to XFA: Type check the m_pShadingObj before assuming it's a stream. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
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
« no previous file with comments | « BUILD.gn ('k') | core/src/fpdfapi/fpdf_render/fpdf_render_pattern_embeddertest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 CPDF_Object* pCSObj = pShadingDict->GetElementValue(FX_BSTRC("ColorSpace")); 133 CPDF_Object* pCSObj = pShadingDict->GetElementValue(FX_BSTRC("ColorSpace"));
134 if (pCSObj == NULL) { 134 if (pCSObj == NULL) {
135 return FALSE; 135 return FALSE;
136 } 136 }
137 CPDF_DocPageData* pDocPageData = m_pDocument->GetPageData(); 137 CPDF_DocPageData* pDocPageData = m_pDocument->GetPageData();
138 m_pCS = pDocPageData->GetColorSpace(pCSObj, NULL); 138 m_pCS = pDocPageData->GetColorSpace(pCSObj, NULL);
139 if (m_pCS) { 139 if (m_pCS) {
140 m_pCountedCS = pDocPageData->FindColorSpacePtr(m_pCS->GetArray()); 140 m_pCountedCS = pDocPageData->FindColorSpacePtr(m_pCS->GetArray());
141 } 141 }
142 m_ShadingType = pShadingDict->GetInteger(FX_BSTRC("ShadingType")); 142 m_ShadingType = pShadingDict->GetInteger(FX_BSTRC("ShadingType"));
143
144 // We expect to have a stream if our shading type is a mesh.
145 if (m_ShadingType >= 4 && !ToStream(m_pShadingObj))
146 return FALSE;
147
143 return TRUE; 148 return TRUE;
144 } 149 }
145 FX_BOOL CPDF_ShadingPattern::Reload() { 150 FX_BOOL CPDF_ShadingPattern::Reload() {
146 Clear(); 151 Clear();
147 return Load(); 152 return Load();
148 } 153 }
149 FX_BOOL CPDF_MeshStream::Load(CPDF_Stream* pShadingStream, 154 FX_BOOL CPDF_MeshStream::Load(CPDF_Stream* pShadingStream,
150 CPDF_Function** pFuncs, 155 CPDF_Function** pFuncs,
151 int nFuncs, 156 int nFuncs,
152 CPDF_ColorSpace* pCS) { 157 CPDF_ColorSpace* pCS) {
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 } 292 }
288 } 293 }
289 stream.m_BitStream.SkipBits(stream.m_nComps * stream.m_nCompBits * 294 stream.m_BitStream.SkipBits(stream.m_nComps * stream.m_nCompBits *
290 color_count); 295 color_count);
291 if (bGouraud) 296 if (bGouraud)
292 stream.m_BitStream.ByteAlign(); 297 stream.m_BitStream.ByteAlign();
293 } 298 }
294 rect.Transform(pMatrix); 299 rect.Transform(pMatrix);
295 return rect; 300 return rect;
296 } 301 }
OLDNEW
« no previous file with comments | « BUILD.gn ('k') | core/src/fpdfapi/fpdf_render/fpdf_render_pattern_embeddertest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698