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 ba0ca84ec4faca5af963ecd587aec0b27aa3056b..08b1227be1d230564cb6d69e23170cac33741669 100644 |
| --- a/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp |
| +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp |
| @@ -665,6 +665,32 @@ struct CPDF_PatchDrawer { |
| } |
| } |
| }; |
| + |
| +static FX_BOOL _CheckCoonTensorPara(CPDF_MeshStream& stream) |
|
Tom Sepez
2014/07/22 17:28:51
nit: const CPDF_MeshStream&
|
| +{ |
| + FX_BOOL bCoorBits = ( stream.m_nCoordBits == 1 || |
| + stream.m_nCoordBits == 2 || |
| + stream.m_nCoordBits == 4 || |
| + stream.m_nCoordBits == 8 || |
| + stream.m_nCoordBits == 12 || |
| + stream.m_nCoordBits == 16 || |
| + stream.m_nCoordBits == 24 || |
| + stream.m_nCoordBits == 32 ); |
| + |
| + FX_BOOL bCompBits = ( stream.m_nCompBits == 1 || |
| + stream.m_nCompBits == 2 || |
| + stream.m_nCompBits == 4 || |
| + stream.m_nCompBits == 8 || |
| + stream.m_nCompBits == 12 || |
| + stream.m_nCompBits == 16 ); |
| + |
| + FX_BOOL bFlagBits = ( stream.m_nFlagBits == 2 || |
| + stream.m_nFlagBits == 4 || |
| + stream.m_nFlagBits == 8 ); |
| + |
| + return bCoorBits && bCompBits && bFlagBits; |
| +} |
| + |
| static void _DrawCoonPatchMeshes(FX_BOOL bTensor, CFX_DIBitmap* pBitmap, CFX_AffineMatrix* pObject2Bitmap, |
| CPDF_Stream* pShadingStream, CPDF_Function** pFuncs, int nFuncs, |
| CPDF_ColorSpace* pCS, int fill_mode, int alpha) |
| @@ -679,6 +705,9 @@ static void _DrawCoonPatchMeshes(FX_BOOL bTensor, CFX_DIBitmap* pBitmap, CFX_Aff |
| if (!stream.Load(pShadingStream, pFuncs, nFuncs, pCS)) { |
| return; |
| } |
| + if (!_CheckCoonTensorPara(stream)){ |
|
Tom Sepez
2014/07/22 17:27:21
nit: space before { to match existing style in fil
|
| + return; |
| + } |
| CPDF_PatchDrawer patch; |
| patch.alpha = alpha; |
| patch.pDevice = &device; |
| @@ -690,20 +719,19 @@ static void _DrawCoonPatchMeshes(FX_BOOL bTensor, CFX_DIBitmap* pBitmap, CFX_Aff |
| pPoints[i].m_Flag = FXPT_BEZIERTO; |
| } |
| CFX_FloatPoint coords[16]; |
| - for (int i = 0; i < 16; i ++) |
| - { |
| + for (int i = 0; i < 16; i ++){ |
|
Tom Sepez
2014/07/22 17:27:21
nit: space before { to match existing style in fil
|
| coords[i].Set(0.0f, 0.0f); |
| } |
| int point_count = bTensor ? 16 : 12; |
| while (!stream.m_BitStream.IsEOF()) { |
| FX_DWORD flag = stream.GetFlag(); |
| - int iStartPoint = 0, iStartColor = 0, i; |
| + int iStartPoint = 0, iStartColor = 0, i = 0; |
|
Tom Sepez
2014/07/22 17:27:21
nit: initialized value isn't used. reset to 0 in
|
| if (flag) { |
| iStartPoint = 4; |
| iStartColor = 2; |
| CFX_FloatPoint tempCoords[4]; |
| - for (int i = 0; i < 4; i ++) { |
| + for (i = 0; i < 4; i ++) { |
| tempCoords[i] = coords[(flag * 3 + i) % 12]; |
| } |
| FXSYS_memcpy32(coords, tempCoords, sizeof(CFX_FloatPoint) * 4); |