Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(263)

Side by Side Diff: core/fpdfapi/render/fpdf_render_pattern.cpp

Issue 2477443002: Remove FX_BOOL from core (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « core/fpdfapi/render/fpdf_render_loadimage.cpp ('k') | core/fpdfapi/render/fpdf_render_text.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "core/fpdfapi/render/render_int.h" 7 #include "core/fpdfapi/render/render_int.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 FX_FLOAT start_y = pCoords->GetNumberAt(1); 54 FX_FLOAT start_y = pCoords->GetNumberAt(1);
55 FX_FLOAT end_x = pCoords->GetNumberAt(2); 55 FX_FLOAT end_x = pCoords->GetNumberAt(2);
56 FX_FLOAT end_y = pCoords->GetNumberAt(3); 56 FX_FLOAT end_y = pCoords->GetNumberAt(3);
57 FX_FLOAT t_min = 0; 57 FX_FLOAT t_min = 0;
58 FX_FLOAT t_max = 1.0f; 58 FX_FLOAT t_max = 1.0f;
59 CPDF_Array* pArray = pDict->GetArrayFor("Domain"); 59 CPDF_Array* pArray = pDict->GetArrayFor("Domain");
60 if (pArray) { 60 if (pArray) {
61 t_min = pArray->GetNumberAt(0); 61 t_min = pArray->GetNumberAt(0);
62 t_max = pArray->GetNumberAt(1); 62 t_max = pArray->GetNumberAt(1);
63 } 63 }
64 FX_BOOL bStartExtend = FALSE; 64 bool bStartExtend = false;
65 FX_BOOL bEndExtend = FALSE; 65 bool bEndExtend = false;
66 pArray = pDict->GetArrayFor("Extend"); 66 pArray = pDict->GetArrayFor("Extend");
67 if (pArray) { 67 if (pArray) {
68 bStartExtend = !!pArray->GetIntegerAt(0); 68 bStartExtend = !!pArray->GetIntegerAt(0);
69 bEndExtend = !!pArray->GetIntegerAt(1); 69 bEndExtend = !!pArray->GetIntegerAt(1);
70 } 70 }
71 int width = pBitmap->GetWidth(); 71 int width = pBitmap->GetWidth();
72 int height = pBitmap->GetHeight(); 72 int height = pBitmap->GetHeight();
73 FX_FLOAT x_span = end_x - start_x; 73 FX_FLOAT x_span = end_x - start_x;
74 FX_FLOAT y_span = end_y - start_y; 74 FX_FLOAT y_span = end_y - start_y;
75 FX_FLOAT axis_len_square = (x_span * x_span) + (y_span * y_span); 75 FX_FLOAT axis_len_square = (x_span * x_span) + (y_span * y_span);
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 FX_FLOAT end_r = pCoords->GetNumberAt(5); 141 FX_FLOAT end_r = pCoords->GetNumberAt(5);
142 CFX_Matrix matrix; 142 CFX_Matrix matrix;
143 matrix.SetReverse(*pObject2Bitmap); 143 matrix.SetReverse(*pObject2Bitmap);
144 FX_FLOAT t_min = 0; 144 FX_FLOAT t_min = 0;
145 FX_FLOAT t_max = 1.0f; 145 FX_FLOAT t_max = 1.0f;
146 CPDF_Array* pArray = pDict->GetArrayFor("Domain"); 146 CPDF_Array* pArray = pDict->GetArrayFor("Domain");
147 if (pArray) { 147 if (pArray) {
148 t_min = pArray->GetNumberAt(0); 148 t_min = pArray->GetNumberAt(0);
149 t_max = pArray->GetNumberAt(1); 149 t_max = pArray->GetNumberAt(1);
150 } 150 }
151 FX_BOOL bStartExtend = FALSE; 151 bool bStartExtend = false;
152 FX_BOOL bEndExtend = FALSE; 152 bool bEndExtend = false;
153 pArray = pDict->GetArrayFor("Extend"); 153 pArray = pDict->GetArrayFor("Extend");
154 if (pArray) { 154 if (pArray) {
155 bStartExtend = !!pArray->GetIntegerAt(0); 155 bStartExtend = !!pArray->GetIntegerAt(0);
156 bEndExtend = !!pArray->GetIntegerAt(1); 156 bEndExtend = !!pArray->GetIntegerAt(1);
157 } 157 }
158 uint32_t total_results = 158 uint32_t total_results =
159 std::max(CountOutputs(funcs), pCS->CountComponents()); 159 std::max(CountOutputs(funcs), pCS->CountComponents());
160 CFX_FixedBufGrow<FX_FLOAT, 16> result_array(total_results); 160 CFX_FixedBufGrow<FX_FLOAT, 16> result_array(total_results);
161 FX_FLOAT* pResults = result_array; 161 FX_FLOAT* pResults = result_array;
162 FXSYS_memset(pResults, 0, total_results * sizeof(FX_FLOAT)); 162 FXSYS_memset(pResults, 0, total_results * sizeof(FX_FLOAT));
(...skipping 13 matching lines...) Expand all
176 rgb_array[i] = 176 rgb_array[i] =
177 FXARGB_TODIB(FXARGB_MAKE(alpha, FXSYS_round(R * 255), 177 FXARGB_TODIB(FXARGB_MAKE(alpha, FXSYS_round(R * 255),
178 FXSYS_round(G * 255), FXSYS_round(B * 255))); 178 FXSYS_round(G * 255), FXSYS_round(B * 255)));
179 } 179 }
180 FX_FLOAT a = ((start_x - end_x) * (start_x - end_x)) + 180 FX_FLOAT a = ((start_x - end_x) * (start_x - end_x)) +
181 ((start_y - end_y) * (start_y - end_y)) - 181 ((start_y - end_y) * (start_y - end_y)) -
182 ((start_r - end_r) * (start_r - end_r)); 182 ((start_r - end_r) * (start_r - end_r));
183 int width = pBitmap->GetWidth(); 183 int width = pBitmap->GetWidth();
184 int height = pBitmap->GetHeight(); 184 int height = pBitmap->GetHeight();
185 int pitch = pBitmap->GetPitch(); 185 int pitch = pBitmap->GetPitch();
186 FX_BOOL bDecreasing = FALSE; 186 bool bDecreasing = false;
187 if (start_r > end_r) { 187 if (start_r > end_r) {
188 int length = (int)FXSYS_sqrt((((start_x - end_x) * (start_x - end_x)) + 188 int length = (int)FXSYS_sqrt((((start_x - end_x) * (start_x - end_x)) +
189 ((start_y - end_y) * (start_y - end_y)))); 189 ((start_y - end_y) * (start_y - end_y))));
190 if (length < start_r - end_r) { 190 if (length < start_r - end_r) {
191 bDecreasing = TRUE; 191 bDecreasing = true;
192 } 192 }
193 } 193 }
194 for (int row = 0; row < height; row++) { 194 for (int row = 0; row < height; row++) {
195 uint32_t* dib_buf = (uint32_t*)(pBitmap->GetBuffer() + row * pitch); 195 uint32_t* dib_buf = (uint32_t*)(pBitmap->GetBuffer() + row * pitch);
196 for (int column = 0; column < width; column++) { 196 for (int column = 0; column < width; column++) {
197 FX_FLOAT x = (FX_FLOAT)column, y = (FX_FLOAT)row; 197 FX_FLOAT x = (FX_FLOAT)column, y = (FX_FLOAT)row;
198 matrix.Transform(x, y); 198 matrix.Transform(x, y);
199 FX_FLOAT b = -2 * (((x - start_x) * (end_x - start_x)) + 199 FX_FLOAT b = -2 * (((x - start_x) * (end_x - start_x)) +
200 ((y - start_y) * (end_y - start_y)) + 200 ((y - start_y) * (end_y - start_y)) +
201 (start_r * (end_r - start_r))); 201 (start_r * (end_r - start_r)));
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 } 308 }
309 } 309 }
310 310
311 bool GetScanlineIntersect(int y, 311 bool GetScanlineIntersect(int y,
312 FX_FLOAT x1, 312 FX_FLOAT x1,
313 FX_FLOAT y1, 313 FX_FLOAT y1,
314 FX_FLOAT x2, 314 FX_FLOAT x2,
315 FX_FLOAT y2, 315 FX_FLOAT y2,
316 FX_FLOAT* x) { 316 FX_FLOAT* x) {
317 if (y1 == y2) 317 if (y1 == y2)
318 return FALSE; 318 return false;
319 319
320 if (y1 < y2) { 320 if (y1 < y2) {
321 if (y < y1 || y > y2) 321 if (y < y1 || y > y2)
322 return FALSE; 322 return false;
323 } else { 323 } else {
324 if (y < y2 || y > y1) 324 if (y < y2 || y > y1)
325 return FALSE; 325 return false;
326 } 326 }
327 *x = x1 + ((x2 - x1) * (y - y1) / (y2 - y1)); 327 *x = x1 + ((x2 - x1) * (y - y1) / (y2 - y1));
328 return TRUE; 328 return true;
329 } 329 }
330 330
331 void DrawGouraud(CFX_DIBitmap* pBitmap, 331 void DrawGouraud(CFX_DIBitmap* pBitmap,
332 int alpha, 332 int alpha,
333 CPDF_MeshVertex triangle[3]) { 333 CPDF_MeshVertex triangle[3]) {
334 FX_FLOAT min_y = triangle[0].y, max_y = triangle[0].y; 334 FX_FLOAT min_y = triangle[0].y, max_y = triangle[0].y;
335 for (int i = 1; i < 3; i++) { 335 for (int i = 1; i < 3; i++) {
336 if (min_y > triangle[i].y) { 336 if (min_y > triangle[i].y) {
337 min_y = triangle[i].y; 337 min_y = triangle[i].y;
338 } 338 }
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 int fill_mode; 643 int fill_mode;
644 int alpha; 644 int alpha;
645 void Draw(int x_scale, 645 void Draw(int x_scale,
646 int y_scale, 646 int y_scale,
647 int left, 647 int left,
648 int bottom, 648 int bottom,
649 Coon_Bezier C1, 649 Coon_Bezier C1,
650 Coon_Bezier C2, 650 Coon_Bezier C2,
651 Coon_Bezier D1, 651 Coon_Bezier D1,
652 Coon_Bezier D2) { 652 Coon_Bezier D2) {
653 FX_BOOL bSmall = C1.Distance() < 2 && C2.Distance() < 2 && 653 bool bSmall = C1.Distance() < 2 && C2.Distance() < 2 && D1.Distance() < 2 &&
654 D1.Distance() < 2 && D2.Distance() < 2; 654 D2.Distance() < 2;
655 Coon_Color div_colors[4]; 655 Coon_Color div_colors[4];
656 int d_bottom = 0; 656 int d_bottom = 0;
657 int d_left = 0; 657 int d_left = 0;
658 int d_top = 0; 658 int d_top = 0;
659 int d_right = 0; 659 int d_right = 0;
660 div_colors[0].BiInterpol(patch_colors, left, bottom, x_scale, y_scale); 660 div_colors[0].BiInterpol(patch_colors, left, bottom, x_scale, y_scale);
661 if (!bSmall) { 661 if (!bSmall) {
662 div_colors[1].BiInterpol(patch_colors, left, bottom + 1, x_scale, 662 div_colors[1].BiInterpol(patch_colors, left, bottom + 1, x_scale,
663 y_scale); 663 y_scale);
664 div_colors[2].BiInterpol(patch_colors, left + 1, bottom + 1, x_scale, 664 div_colors[2].BiInterpol(patch_colors, left + 1, bottom + 1, x_scale,
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
843 context.Render(&bitmap_device, &options, nullptr); 843 context.Render(&bitmap_device, &options, nullptr);
844 return pBitmap; 844 return pBitmap;
845 } 845 }
846 846
847 } // namespace 847 } // namespace
848 848
849 void CPDF_RenderStatus::DrawShading(CPDF_ShadingPattern* pPattern, 849 void CPDF_RenderStatus::DrawShading(CPDF_ShadingPattern* pPattern,
850 CFX_Matrix* pMatrix, 850 CFX_Matrix* pMatrix,
851 FX_RECT& clip_rect, 851 FX_RECT& clip_rect,
852 int alpha, 852 int alpha,
853 FX_BOOL bAlphaMode) { 853 bool bAlphaMode) {
854 const auto& funcs = pPattern->GetFuncs(); 854 const auto& funcs = pPattern->GetFuncs();
855 CPDF_Dictionary* pDict = pPattern->GetShadingObject()->GetDict(); 855 CPDF_Dictionary* pDict = pPattern->GetShadingObject()->GetDict();
856 CPDF_ColorSpace* pColorSpace = pPattern->GetCS(); 856 CPDF_ColorSpace* pColorSpace = pPattern->GetCS();
857 if (!pColorSpace) 857 if (!pColorSpace)
858 return; 858 return;
859 859
860 FX_ARGB background = 0; 860 FX_ARGB background = 0;
861 if (!pPattern->IsShadingObject() && pDict->KeyExist("Background")) { 861 if (!pPattern->IsShadingObject() && pDict->KeyExist("Background")) {
862 CPDF_Array* pBackColor = pDict->GetArrayFor("Background"); 862 CPDF_Array* pBackColor = pDict->GetArrayFor("Background");
863 if (pBackColor && 863 if (pBackColor &&
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
935 pBitmap->LoadChannel(FXDIB_Red, pBitmap, FXDIB_Alpha); 935 pBitmap->LoadChannel(FXDIB_Red, pBitmap, FXDIB_Alpha);
936 936
937 if (m_Options.m_ColorMode == RENDER_COLOR_GRAY) 937 if (m_Options.m_ColorMode == RENDER_COLOR_GRAY)
938 pBitmap->ConvertColorScale(m_Options.m_ForeColor, m_Options.m_BackColor); 938 pBitmap->ConvertColorScale(m_Options.m_ForeColor, m_Options.m_BackColor);
939 buffer.OutputToDevice(); 939 buffer.OutputToDevice();
940 } 940 }
941 941
942 void CPDF_RenderStatus::DrawShadingPattern(CPDF_ShadingPattern* pattern, 942 void CPDF_RenderStatus::DrawShadingPattern(CPDF_ShadingPattern* pattern,
943 const CPDF_PageObject* pPageObj, 943 const CPDF_PageObject* pPageObj,
944 const CFX_Matrix* pObj2Device, 944 const CFX_Matrix* pObj2Device,
945 FX_BOOL bStroke) { 945 bool bStroke) {
946 if (!pattern->Load()) 946 if (!pattern->Load())
947 return; 947 return;
948 948
949 m_pDevice->SaveState(); 949 m_pDevice->SaveState();
950 if (pPageObj->IsPath()) { 950 if (pPageObj->IsPath()) {
951 if (!SelectClipPath(pPageObj->AsPath(), pObj2Device, bStroke)) { 951 if (!SelectClipPath(pPageObj->AsPath(), pObj2Device, bStroke)) {
952 m_pDevice->RestoreState(false); 952 m_pDevice->RestoreState(false);
953 return; 953 return;
954 } 954 }
955 } else if (pPageObj->IsImage()) { 955 } else if (pPageObj->IsImage()) {
956 m_pDevice->SetClip_Rect(pPageObj->GetBBox(pObj2Device)); 956 m_pDevice->SetClip_Rect(pPageObj->GetBBox(pObj2Device));
957 } else { 957 } else {
958 return; 958 return;
959 } 959 }
960 FX_RECT rect; 960 FX_RECT rect;
961 if (GetObjectClippedRect(pPageObj, pObj2Device, FALSE, rect)) { 961 if (GetObjectClippedRect(pPageObj, pObj2Device, false, rect)) {
962 m_pDevice->RestoreState(false); 962 m_pDevice->RestoreState(false);
963 return; 963 return;
964 } 964 }
965 CFX_Matrix matrix = *pattern->pattern_to_form(); 965 CFX_Matrix matrix = *pattern->pattern_to_form();
966 matrix.Concat(*pObj2Device); 966 matrix.Concat(*pObj2Device);
967 GetScaledMatrix(matrix); 967 GetScaledMatrix(matrix);
968 int alpha = 968 int alpha =
969 FXSYS_round(255 * (bStroke ? pPageObj->m_GeneralState.GetStrokeAlpha() 969 FXSYS_round(255 * (bStroke ? pPageObj->m_GeneralState.GetStrokeAlpha()
970 : pPageObj->m_GeneralState.GetFillAlpha())); 970 : pPageObj->m_GeneralState.GetFillAlpha()));
971 DrawShading(pattern, &matrix, rect, alpha, 971 DrawShading(pattern, &matrix, rect, alpha,
(...skipping 12 matching lines...) Expand all
984 CFX_Matrix matrix = pShadingObj->m_Matrix; 984 CFX_Matrix matrix = pShadingObj->m_Matrix;
985 matrix.Concat(*pObj2Device); 985 matrix.Concat(*pObj2Device);
986 DrawShading(pShadingObj->m_pShading, &matrix, rect, 986 DrawShading(pShadingObj->m_pShading, &matrix, rect,
987 FXSYS_round(255 * pShadingObj->m_GeneralState.GetFillAlpha()), 987 FXSYS_round(255 * pShadingObj->m_GeneralState.GetFillAlpha()),
988 m_Options.m_ColorMode == RENDER_COLOR_ALPHA); 988 m_Options.m_ColorMode == RENDER_COLOR_ALPHA);
989 } 989 }
990 990
991 void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern, 991 void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern,
992 CPDF_PageObject* pPageObj, 992 CPDF_PageObject* pPageObj,
993 const CFX_Matrix* pObj2Device, 993 const CFX_Matrix* pObj2Device,
994 FX_BOOL bStroke) { 994 bool bStroke) {
995 if (!pPattern->Load()) { 995 if (!pPattern->Load()) {
996 return; 996 return;
997 } 997 }
998 m_pDevice->SaveState(); 998 m_pDevice->SaveState();
999 if (pPageObj->IsPath()) { 999 if (pPageObj->IsPath()) {
1000 if (!SelectClipPath(pPageObj->AsPath(), pObj2Device, bStroke)) { 1000 if (!SelectClipPath(pPageObj->AsPath(), pObj2Device, bStroke)) {
1001 m_pDevice->RestoreState(false); 1001 m_pDevice->RestoreState(false);
1002 return; 1002 return;
1003 } 1003 }
1004 } else if (pPageObj->IsImage()) { 1004 } else if (pPageObj->IsImage()) {
1005 m_pDevice->SetClip_Rect(pPageObj->GetBBox(pObj2Device)); 1005 m_pDevice->SetClip_Rect(pPageObj->GetBBox(pObj2Device));
1006 } else { 1006 } else {
1007 return; 1007 return;
1008 } 1008 }
1009 FX_RECT clip_box = m_pDevice->GetClipBox(); 1009 FX_RECT clip_box = m_pDevice->GetClipBox();
1010 if (clip_box.IsEmpty()) { 1010 if (clip_box.IsEmpty()) {
1011 m_pDevice->RestoreState(false); 1011 m_pDevice->RestoreState(false);
1012 return; 1012 return;
1013 } 1013 }
1014 CFX_Matrix dCTM = m_pDevice->GetCTM(); 1014 CFX_Matrix dCTM = m_pDevice->GetCTM();
1015 FX_FLOAT sa = FXSYS_fabs(dCTM.a); 1015 FX_FLOAT sa = FXSYS_fabs(dCTM.a);
1016 FX_FLOAT sd = FXSYS_fabs(dCTM.d); 1016 FX_FLOAT sd = FXSYS_fabs(dCTM.d);
1017 clip_box.right = clip_box.left + (int32_t)FXSYS_ceil(clip_box.Width() * sa); 1017 clip_box.right = clip_box.left + (int32_t)FXSYS_ceil(clip_box.Width() * sa);
1018 clip_box.bottom = clip_box.top + (int32_t)FXSYS_ceil(clip_box.Height() * sd); 1018 clip_box.bottom = clip_box.top + (int32_t)FXSYS_ceil(clip_box.Height() * sd);
1019 CFX_Matrix mtPattern2Device = *pPattern->pattern_to_form(); 1019 CFX_Matrix mtPattern2Device = *pPattern->pattern_to_form();
1020 mtPattern2Device.Concat(*pObj2Device); 1020 mtPattern2Device.Concat(*pObj2Device);
1021 GetScaledMatrix(mtPattern2Device); 1021 GetScaledMatrix(mtPattern2Device);
1022 FX_BOOL bAligned = FALSE; 1022 bool bAligned = false;
1023 if (pPattern->bbox().left == 0 && pPattern->bbox().bottom == 0 && 1023 if (pPattern->bbox().left == 0 && pPattern->bbox().bottom == 0 &&
1024 pPattern->bbox().right == pPattern->x_step() && 1024 pPattern->bbox().right == pPattern->x_step() &&
1025 pPattern->bbox().top == pPattern->y_step() && 1025 pPattern->bbox().top == pPattern->y_step() &&
1026 (mtPattern2Device.IsScaled() || mtPattern2Device.Is90Rotated())) { 1026 (mtPattern2Device.IsScaled() || mtPattern2Device.Is90Rotated())) {
1027 bAligned = TRUE; 1027 bAligned = true;
1028 } 1028 }
1029 CFX_FloatRect cell_bbox = pPattern->bbox(); 1029 CFX_FloatRect cell_bbox = pPattern->bbox();
1030 mtPattern2Device.TransformRect(cell_bbox); 1030 mtPattern2Device.TransformRect(cell_bbox);
1031 int width = (int)FXSYS_ceil(cell_bbox.Width()); 1031 int width = (int)FXSYS_ceil(cell_bbox.Width());
1032 int height = (int)FXSYS_ceil(cell_bbox.Height()); 1032 int height = (int)FXSYS_ceil(cell_bbox.Height());
1033 if (width == 0) { 1033 if (width == 0) {
1034 width = 1; 1034 width = 1;
1035 } 1035 }
1036 if (height == 0) { 1036 if (height == 0) {
1037 height = 1; 1037 height = 1;
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
1173 screen.CompositeBitmap(start_x, start_y, width, height, 1173 screen.CompositeBitmap(start_x, start_y, width, height,
1174 pPatternBitmap.get(), 0, 0); 1174 pPatternBitmap.get(), 0, 0);
1175 } else { 1175 } else {
1176 screen.CompositeMask(start_x, start_y, width, height, 1176 screen.CompositeMask(start_x, start_y, width, height,
1177 pPatternBitmap.get(), fill_argb, 0, 0); 1177 pPatternBitmap.get(), fill_argb, 0, 0);
1178 } 1178 }
1179 } 1179 }
1180 } 1180 }
1181 } 1181 }
1182 CompositeDIBitmap(&screen, clip_box.left, clip_box.top, 0, 255, 1182 CompositeDIBitmap(&screen, clip_box.left, clip_box.top, 0, 255,
1183 FXDIB_BLEND_NORMAL, FALSE); 1183 FXDIB_BLEND_NORMAL, false);
1184 m_pDevice->RestoreState(false); 1184 m_pDevice->RestoreState(false);
1185 } 1185 }
1186 1186
1187 void CPDF_RenderStatus::DrawPathWithPattern(CPDF_PathObject* pPathObj, 1187 void CPDF_RenderStatus::DrawPathWithPattern(CPDF_PathObject* pPathObj,
1188 const CFX_Matrix* pObj2Device, 1188 const CFX_Matrix* pObj2Device,
1189 const CPDF_Color* pColor, 1189 const CPDF_Color* pColor,
1190 FX_BOOL bStroke) { 1190 bool bStroke) {
1191 CPDF_Pattern* pattern = pColor->GetPattern(); 1191 CPDF_Pattern* pattern = pColor->GetPattern();
1192 if (!pattern) 1192 if (!pattern)
1193 return; 1193 return;
1194 1194
1195 if (CPDF_TilingPattern* pTilingPattern = pattern->AsTilingPattern()) 1195 if (CPDF_TilingPattern* pTilingPattern = pattern->AsTilingPattern())
1196 DrawTilingPattern(pTilingPattern, pPathObj, pObj2Device, bStroke); 1196 DrawTilingPattern(pTilingPattern, pPathObj, pObj2Device, bStroke);
1197 else if (CPDF_ShadingPattern* pShadingPattern = pattern->AsShadingPattern()) 1197 else if (CPDF_ShadingPattern* pShadingPattern = pattern->AsShadingPattern())
1198 DrawShadingPattern(pShadingPattern, pPathObj, pObj2Device, bStroke); 1198 DrawShadingPattern(pShadingPattern, pPathObj, pObj2Device, bStroke);
1199 } 1199 }
1200 1200
1201 void CPDF_RenderStatus::ProcessPathPattern(CPDF_PathObject* pPathObj, 1201 void CPDF_RenderStatus::ProcessPathPattern(CPDF_PathObject* pPathObj,
1202 const CFX_Matrix* pObj2Device, 1202 const CFX_Matrix* pObj2Device,
1203 int& filltype, 1203 int& filltype,
1204 FX_BOOL& bStroke) { 1204 bool& bStroke) {
1205 if (filltype) { 1205 if (filltype) {
1206 const CPDF_Color& FillColor = *pPathObj->m_ColorState.GetFillColor(); 1206 const CPDF_Color& FillColor = *pPathObj->m_ColorState.GetFillColor();
1207 if (FillColor.IsPattern()) { 1207 if (FillColor.IsPattern()) {
1208 DrawPathWithPattern(pPathObj, pObj2Device, &FillColor, FALSE); 1208 DrawPathWithPattern(pPathObj, pObj2Device, &FillColor, false);
1209 filltype = 0; 1209 filltype = 0;
1210 } 1210 }
1211 } 1211 }
1212 if (bStroke) { 1212 if (bStroke) {
1213 const CPDF_Color& StrokeColor = *pPathObj->m_ColorState.GetStrokeColor(); 1213 const CPDF_Color& StrokeColor = *pPathObj->m_ColorState.GetStrokeColor();
1214 if (StrokeColor.IsPattern()) { 1214 if (StrokeColor.IsPattern()) {
1215 DrawPathWithPattern(pPathObj, pObj2Device, &StrokeColor, TRUE); 1215 DrawPathWithPattern(pPathObj, pObj2Device, &StrokeColor, true);
1216 bStroke = FALSE; 1216 bStroke = false;
1217 } 1217 }
1218 } 1218 }
1219 } 1219 }
OLDNEW
« no previous file with comments | « core/fpdfapi/render/fpdf_render_loadimage.cpp ('k') | core/fpdfapi/render/fpdf_render_text.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698