diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-02-15 11:07:32 -0500 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-02-15 17:47:57 +0000 |
commit | e4602321f3175fa5addb6761d0e94f5c2fc93d0c (patch) | |
tree | 6671774659645fad6d9ce55a5910b4665a25094f /fpdfsdk/pdfwindow/PWL_Edit.cpp | |
parent | eb55885e9a9eec670ed98cbd12dc96d63e6a6623 (diff) | |
download | pdfium-e4602321f3175fa5addb6761d0e94f5c2fc93d0c.tar.xz |
Cleanup CFX_PathData.
This CL replaces the array of path points with a vector. Cleaning up the usage
as required.
Change-Id: Ifa386a2c847005fef68af748ebe99c4e08961238
Reviewed-on: https://pdfium-review.googlesource.com/2710
Reviewed-by: Nicolás Peña <npm@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fpdfsdk/pdfwindow/PWL_Edit.cpp')
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_Edit.cpp | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/fpdfsdk/pdfwindow/PWL_Edit.cpp b/fpdfsdk/pdfwindow/PWL_Edit.cpp index 5d9c314a56..5c22d21940 100644 --- a/fpdfsdk/pdfwindow/PWL_Edit.cpp +++ b/fpdfsdk/pdfwindow/PWL_Edit.cpp @@ -323,21 +323,18 @@ void CPWL_Edit::DrawThisAppearance(CFX_RenderDevice* pDevice, gsd.m_LineWidth = (FX_FLOAT)GetBorderWidth(); CFX_PathData path; - path.SetPointCount(nCharArraySafe.ValueOrDie()); for (int32_t i = 0; i < nCharArray - 1; i++) { - path.SetPoint( - i * 2, + path.AppendPoint( rcClient.left + ((rcClient.right - rcClient.left) / nCharArray) * (i + 1), rcClient.bottom, FXPT_TYPE::MoveTo, false); - path.SetPoint( - i * 2 + 1, + path.AppendPoint( rcClient.left + ((rcClient.right - rcClient.left) / nCharArray) * (i + 1), rcClient.top, FXPT_TYPE::LineTo, false); } - if (path.GetPointCount() > 0) { + if (!path.GetPoints().empty()) { pDevice->DrawPath( &path, pUser2Device, &gsd, 0, CPWL_Utils::PWLColorToFXColor(GetBorderColor(), 255), @@ -355,21 +352,17 @@ void CPWL_Edit::DrawThisAppearance(CFX_RenderDevice* pDevice, gsd.m_DashPhase = (FX_FLOAT)GetBorderDash().nPhase; CFX_PathData path; - path.SetPointCount(nCharArraySafe.ValueOrDie()); - for (int32_t i = 0; i < nCharArray - 1; i++) { - path.SetPoint( - i * 2, + path.AppendPoint( rcClient.left + ((rcClient.right - rcClient.left) / nCharArray) * (i + 1), rcClient.bottom, FXPT_TYPE::MoveTo, false); - path.SetPoint( - i * 2 + 1, + path.AppendPoint( rcClient.left + ((rcClient.right - rcClient.left) / nCharArray) * (i + 1), rcClient.top, FXPT_TYPE::LineTo, false); } - if (path.GetPointCount() > 0) { + if (!path.GetPoints().empty()) { pDevice->DrawPath( &path, pUser2Device, &gsd, 0, CPWL_Utils::PWLColorToFXColor(GetBorderColor(), 255), |