Index: core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp |
diff --git a/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp b/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp |
index 6ac380e43a3890f8a8d1e8ebad3b31bf709b4588..c235fd98cb0757d59caaa6a0811c2c7c172dd95e 100644 |
--- a/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp |
+++ b/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp |
@@ -889,21 +889,31 @@ void CPDF_RenderStatus::DrawShading(CPDF_ShadingPattern* pPattern, |
pColorSpace, alpha); |
break; |
case kFreeFormGouraudTriangleMeshShading: { |
- DrawFreeGouraudShading(pBitmap, &FinalMatrix, |
- ToStream(pPattern->m_pShadingObj), pFuncs, nFuncs, |
- pColorSpace, alpha); |
+ // The shading object can be a stream or a dictionary. We do not handle |
+ // the case of dictionary at the moment. |
+ if (CPDF_Stream* pStream = ToStream(pPattern->m_pShadingObj)) { |
+ DrawFreeGouraudShading(pBitmap, &FinalMatrix, pStream, pFuncs, nFuncs, |
+ pColorSpace, alpha); |
+ } |
} break; |
case kLatticeFormGouraudTriangleMeshShading: { |
- DrawLatticeGouraudShading(pBitmap, &FinalMatrix, |
- ToStream(pPattern->m_pShadingObj), pFuncs, |
- nFuncs, pColorSpace, alpha); |
+ // The shading object can be a stream or a dictionary. We do not handle |
+ // the case of dictionary at the moment. |
+ if (CPDF_Stream* pStream = ToStream(pPattern->m_pShadingObj)) { |
+ DrawLatticeGouraudShading(pBitmap, &FinalMatrix, pStream, pFuncs, |
+ nFuncs, pColorSpace, alpha); |
+ } |
} break; |
case kCoonsPatchMeshShading: |
case kTensorProductPatchMeshShading: { |
- DrawCoonPatchMeshes( |
- pPattern->m_ShadingType == kTensorProductPatchMeshShading, pBitmap, |
- &FinalMatrix, ToStream(pPattern->m_pShadingObj), pFuncs, nFuncs, |
- pColorSpace, fill_mode, alpha); |
+ // The shading object can be a stream or a dictionary. We do not handle |
+ // the case of dictionary at the moment. |
+ if (CPDF_Stream* pStream = ToStream(pPattern->m_pShadingObj)) { |
+ DrawCoonPatchMeshes( |
+ pPattern->m_ShadingType == kTensorProductPatchMeshShading, pBitmap, |
+ &FinalMatrix, pStream, pFuncs, nFuncs, pColorSpace, fill_mode, |
+ alpha); |
+ } |
} break; |
} |
if (bAlphaMode) { |