From e4602321f3175fa5addb6761d0e94f5c2fc93d0c Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Wed, 15 Feb 2017 11:07:32 -0500 Subject: Cleanup CFX_PathData. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Tom Sepez Commit-Queue: dsinclair --- core/fxge/win32/fx_win32_device.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'core/fxge/win32/fx_win32_device.cpp') diff --git a/core/fxge/win32/fx_win32_device.cpp b/core/fxge/win32/fx_win32_device.cpp index add0f0e3d3..b5ce7345c6 100644 --- a/core/fxge/win32/fx_win32_device.cpp +++ b/core/fxge/win32/fx_win32_device.cpp @@ -166,10 +166,11 @@ void SetPathToDC(HDC hDC, const CFX_PathData* pPathData, const CFX_Matrix* pMatrix) { BeginPath(hDC); - int nPoints = pPathData->GetPointCount(); - FX_PATHPOINT* pPoints = pPathData->GetPoints(); - for (int i = 0; i < nPoints; i++) { - FX_FLOAT posx = pPoints[i].m_PointX, posy = pPoints[i].m_PointY; + + const std::vector& pPoints = pPathData->GetPoints(); + for (size_t i = 0; i < pPoints.size(); i++) { + FX_FLOAT posx = pPoints[i].m_PointX; + FX_FLOAT posy = pPoints[i].m_PointY; if (pMatrix) pMatrix->TransformPoint(posx, posy); @@ -1019,8 +1020,8 @@ bool CGdiDeviceDriver::DrawPath(const CFX_PathData* pPathData, (pGraphState && pGraphState->m_DashCount))) { if (!((!pMatrix || !pMatrix->WillScale()) && pGraphState && pGraphState->m_LineWidth == 1.f && - (pPathData->GetPointCount() == 5 || - pPathData->GetPointCount() == 4) && + (pPathData->GetPoints().size() == 5 || + pPathData->GetPoints().size() == 4) && pPathData->IsRect())) { if (pPlatform->m_GdiplusExt.DrawPath(m_hDC, pPathData, pMatrix, pGraphState, fill_color, @@ -1044,7 +1045,7 @@ bool CGdiDeviceDriver::DrawPath(const CFX_PathData* pPathData, hBrush = CreateBrush(fill_color); hBrush = (HBRUSH)SelectObject(m_hDC, hBrush); } - if (pPathData->GetPointCount() == 2 && pGraphState && + if (pPathData->GetPoints().size() == 2 && pGraphState && pGraphState->m_DashCount) { FX_FLOAT x1 = pPathData->GetPointX(0); FX_FLOAT y1 = pPathData->GetPointY(0); @@ -1108,7 +1109,7 @@ bool CGdiDeviceDriver::FillRectWithBlend(const FX_RECT* pRect, bool CGdiDeviceDriver::SetClip_PathFill(const CFX_PathData* pPathData, const CFX_Matrix* pMatrix, int fill_mode) { - if (pPathData->GetPointCount() == 5) { + if (pPathData->GetPoints().size() == 5) { CFX_FloatRect rectf; if (pPathData->IsRect(pMatrix, &rectf)) { FX_RECT rect = rectf.GetOuterRect(); -- cgit v1.2.3