Chromium Code Reviews| 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" |
| (...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 656 left *= 2; | 656 left *= 2; |
| 657 bottom *= 2; | 657 bottom *= 2; |
| 658 Draw(x_scale, y_scale, left, bottom, C1.first_half(), m1f, D1.fi rst_half(), m2f); | 658 Draw(x_scale, y_scale, left, bottom, C1.first_half(), m1f, D1.fi rst_half(), m2f); |
| 659 Draw(x_scale, y_scale, left, bottom + 1, m1f, C2.first_half(), D 1.second_half(), m2s); | 659 Draw(x_scale, y_scale, left, bottom + 1, m1f, C2.first_half(), D 1.second_half(), m2s); |
| 660 Draw(x_scale, y_scale, left + 1, bottom, C1.second_half(), m1s, m2f, D2.first_half()); | 660 Draw(x_scale, y_scale, left + 1, bottom, C1.second_half(), m1s, m2f, D2.first_half()); |
| 661 Draw(x_scale, y_scale, left + 1, bottom + 1, m1s, C2.second_half (), m2s, D2.second_half()); | 661 Draw(x_scale, y_scale, left + 1, bottom + 1, m1s, C2.second_half (), m2s, D2.second_half()); |
| 662 } | 662 } |
| 663 } | 663 } |
| 664 } | 664 } |
| 665 }; | 665 }; |
| 666 | |
| 667 FX_BOOL _CheckCoonTensorPara(CPDF_MeshStream &stream) | |
|
Tom Sepez
2014/07/14 21:38:01
nit: static
Tom Sepez
2014/07/15 18:27:25
nit: const CPDF_MeshStream&
| |
| 668 { | |
| 669 FX_BOOL bCoorBits = ( stream.m_nCoordBits== 1 || | |
|
Tom Sepez
2014/07/14 21:38:01
nit: space before ==
| |
| 670 stream.m_nCoordBits == 2 || | |
| 671 stream.m_nCoordBits == 4 || | |
| 672 stream.m_nCoordBits == 8 || | |
| 673 stream.m_nCoordBits == 12 || | |
| 674 stream.m_nCoordBits == 16 || | |
| 675 stream.m_nCoordBits == 24 || | |
| 676 stream.m_nCoordBits == 32 ); | |
| 677 | |
| 678 FX_BOOL bCompBits = ( stream.m_nCompBits == 1 || | |
| 679 stream.m_nCompBits == 2 || | |
| 680 stream.m_nCompBits == 4 || | |
| 681 stream.m_nCompBits == 8 || | |
| 682 stream.m_nCompBits == 12 || | |
| 683 stream.m_nCompBits == 16 ); | |
| 684 | |
| 685 FX_BOOL bFlagBits = ( stream.m_nFlagBits == 2 || | |
| 686 stream.m_nFlagBits == 4 || | |
| 687 stream.m_nFlagBits == 8 ); | |
| 688 | |
| 689 return bCoorBits && bCompBits && bFlagBits; | |
| 690 } | |
| 691 | |
| 666 static void _DrawCoonPatchMeshes(FX_BOOL bTensor, CFX_DIBitmap* pBitmap, CFX_Aff ineMatrix* pObject2Bitmap, | 692 static void _DrawCoonPatchMeshes(FX_BOOL bTensor, CFX_DIBitmap* pBitmap, CFX_Aff ineMatrix* pObject2Bitmap, |
| 667 CPDF_Stream* pShadingStream, CPDF_Function** pF uncs, int nFuncs, | 693 CPDF_Stream* pShadingStream, CPDF_Function** pF uncs, int nFuncs, |
| 668 CPDF_ColorSpace* pCS, int fill_mode, int alpha) | 694 CPDF_ColorSpace* pCS, int fill_mode, int alpha) |
| 669 { | 695 { |
| 670 ASSERT(pBitmap->GetFormat() == FXDIB_Argb); | 696 ASSERT(pBitmap->GetFormat() == FXDIB_Argb); |
| 671 if (pShadingStream->GetType() != PDFOBJ_STREAM) { | 697 if (pShadingStream->GetType() != PDFOBJ_STREAM) { |
| 672 return; | 698 return; |
| 673 } | 699 } |
| 674 CFX_FxgeDevice device; | 700 CFX_FxgeDevice device; |
| 675 device.Attach(pBitmap); | 701 device.Attach(pBitmap); |
| 676 CPDF_MeshStream stream; | 702 CPDF_MeshStream stream; |
| 677 if (!stream.Load(pShadingStream, pFuncs, nFuncs, pCS)) { | 703 if (!stream.Load(pShadingStream, pFuncs, nFuncs, pCS)) { |
| 678 return; | 704 return; |
| 679 } | 705 } |
| 706 | |
| 707 if (!_CheckCoonTensorPara(stream)) | |
|
Tom Sepez
2014/07/14 21:38:01
nit: { } per other tests that just return in this
| |
| 708 return; | |
| 709 | |
| 680 CPDF_PatchDrawer patch; | 710 CPDF_PatchDrawer patch; |
| 681 patch.alpha = alpha; | 711 patch.alpha = alpha; |
| 682 patch.pDevice = &device; | 712 patch.pDevice = &device; |
| 683 patch.fill_mode = fill_mode; | 713 patch.fill_mode = fill_mode; |
| 684 patch.path.SetPointCount(13); | 714 patch.path.SetPointCount(13); |
| 685 FX_PATHPOINT* pPoints = patch.path.GetPoints(); | 715 FX_PATHPOINT* pPoints = patch.path.GetPoints(); |
| 686 pPoints[0].m_Flag = FXPT_MOVETO; | 716 pPoints[0].m_Flag = FXPT_MOVETO; |
| 687 for (int i = 1; i < 13; i ++) { | 717 for (int i = 1; i < 13; i ++) { |
| 688 pPoints[i].m_Flag = FXPT_BEZIERTO; | 718 pPoints[i].m_Flag = FXPT_BEZIERTO; |
| 689 } | 719 } |
| 690 CFX_FloatPoint coords[16]; | 720 CFX_FloatPoint coords[16]; |
| 721 for(FX_DWORD i = 0; i < 16; i++) | |
| 722 { | |
|
Tom Sepez
2014/07/15 18:35:45
nit: brace on previous line to match style.
| |
| 723 coords[i].x = 0.0; | |
| 724 coords[i].y = 0.0; | |
| 725 } | |
| 726 | |
| 691 int point_count = bTensor ? 16 : 12; | 727 int point_count = bTensor ? 16 : 12; |
| 692 while (!stream.m_BitStream.IsEOF()) { | 728 while (!stream.m_BitStream.IsEOF()) { |
| 693 FX_DWORD flag = stream.GetFlag(); | 729 FX_DWORD flag = stream.GetFlag(); |
| 694 int iStartPoint = 0, iStartColor = 0, i; | 730 int iStartPoint = 0, iStartColor = 0, i; |
| 695 if (flag) { | 731 if (flag) { |
| 696 iStartPoint = 4; | 732 iStartPoint = 4; |
| 697 iStartColor = 2; | 733 iStartColor = 2; |
| 698 CFX_FloatPoint tempCoords[4]; | 734 CFX_FloatPoint tempCoords[4]; |
| 699 for (int i = 0; i < 4; i ++) { | 735 for (int i = 0; i < 4; i ++) { |
|
Tom Sepez
2014/07/15 18:35:45
nit: this declaration of i shadows an outer one at
| |
| 700 tempCoords[i] = coords[(flag * 3 + i) % 12]; | 736 tempCoords[i] = coords[(flag * 3 + i) % 12]; |
| 701 } | 737 } |
| 702 FXSYS_memcpy32(coords, tempCoords, sizeof(CFX_FloatPoint) * 4); | 738 FXSYS_memcpy32(coords, tempCoords, sizeof(CFX_FloatPoint) * 4); |
| 703 Coon_Color tempColors[2]; | 739 Coon_Color tempColors[2]; |
| 704 tempColors[0] = patch.patch_colors[flag]; | 740 tempColors[0] = patch.patch_colors[flag]; |
| 705 tempColors[1] = patch.patch_colors[(flag + 1) % 4]; | 741 tempColors[1] = patch.patch_colors[(flag + 1) % 4]; |
| 706 FXSYS_memcpy32(patch.patch_colors, tempColors, sizeof(Coon_Color) * 2); | 742 FXSYS_memcpy32(patch.patch_colors, tempColors, sizeof(Coon_Color) * 2); |
| 707 } | 743 } |
| 708 for (i = iStartPoint; i < point_count; i ++) { | 744 for (i = iStartPoint; i < point_count; i ++) { |
| 709 stream.GetCoords(coords[i].x, coords[i].y); | 745 stream.GetCoords(coords[i].x, coords[i].y); |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1084 bStroke = FALSE; | 1120 bStroke = FALSE; |
| 1085 bPattern = TRUE; | 1121 bPattern = TRUE; |
| 1086 } | 1122 } |
| 1087 } | 1123 } |
| 1088 #ifdef _FPDFAPI_MINI_ | 1124 #ifdef _FPDFAPI_MINI_ |
| 1089 if (bPattern && m_DitherBits) { | 1125 if (bPattern && m_DitherBits) { |
| 1090 DitherObjectArea(pPathObj, pObj2Device); | 1126 DitherObjectArea(pPathObj, pObj2Device); |
| 1091 } | 1127 } |
| 1092 #endif | 1128 #endif |
| 1093 } | 1129 } |
| OLD | NEW |