Chromium Code Reviews| Index: core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp |
| diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp |
| index b64002c13ebdbf923ce8d230a96d7174e2b5347a..f86d1d856fd613311d331887d6032bf2c731dd7a 100644 |
| --- a/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp |
| +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp |
| @@ -416,13 +416,13 @@ static void _DrawFreeGouraudShading(CFX_DIBitmap* pBitmap, |
| CPDF_ColorSpace* pCS, |
| int alpha) { |
| ASSERT(pBitmap->GetFormat() == FXDIB_Argb); |
| - if (pShadingStream->GetType() != PDFOBJ_STREAM) { |
| + if (!pShadingStream->IsStream()) |
|
Tom Sepez
2015/10/22 17:16:45
Can a stream be not IsStream() ? Either this shou
dsinclair
2015/10/22 17:42:56
Done. Probably bad casts in the past.
|
| return; |
| - } |
| + |
| CPDF_MeshStream stream; |
| - if (!stream.Load(pShadingStream, pFuncs, nFuncs, pCS)) { |
| + if (!stream.Load(pShadingStream, pFuncs, nFuncs, pCS)) |
| return; |
| - } |
| + |
| CPDF_MeshVertex triangle[3]; |
| FXSYS_memset(triangle, 0, sizeof(triangle)); |
| @@ -452,17 +452,17 @@ static void _DrawLatticeGouraudShading(CFX_DIBitmap* pBitmap, |
| CPDF_ColorSpace* pCS, |
| int alpha) { |
| ASSERT(pBitmap->GetFormat() == FXDIB_Argb); |
| - if (pShadingStream->GetType() != PDFOBJ_STREAM) { |
| + if (!pShadingStream->IsStream()) |
|
Tom Sepez
2015/10/22 17:16:45
ditto
dsinclair
2015/10/22 17:42:56
Done.
|
| return; |
| - } |
| + |
| int row_verts = pShadingStream->GetDict()->GetInteger("VerticesPerRow"); |
| - if (row_verts < 2) { |
| + if (row_verts < 2) |
| return; |
| - } |
| + |
| CPDF_MeshStream stream; |
| - if (!stream.Load(pShadingStream, pFuncs, nFuncs, pCS)) { |
| + if (!stream.Load(pShadingStream, pFuncs, nFuncs, pCS)) |
| return; |
| - } |
| + |
| CPDF_MeshVertex* vertex = FX_Alloc2D(CPDF_MeshVertex, row_verts, 2); |
| if (!stream.GetVertexRow(vertex, row_verts, pObject2Bitmap)) { |
| FX_Free(vertex); |
| @@ -758,19 +758,16 @@ static void _DrawCoonPatchMeshes(FX_BOOL bTensor, |
| int fill_mode, |
| int alpha) { |
| ASSERT(pBitmap->GetFormat() == FXDIB_Argb); |
| - if (pShadingStream->GetType() != PDFOBJ_STREAM) { |
| + if (!pShadingStream->IsStream()) |
|
Tom Sepez
2015/10/22 17:16:45
ditto ditto
dsinclair
2015/10/22 17:42:56
Done.
|
| return; |
| - } |
| + |
| CFX_FxgeDevice device; |
| device.Attach(pBitmap); |
| CPDF_MeshStream stream; |
| - if (!stream.Load(pShadingStream, pFuncs, nFuncs, pCS)) { |
| + if (!stream.Load(pShadingStream, pFuncs, nFuncs, pCS)) |
| return; |
| - } |
| - |
| - if (!_CheckCoonTensorPara(stream)) { |
| + if (!_CheckCoonTensorPara(stream)) |
| return; |
| - } |
| CPDF_PatchDrawer patch; |
| patch.alpha = alpha; |
| @@ -891,19 +888,19 @@ void CPDF_RenderStatus::DrawShading(CPDF_ShadingPattern* pPattern, |
| break; |
| case 4: { |
| _DrawFreeGouraudShading(pBitmap, &FinalMatrix, |
| - (CPDF_Stream*)pPattern->m_pShadingObj, pFuncs, |
| - nFuncs, pColorSpace, alpha); |
| + ToStream(pPattern->m_pShadingObj), pFuncs, nFuncs, |
| + pColorSpace, alpha); |
| } break; |
| case 5: { |
| _DrawLatticeGouraudShading(pBitmap, &FinalMatrix, |
| - (CPDF_Stream*)pPattern->m_pShadingObj, pFuncs, |
| + ToStream(pPattern->m_pShadingObj), pFuncs, |
| nFuncs, pColorSpace, alpha); |
| } break; |
| case 6: |
| case 7: { |
| _DrawCoonPatchMeshes(pPattern->m_ShadingType - 6, pBitmap, &FinalMatrix, |
| - (CPDF_Stream*)pPattern->m_pShadingObj, pFuncs, |
| - nFuncs, pColorSpace, fill_mode, alpha); |
| + ToStream(pPattern->m_pShadingObj), pFuncs, nFuncs, |
| + pColorSpace, fill_mode, alpha); |
| } break; |
| } |
| if (bAlphaMode) { |