| 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_render.h" | 7 #include "../../../include/fpdfapi/fpdf_render.h" |
| 8 #include "../../../include/fpdfapi/fpdf_pageobj.h" | 8 #include "../../../include/fpdfapi/fpdf_pageobj.h" |
| 9 #include "../../../include/fxge/fx_ge.h" | 9 #include "../../../include/fxge/fx_ge.h" |
| 10 #include "../fpdf_page/pageint.h" | 10 #include "../fpdf_page/pageint.h" |
| 11 #include "render_int.h" | 11 #include "render_int.h" |
| 12 #define SHADING_STEPS 256 | 12 #define SHADING_STEPS 256 |
| 13 static void _DrawAxialShading(CFX_DIBitmap* pBitmap, | 13 static void DrawAxialShading(CFX_DIBitmap* pBitmap, |
| 14 CFX_AffineMatrix* pObject2Bitmap, | 14 CFX_AffineMatrix* pObject2Bitmap, |
| 15 CPDF_Dictionary* pDict, | 15 CPDF_Dictionary* pDict, |
| 16 CPDF_Function** pFuncs, | 16 CPDF_Function** pFuncs, |
| 17 int nFuncs, | 17 int nFuncs, |
| 18 CPDF_ColorSpace* pCS, | 18 CPDF_ColorSpace* pCS, |
| 19 int alpha) { | 19 int alpha) { |
| 20 ASSERT(pBitmap->GetFormat() == FXDIB_Argb); | 20 ASSERT(pBitmap->GetFormat() == FXDIB_Argb); |
| 21 CPDF_Array* pCoords = pDict->GetArray(FX_BSTRC("Coords")); | 21 CPDF_Array* pCoords = pDict->GetArray(FX_BSTRC("Coords")); |
| 22 if (pCoords == NULL) { | 22 if (pCoords == NULL) { |
| 23 return; | 23 return; |
| 24 } | 24 } |
| 25 FX_FLOAT start_x = pCoords->GetNumber(0); | 25 FX_FLOAT start_x = pCoords->GetNumber(0); |
| 26 FX_FLOAT start_y = pCoords->GetNumber(1); | 26 FX_FLOAT start_y = pCoords->GetNumber(1); |
| 27 FX_FLOAT end_x = pCoords->GetNumber(2); | 27 FX_FLOAT end_x = pCoords->GetNumber(2); |
| 28 FX_FLOAT end_y = pCoords->GetNumber(3); | 28 FX_FLOAT end_y = pCoords->GetNumber(3); |
| 29 FX_FLOAT t_min = 0, t_max = 1.0f; | 29 FX_FLOAT t_min = 0, t_max = 1.0f; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 } else if (index >= SHADING_STEPS) { | 94 } else if (index >= SHADING_STEPS) { |
| 95 if (!bEndExtend) { | 95 if (!bEndExtend) { |
| 96 continue; | 96 continue; |
| 97 } | 97 } |
| 98 index = SHADING_STEPS - 1; | 98 index = SHADING_STEPS - 1; |
| 99 } | 99 } |
| 100 dib_buf[column] = rgb_array[index]; | 100 dib_buf[column] = rgb_array[index]; |
| 101 } | 101 } |
| 102 } | 102 } |
| 103 } | 103 } |
| 104 static void _DrawRadialShading(CFX_DIBitmap* pBitmap, | 104 static void DrawRadialShading(CFX_DIBitmap* pBitmap, |
| 105 CFX_AffineMatrix* pObject2Bitmap, | 105 CFX_AffineMatrix* pObject2Bitmap, |
| 106 CPDF_Dictionary* pDict, | 106 CPDF_Dictionary* pDict, |
| 107 CPDF_Function** pFuncs, | 107 CPDF_Function** pFuncs, |
| 108 int nFuncs, | 108 int nFuncs, |
| 109 CPDF_ColorSpace* pCS, | 109 CPDF_ColorSpace* pCS, |
| 110 int alpha) { | 110 int alpha) { |
| 111 ASSERT(pBitmap->GetFormat() == FXDIB_Argb); | 111 ASSERT(pBitmap->GetFormat() == FXDIB_Argb); |
| 112 CPDF_Array* pCoords = pDict->GetArray(FX_BSTRC("Coords")); | 112 CPDF_Array* pCoords = pDict->GetArray(FX_BSTRC("Coords")); |
| 113 if (pCoords == NULL) { | 113 if (pCoords == NULL) { |
| 114 return; | 114 return; |
| 115 } | 115 } |
| 116 FX_FLOAT start_x = pCoords->GetNumber(0); | 116 FX_FLOAT start_x = pCoords->GetNumber(0); |
| 117 FX_FLOAT start_y = pCoords->GetNumber(1); | 117 FX_FLOAT start_y = pCoords->GetNumber(1); |
| 118 FX_FLOAT start_r = pCoords->GetNumber(2); | 118 FX_FLOAT start_r = pCoords->GetNumber(2); |
| 119 FX_FLOAT end_x = pCoords->GetNumber(3); | 119 FX_FLOAT end_x = pCoords->GetNumber(3); |
| 120 FX_FLOAT end_y = pCoords->GetNumber(4); | 120 FX_FLOAT end_y = pCoords->GetNumber(4); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 if (index >= SHADING_STEPS) { | 232 if (index >= SHADING_STEPS) { |
| 233 if (!bEndExtend) { | 233 if (!bEndExtend) { |
| 234 continue; | 234 continue; |
| 235 } | 235 } |
| 236 index = SHADING_STEPS - 1; | 236 index = SHADING_STEPS - 1; |
| 237 } | 237 } |
| 238 dib_buf[column] = rgb_array[index]; | 238 dib_buf[column] = rgb_array[index]; |
| 239 } | 239 } |
| 240 } | 240 } |
| 241 } | 241 } |
| 242 static void _DrawFuncShading(CFX_DIBitmap* pBitmap, | 242 static void DrawFuncShading(CFX_DIBitmap* pBitmap, |
| 243 CFX_AffineMatrix* pObject2Bitmap, | 243 CFX_AffineMatrix* pObject2Bitmap, |
| 244 CPDF_Dictionary* pDict, | 244 CPDF_Dictionary* pDict, |
| 245 CPDF_Function** pFuncs, | 245 CPDF_Function** pFuncs, |
| 246 int nFuncs, | 246 int nFuncs, |
| 247 CPDF_ColorSpace* pCS, | 247 CPDF_ColorSpace* pCS, |
| 248 int alpha) { | 248 int alpha) { |
| 249 ASSERT(pBitmap->GetFormat() == FXDIB_Argb); | 249 ASSERT(pBitmap->GetFormat() == FXDIB_Argb); |
| 250 CPDF_Array* pDomain = pDict->GetArray(FX_BSTRC("Domain")); | 250 CPDF_Array* pDomain = pDict->GetArray(FX_BSTRC("Domain")); |
| 251 FX_FLOAT xmin = 0, ymin = 0, xmax = 1.0f, ymax = 1.0f; | 251 FX_FLOAT xmin = 0, ymin = 0, xmax = 1.0f, ymax = 1.0f; |
| 252 if (pDomain) { | 252 if (pDomain) { |
| 253 xmin = pDomain->GetNumber(0); | 253 xmin = pDomain->GetNumber(0); |
| 254 xmax = pDomain->GetNumber(1); | 254 xmax = pDomain->GetNumber(1); |
| 255 ymin = pDomain->GetNumber(2); | 255 ymin = pDomain->GetNumber(2); |
| 256 ymax = pDomain->GetNumber(3); | 256 ymax = pDomain->GetNumber(3); |
| 257 } | 257 } |
| 258 CFX_AffineMatrix mtDomain2Target = pDict->GetMatrix(FX_BSTRC("Matrix")); | 258 CFX_AffineMatrix mtDomain2Target = pDict->GetMatrix(FX_BSTRC("Matrix")); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 return FALSE; | 316 return FALSE; |
| 317 } | 317 } |
| 318 } else { | 318 } else { |
| 319 if (y < y2 || y > y1) { | 319 if (y < y2 || y > y1) { |
| 320 return FALSE; | 320 return FALSE; |
| 321 } | 321 } |
| 322 } | 322 } |
| 323 x = x1 + FXSYS_MulDiv(x2 - x1, y - y1, y2 - y1); | 323 x = x1 + FXSYS_MulDiv(x2 - x1, y - y1, y2 - y1); |
| 324 return TRUE; | 324 return TRUE; |
| 325 } | 325 } |
| 326 static void _DrawGouraud(CFX_DIBitmap* pBitmap, | 326 static void DrawGouraud(CFX_DIBitmap* pBitmap, |
| 327 int alpha, | 327 int alpha, |
| 328 CPDF_MeshVertex triangle[3]) { | 328 CPDF_MeshVertex triangle[3]) { |
| 329 FX_FLOAT min_y = triangle[0].y, max_y = triangle[0].y; | 329 FX_FLOAT min_y = triangle[0].y, max_y = triangle[0].y; |
| 330 for (int i = 1; i < 3; i++) { | 330 for (int i = 1; i < 3; i++) { |
| 331 if (min_y > triangle[i].y) { | 331 if (min_y > triangle[i].y) { |
| 332 min_y = triangle[i].y; | 332 min_y = triangle[i].y; |
| 333 } | 333 } |
| 334 if (max_y < triangle[i].y) { | 334 if (max_y < triangle[i].y) { |
| 335 max_y = triangle[i].y; | 335 max_y = triangle[i].y; |
| 336 } | 336 } |
| 337 } | 337 } |
| 338 if (min_y == max_y) { | 338 if (min_y == max_y) { |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 R += r_unit; | 401 R += r_unit; |
| 402 G += g_unit; | 402 G += g_unit; |
| 403 B += b_unit; | 403 B += b_unit; |
| 404 FXARGB_SETDIB(dib_buf, | 404 FXARGB_SETDIB(dib_buf, |
| 405 FXARGB_MAKE(alpha, (int32_t)(R * 255), (int32_t)(G * 255), | 405 FXARGB_MAKE(alpha, (int32_t)(R * 255), (int32_t)(G * 255), |
| 406 (int32_t)(B * 255))); | 406 (int32_t)(B * 255))); |
| 407 dib_buf += 4; | 407 dib_buf += 4; |
| 408 } | 408 } |
| 409 } | 409 } |
| 410 } | 410 } |
| 411 static void _DrawFreeGouraudShading(CFX_DIBitmap* pBitmap, | 411 static void DrawFreeGouraudShading(CFX_DIBitmap* pBitmap, |
| 412 CFX_AffineMatrix* pObject2Bitmap, | 412 CFX_AffineMatrix* pObject2Bitmap, |
| 413 CPDF_Stream* pShadingStream, | 413 CPDF_Stream* pShadingStream, |
| 414 CPDF_Function** pFuncs, | 414 CPDF_Function** pFuncs, |
| 415 int nFuncs, | 415 int nFuncs, |
| 416 CPDF_ColorSpace* pCS, | 416 CPDF_ColorSpace* pCS, |
| 417 int alpha) { | 417 int alpha) { |
| 418 ASSERT(pBitmap->GetFormat() == FXDIB_Argb); | 418 ASSERT(pBitmap->GetFormat() == FXDIB_Argb); |
| 419 if (pShadingStream->GetType() != PDFOBJ_STREAM) { | 419 |
| 420 CPDF_MeshStream stream; |
| 421 if (!stream.Load(pShadingStream, pFuncs, nFuncs, pCS)) |
| 420 return; | 422 return; |
| 421 } | 423 |
| 422 CPDF_MeshStream stream; | |
| 423 if (!stream.Load(pShadingStream, pFuncs, nFuncs, pCS)) { | |
| 424 return; | |
| 425 } | |
| 426 CPDF_MeshVertex triangle[3]; | 424 CPDF_MeshVertex triangle[3]; |
| 427 FXSYS_memset(triangle, 0, sizeof(triangle)); | 425 FXSYS_memset(triangle, 0, sizeof(triangle)); |
| 428 | 426 |
| 429 while (!stream.m_BitStream.IsEOF()) { | 427 while (!stream.m_BitStream.IsEOF()) { |
| 430 CPDF_MeshVertex vertex; | 428 CPDF_MeshVertex vertex; |
| 431 FX_DWORD flag = stream.GetVertex(vertex, pObject2Bitmap); | 429 FX_DWORD flag = stream.GetVertex(vertex, pObject2Bitmap); |
| 432 if (flag == 0) { | 430 if (flag == 0) { |
| 433 triangle[0] = vertex; | 431 triangle[0] = vertex; |
| 434 for (int j = 1; j < 3; j++) { | 432 for (int j = 1; j < 3; j++) { |
| 435 stream.GetVertex(triangle[j], pObject2Bitmap); | 433 stream.GetVertex(triangle[j], pObject2Bitmap); |
| 436 } | 434 } |
| 437 } else { | 435 } else { |
| 438 if (flag == 1) { | 436 if (flag == 1) { |
| 439 triangle[0] = triangle[1]; | 437 triangle[0] = triangle[1]; |
| 440 } | 438 } |
| 441 triangle[1] = triangle[2]; | 439 triangle[1] = triangle[2]; |
| 442 triangle[2] = vertex; | 440 triangle[2] = vertex; |
| 443 } | 441 } |
| 444 _DrawGouraud(pBitmap, alpha, triangle); | 442 DrawGouraud(pBitmap, alpha, triangle); |
| 445 } | 443 } |
| 446 } | 444 } |
| 447 static void _DrawLatticeGouraudShading(CFX_DIBitmap* pBitmap, | 445 static void DrawLatticeGouraudShading(CFX_DIBitmap* pBitmap, |
| 448 CFX_AffineMatrix* pObject2Bitmap, | 446 CFX_AffineMatrix* pObject2Bitmap, |
| 449 CPDF_Stream* pShadingStream, | 447 CPDF_Stream* pShadingStream, |
| 450 CPDF_Function** pFuncs, | 448 CPDF_Function** pFuncs, |
| 451 int nFuncs, | 449 int nFuncs, |
| 452 CPDF_ColorSpace* pCS, | 450 CPDF_ColorSpace* pCS, |
| 453 int alpha) { | 451 int alpha) { |
| 454 ASSERT(pBitmap->GetFormat() == FXDIB_Argb); | 452 ASSERT(pBitmap->GetFormat() == FXDIB_Argb); |
| 455 if (pShadingStream->GetType() != PDFOBJ_STREAM) { | 453 |
| 454 int row_verts = pShadingStream->GetDict()->GetInteger("VerticesPerRow"); |
| 455 if (row_verts < 2) |
| 456 return; | 456 return; |
| 457 } | 457 |
| 458 int row_verts = pShadingStream->GetDict()->GetInteger("VerticesPerRow"); | 458 CPDF_MeshStream stream; |
| 459 if (row_verts < 2) { | 459 if (!stream.Load(pShadingStream, pFuncs, nFuncs, pCS)) |
| 460 return; | 460 return; |
| 461 } | 461 |
| 462 CPDF_MeshStream stream; | |
| 463 if (!stream.Load(pShadingStream, pFuncs, nFuncs, pCS)) { | |
| 464 return; | |
| 465 } | |
| 466 CPDF_MeshVertex* vertex = FX_Alloc2D(CPDF_MeshVertex, row_verts, 2); | 462 CPDF_MeshVertex* vertex = FX_Alloc2D(CPDF_MeshVertex, row_verts, 2); |
| 467 if (!stream.GetVertexRow(vertex, row_verts, pObject2Bitmap)) { | 463 if (!stream.GetVertexRow(vertex, row_verts, pObject2Bitmap)) { |
| 468 FX_Free(vertex); | 464 FX_Free(vertex); |
| 469 return; | 465 return; |
| 470 } | 466 } |
| 471 int last_index = 0; | 467 int last_index = 0; |
| 472 while (1) { | 468 while (1) { |
| 473 CPDF_MeshVertex* last_row = vertex + last_index * row_verts; | 469 CPDF_MeshVertex* last_row = vertex + last_index * row_verts; |
| 474 CPDF_MeshVertex* this_row = vertex + (1 - last_index) * row_verts; | 470 CPDF_MeshVertex* this_row = vertex + (1 - last_index) * row_verts; |
| 475 if (!stream.GetVertexRow(this_row, row_verts, pObject2Bitmap)) { | 471 if (!stream.GetVertexRow(this_row, row_verts, pObject2Bitmap)) { |
| 476 FX_Free(vertex); | 472 FX_Free(vertex); |
| 477 return; | 473 return; |
| 478 } | 474 } |
| 479 CPDF_MeshVertex triangle[3]; | 475 CPDF_MeshVertex triangle[3]; |
| 480 for (int i = 1; i < row_verts; i++) { | 476 for (int i = 1; i < row_verts; i++) { |
| 481 triangle[0] = last_row[i]; | 477 triangle[0] = last_row[i]; |
| 482 triangle[1] = this_row[i - 1]; | 478 triangle[1] = this_row[i - 1]; |
| 483 triangle[2] = last_row[i - 1]; | 479 triangle[2] = last_row[i - 1]; |
| 484 _DrawGouraud(pBitmap, alpha, triangle); | 480 DrawGouraud(pBitmap, alpha, triangle); |
| 485 triangle[2] = this_row[i]; | 481 triangle[2] = this_row[i]; |
| 486 _DrawGouraud(pBitmap, alpha, triangle); | 482 DrawGouraud(pBitmap, alpha, triangle); |
| 487 } | 483 } |
| 488 last_index = 1 - last_index; | 484 last_index = 1 - last_index; |
| 489 } | 485 } |
| 490 FX_Free(vertex); | 486 FX_Free(vertex); |
| 491 } | 487 } |
| 492 struct Coon_BezierCoeff { | 488 struct Coon_BezierCoeff { |
| 493 float a, b, c, d; | 489 float a, b, c, d; |
| 494 void FromPoints(float p0, float p1, float p2, float p3) { | 490 void FromPoints(float p0, float p1, float p2, float p3) { |
| 495 a = -p0 + 3 * p1 - 3 * p2 + p3; | 491 a = -p0 + 3 * p1 - 3 * p2 + p3; |
| 496 b = 3 * p0 - 6 * p1 + 3 * p2; | 492 b = 3 * p0 - 6 * p1 + 3 * p2; |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 741 FX_BOOL bCompBits = (stream.m_nCompBits == 1 || stream.m_nCompBits == 2 || | 737 FX_BOOL bCompBits = (stream.m_nCompBits == 1 || stream.m_nCompBits == 2 || |
| 742 stream.m_nCompBits == 4 || stream.m_nCompBits == 8 || | 738 stream.m_nCompBits == 4 || stream.m_nCompBits == 8 || |
| 743 stream.m_nCompBits == 12 || stream.m_nCompBits == 16); | 739 stream.m_nCompBits == 12 || stream.m_nCompBits == 16); |
| 744 | 740 |
| 745 FX_BOOL bFlagBits = (stream.m_nFlagBits == 2 || stream.m_nFlagBits == 4 || | 741 FX_BOOL bFlagBits = (stream.m_nFlagBits == 2 || stream.m_nFlagBits == 4 || |
| 746 stream.m_nFlagBits == 8); | 742 stream.m_nFlagBits == 8); |
| 747 | 743 |
| 748 return bCoorBits && bCompBits && bFlagBits; | 744 return bCoorBits && bCompBits && bFlagBits; |
| 749 } | 745 } |
| 750 | 746 |
| 751 static void _DrawCoonPatchMeshes(FX_BOOL bTensor, | 747 static void DrawCoonPatchMeshes(FX_BOOL bTensor, |
| 752 CFX_DIBitmap* pBitmap, | 748 CFX_DIBitmap* pBitmap, |
| 753 CFX_AffineMatrix* pObject2Bitmap, | 749 CFX_AffineMatrix* pObject2Bitmap, |
| 754 CPDF_Stream* pShadingStream, | 750 CPDF_Stream* pShadingStream, |
| 755 CPDF_Function** pFuncs, | 751 CPDF_Function** pFuncs, |
| 756 int nFuncs, | 752 int nFuncs, |
| 757 CPDF_ColorSpace* pCS, | 753 CPDF_ColorSpace* pCS, |
| 758 int fill_mode, | 754 int fill_mode, |
| 759 int alpha) { | 755 int alpha) { |
| 760 ASSERT(pBitmap->GetFormat() == FXDIB_Argb); | 756 ASSERT(pBitmap->GetFormat() == FXDIB_Argb); |
| 761 if (pShadingStream->GetType() != PDFOBJ_STREAM) { | 757 |
| 762 return; | |
| 763 } | |
| 764 CFX_FxgeDevice device; | 758 CFX_FxgeDevice device; |
| 765 device.Attach(pBitmap); | 759 device.Attach(pBitmap); |
| 766 CPDF_MeshStream stream; | 760 CPDF_MeshStream stream; |
| 767 if (!stream.Load(pShadingStream, pFuncs, nFuncs, pCS)) { | 761 if (!stream.Load(pShadingStream, pFuncs, nFuncs, pCS)) |
| 768 return; | 762 return; |
| 769 } | 763 if (!_CheckCoonTensorPara(stream)) |
| 770 | |
| 771 if (!_CheckCoonTensorPara(stream)) { | |
| 772 return; | 764 return; |
| 773 } | |
| 774 | 765 |
| 775 CPDF_PatchDrawer patch; | 766 CPDF_PatchDrawer patch; |
| 776 patch.alpha = alpha; | 767 patch.alpha = alpha; |
| 777 patch.pDevice = &device; | 768 patch.pDevice = &device; |
| 778 patch.fill_mode = fill_mode; | 769 patch.fill_mode = fill_mode; |
| 779 patch.path.SetPointCount(13); | 770 patch.path.SetPointCount(13); |
| 780 FX_PATHPOINT* pPoints = patch.path.GetPoints(); | 771 FX_PATHPOINT* pPoints = patch.path.GetPoints(); |
| 781 pPoints[0].m_Flag = FXPT_MOVETO; | 772 pPoints[0].m_Flag = FXPT_MOVETO; |
| 782 for (int i = 1; i < 13; i++) { | 773 for (int i = 1; i < 13; i++) { |
| 783 pPoints[i].m_Flag = FXPT_BEZIERTO; | 774 pPoints[i].m_Flag = FXPT_BEZIERTO; |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 871 CFX_AffineMatrix FinalMatrix = *pMatrix; | 862 CFX_AffineMatrix FinalMatrix = *pMatrix; |
| 872 FinalMatrix.Concat(*buffer.GetMatrix()); | 863 FinalMatrix.Concat(*buffer.GetMatrix()); |
| 873 CFX_DIBitmap* pBitmap = buffer.GetBitmap(); | 864 CFX_DIBitmap* pBitmap = buffer.GetBitmap(); |
| 874 if (pBitmap->GetBuffer() == NULL) { | 865 if (pBitmap->GetBuffer() == NULL) { |
| 875 return; | 866 return; |
| 876 } | 867 } |
| 877 pBitmap->Clear(background); | 868 pBitmap->Clear(background); |
| 878 int fill_mode = m_Options.m_Flags; | 869 int fill_mode = m_Options.m_Flags; |
| 879 switch (pPattern->m_ShadingType) { | 870 switch (pPattern->m_ShadingType) { |
| 880 case 1: | 871 case 1: |
| 881 _DrawFuncShading(pBitmap, &FinalMatrix, pDict, pFuncs, nFuncs, | 872 DrawFuncShading(pBitmap, &FinalMatrix, pDict, pFuncs, nFuncs, pColorSpace, |
| 873 alpha); |
| 874 break; |
| 875 case 2: |
| 876 DrawAxialShading(pBitmap, &FinalMatrix, pDict, pFuncs, nFuncs, |
| 882 pColorSpace, alpha); | 877 pColorSpace, alpha); |
| 883 break; | 878 break; |
| 884 case 2: | 879 case 3: |
| 885 _DrawAxialShading(pBitmap, &FinalMatrix, pDict, pFuncs, nFuncs, | 880 DrawRadialShading(pBitmap, &FinalMatrix, pDict, pFuncs, nFuncs, |
| 886 pColorSpace, alpha); | 881 pColorSpace, alpha); |
| 887 break; | 882 break; |
| 888 case 3: | |
| 889 _DrawRadialShading(pBitmap, &FinalMatrix, pDict, pFuncs, nFuncs, | |
| 890 pColorSpace, alpha); | |
| 891 break; | |
| 892 case 4: { | 883 case 4: { |
| 893 _DrawFreeGouraudShading(pBitmap, &FinalMatrix, | 884 DrawFreeGouraudShading(pBitmap, &FinalMatrix, |
| 894 (CPDF_Stream*)pPattern->m_pShadingObj, pFuncs, | 885 ToStream(pPattern->m_pShadingObj), pFuncs, nFuncs, |
| 895 nFuncs, pColorSpace, alpha); | 886 pColorSpace, alpha); |
| 896 } break; | 887 } break; |
| 897 case 5: { | 888 case 5: { |
| 898 _DrawLatticeGouraudShading(pBitmap, &FinalMatrix, | 889 DrawLatticeGouraudShading(pBitmap, &FinalMatrix, |
| 899 (CPDF_Stream*)pPattern->m_pShadingObj, pFuncs, | 890 ToStream(pPattern->m_pShadingObj), pFuncs, |
| 900 nFuncs, pColorSpace, alpha); | 891 nFuncs, pColorSpace, alpha); |
| 901 } break; | 892 } break; |
| 902 case 6: | 893 case 6: |
| 903 case 7: { | 894 case 7: { |
| 904 _DrawCoonPatchMeshes(pPattern->m_ShadingType - 6, pBitmap, &FinalMatrix, | 895 DrawCoonPatchMeshes(pPattern->m_ShadingType - 6, pBitmap, &FinalMatrix, |
| 905 (CPDF_Stream*)pPattern->m_pShadingObj, pFuncs, | 896 ToStream(pPattern->m_pShadingObj), pFuncs, nFuncs, |
| 906 nFuncs, pColorSpace, fill_mode, alpha); | 897 pColorSpace, fill_mode, alpha); |
| 907 } break; | 898 } break; |
| 908 } | 899 } |
| 909 if (bAlphaMode) { | 900 if (bAlphaMode) { |
| 910 pBitmap->LoadChannel(FXDIB_Red, pBitmap, FXDIB_Alpha); | 901 pBitmap->LoadChannel(FXDIB_Red, pBitmap, FXDIB_Alpha); |
| 911 } | 902 } |
| 912 if (m_Options.m_ColorMode == RENDER_COLOR_GRAY) { | 903 if (m_Options.m_ColorMode == RENDER_COLOR_GRAY) { |
| 913 pBitmap->ConvertColorScale(m_Options.m_ForeColor, m_Options.m_BackColor); | 904 pBitmap->ConvertColorScale(m_Options.m_ForeColor, m_Options.m_BackColor); |
| 914 } | 905 } |
| 915 buffer.OutputToDevice(); | 906 buffer.OutputToDevice(); |
| 916 } | 907 } |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1212 } | 1203 } |
| 1213 } | 1204 } |
| 1214 if (bStroke) { | 1205 if (bStroke) { |
| 1215 CPDF_Color& StrokeColor = *pPathObj->m_ColorState.GetStrokeColor(); | 1206 CPDF_Color& StrokeColor = *pPathObj->m_ColorState.GetStrokeColor(); |
| 1216 if (StrokeColor.m_pCS && StrokeColor.m_pCS->GetFamily() == PDFCS_PATTERN) { | 1207 if (StrokeColor.m_pCS && StrokeColor.m_pCS->GetFamily() == PDFCS_PATTERN) { |
| 1217 DrawPathWithPattern(pPathObj, pObj2Device, &StrokeColor, TRUE); | 1208 DrawPathWithPattern(pPathObj, pObj2Device, &StrokeColor, TRUE); |
| 1218 bStroke = FALSE; | 1209 bStroke = FALSE; |
| 1219 } | 1210 } |
| 1220 } | 1211 } |
| 1221 } | 1212 } |
| OLD | NEW |