| 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 "fpdfsdk/pdfwindow/PWL_Utils.h" | 7 #include "fpdfsdk/pdfwindow/PWL_Utils.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 1204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1215 (int32_t)(dBlue * 255)); | 1215 (int32_t)(dBlue * 255)); |
| 1216 } | 1216 } |
| 1217 | 1217 |
| 1218 void CPWL_Utils::DrawFillRect(CFX_RenderDevice* pDevice, | 1218 void CPWL_Utils::DrawFillRect(CFX_RenderDevice* pDevice, |
| 1219 CFX_Matrix* pUser2Device, | 1219 CFX_Matrix* pUser2Device, |
| 1220 const CFX_FloatRect& rect, | 1220 const CFX_FloatRect& rect, |
| 1221 const FX_COLORREF& color) { | 1221 const FX_COLORREF& color) { |
| 1222 CFX_PathData path; | 1222 CFX_PathData path; |
| 1223 CFX_FloatRect rcTemp(rect); | 1223 CFX_FloatRect rcTemp(rect); |
| 1224 path.AppendRect(rcTemp.left, rcTemp.bottom, rcTemp.right, rcTemp.top); | 1224 path.AppendRect(rcTemp.left, rcTemp.bottom, rcTemp.right, rcTemp.top); |
| 1225 pDevice->DrawPath(&path, pUser2Device, NULL, color, 0, FXFILL_WINDING); | 1225 pDevice->DrawPath(&path, pUser2Device, nullptr, color, 0, FXFILL_WINDING); |
| 1226 } | 1226 } |
| 1227 | 1227 |
| 1228 void CPWL_Utils::DrawFillArea(CFX_RenderDevice* pDevice, | 1228 void CPWL_Utils::DrawFillArea(CFX_RenderDevice* pDevice, |
| 1229 CFX_Matrix* pUser2Device, | 1229 CFX_Matrix* pUser2Device, |
| 1230 const CFX_FloatPoint* pPts, | 1230 const CFX_FloatPoint* pPts, |
| 1231 int32_t nCount, | 1231 int32_t nCount, |
| 1232 const FX_COLORREF& color) { | 1232 const FX_COLORREF& color) { |
| 1233 CFX_PathData path; | 1233 CFX_PathData path; |
| 1234 path.SetPointCount(nCount); | 1234 path.SetPointCount(nCount); |
| 1235 | 1235 |
| 1236 path.SetPoint(0, pPts[0].x, pPts[0].y, FXPT_MOVETO); | 1236 path.SetPoint(0, pPts[0].x, pPts[0].y, FXPT_MOVETO); |
| 1237 for (int32_t i = 1; i < nCount; i++) | 1237 for (int32_t i = 1; i < nCount; i++) |
| 1238 path.SetPoint(i, pPts[i].x, pPts[i].y, FXPT_LINETO); | 1238 path.SetPoint(i, pPts[i].x, pPts[i].y, FXPT_LINETO); |
| 1239 | 1239 |
| 1240 pDevice->DrawPath(&path, pUser2Device, NULL, color, 0, FXFILL_ALTERNATE); | 1240 pDevice->DrawPath(&path, pUser2Device, nullptr, color, 0, FXFILL_ALTERNATE); |
| 1241 } | 1241 } |
| 1242 | 1242 |
| 1243 void CPWL_Utils::DrawStrokeRect(CFX_RenderDevice* pDevice, | 1243 void CPWL_Utils::DrawStrokeRect(CFX_RenderDevice* pDevice, |
| 1244 CFX_Matrix* pUser2Device, | 1244 CFX_Matrix* pUser2Device, |
| 1245 const CFX_FloatRect& rect, | 1245 const CFX_FloatRect& rect, |
| 1246 const FX_COLORREF& color, | 1246 const FX_COLORREF& color, |
| 1247 FX_FLOAT fWidth) { | 1247 FX_FLOAT fWidth) { |
| 1248 CFX_PathData path; | 1248 CFX_PathData path; |
| 1249 CFX_FloatRect rcTemp(rect); | 1249 CFX_FloatRect rcTemp(rect); |
| 1250 path.AppendRect(rcTemp.left, rcTemp.bottom, rcTemp.right, rcTemp.top); | 1250 path.AppendRect(rcTemp.left, rcTemp.bottom, rcTemp.right, rcTemp.top); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1333 if (fWidth > 0.0f) { | 1333 if (fWidth > 0.0f) { |
| 1334 FX_FLOAT fHalfWidth = fWidth / 2.0f; | 1334 FX_FLOAT fHalfWidth = fWidth / 2.0f; |
| 1335 | 1335 |
| 1336 switch (nStyle) { | 1336 switch (nStyle) { |
| 1337 default: | 1337 default: |
| 1338 case BorderStyle::SOLID: { | 1338 case BorderStyle::SOLID: { |
| 1339 CFX_PathData path; | 1339 CFX_PathData path; |
| 1340 path.AppendRect(fLeft, fBottom, fRight, fTop); | 1340 path.AppendRect(fLeft, fBottom, fRight, fTop); |
| 1341 path.AppendRect(fLeft + fWidth, fBottom + fWidth, fRight - fWidth, | 1341 path.AppendRect(fLeft + fWidth, fBottom + fWidth, fRight - fWidth, |
| 1342 fTop - fWidth); | 1342 fTop - fWidth); |
| 1343 pDevice->DrawPath(&path, pUser2Device, NULL, | 1343 pDevice->DrawPath(&path, pUser2Device, nullptr, |
| 1344 PWLColorToFXColor(color, nTransparancy), 0, | 1344 PWLColorToFXColor(color, nTransparancy), 0, |
| 1345 FXFILL_ALTERNATE); | 1345 FXFILL_ALTERNATE); |
| 1346 break; | 1346 break; |
| 1347 } | 1347 } |
| 1348 case BorderStyle::DASH: { | 1348 case BorderStyle::DASH: { |
| 1349 CFX_PathData path; | 1349 CFX_PathData path; |
| 1350 | 1350 |
| 1351 path.SetPointCount(5); | 1351 path.SetPointCount(5); |
| 1352 path.SetPoint(0, fLeft + fWidth / 2.0f, fBottom + fWidth / 2.0f, | 1352 path.SetPoint(0, fLeft + fWidth / 2.0f, fBottom + fWidth / 2.0f, |
| 1353 FXPT_MOVETO); | 1353 FXPT_MOVETO); |
| (...skipping 1993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3347 break; | 3347 break; |
| 3348 case COLORTYPE_RGB: | 3348 case COLORTYPE_RGB: |
| 3349 CPWL_Utils::ConvertCMYK2RGB(fColor1, fColor2, fColor3, fColor4, | 3349 CPWL_Utils::ConvertCMYK2RGB(fColor1, fColor2, fColor3, fColor4, |
| 3350 fColor1, fColor2, fColor3); | 3350 fColor1, fColor2, fColor3); |
| 3351 break; | 3351 break; |
| 3352 } | 3352 } |
| 3353 break; | 3353 break; |
| 3354 } | 3354 } |
| 3355 nColorType = other_nColorType; | 3355 nColorType = other_nColorType; |
| 3356 } | 3356 } |
| OLD | NEW |