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 "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 Loading... |
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 Loading... |
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 } |
OLD | NEW |