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 /core/fxge/ge/cfx_renderdevice.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 'core/fxge/ge/cfx_renderdevice.cpp')
-rw-r--r-- | core/fxge/ge/cfx_renderdevice.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/core/fxge/ge/cfx_renderdevice.cpp b/core/fxge/ge/cfx_renderdevice.cpp index 12a3dd480d..b0be4667e3 100644 --- a/core/fxge/ge/cfx_renderdevice.cpp +++ b/core/fxge/ge/cfx_renderdevice.cpp @@ -473,8 +473,8 @@ bool CFX_RenderDevice::DrawPathWithBlend(const CFX_PathData* pPathData, int blend_type) { uint8_t stroke_alpha = pGraphState ? FXARGB_A(stroke_color) : 0; uint8_t fill_alpha = (fill_mode & 3) ? FXARGB_A(fill_color) : 0; - if (stroke_alpha == 0 && pPathData->GetPointCount() == 2) { - FX_PATHPOINT* pPoints = pPathData->GetPoints(); + const std::vector<FX_PATHPOINT>& pPoints = pPathData->GetPoints(); + if (stroke_alpha == 0 && pPoints.size() == 2) { FX_FLOAT x1 = pPoints[0].m_PointX; FX_FLOAT y1 = pPoints[0].m_PointY; FX_FLOAT x2 = pPoints[1].m_PointX; @@ -487,8 +487,7 @@ bool CFX_RenderDevice::DrawPathWithBlend(const CFX_PathData* pPathData, return true; } - if ((pPathData->GetPointCount() == 5 || pPathData->GetPointCount() == 4) && - stroke_alpha == 0) { + if ((pPoints.size() == 5 || pPoints.size() == 4) && stroke_alpha == 0) { CFX_FloatRect rect_f; if (!(fill_mode & FXFILL_RECT_AA) && pPathData->IsRect(pObject2Device, &rect_f)) { @@ -536,7 +535,7 @@ bool CFX_RenderDevice::DrawPathWithBlend(const CFX_PathData* pPathData, !(fill_mode & FX_FILL_TEXT_MODE)) { CFX_PathData newPath; bool bThin = false; - if (pPathData->GetZeroAreaPath(newPath, (CFX_Matrix*)pObject2Device, bThin, + if (pPathData->GetZeroAreaPath(&newPath, (CFX_Matrix*)pObject2Device, bThin, !!m_pDeviceDriver->GetDriverType())) { CFX_GraphStateData graphState; graphState.m_LineWidth = 0.0f; @@ -673,9 +672,8 @@ bool CFX_RenderDevice::DrawCosmeticLine(FX_FLOAT x1, } CFX_GraphStateData graph_state; CFX_PathData path; - path.SetPointCount(2); - path.SetPoint(0, x1, y1, FXPT_TYPE::MoveTo, false); - path.SetPoint(1, x2, y2, FXPT_TYPE::LineTo, false); + path.AppendPoint(x1, y1, FXPT_TYPE::MoveTo, false); + path.AppendPoint(x2, y2, FXPT_TYPE::LineTo, false); return m_pDeviceDriver->DrawPath(&path, nullptr, &graph_state, 0, color, fill_mode, blend_type); } |