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/agg/fx_agg_driver.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'core/fxge/agg') diff --git a/core/fxge/agg/fx_agg_driver.cpp b/core/fxge/agg/fx_agg_driver.cpp index 3ae2c37150..e17f2df13a 100644 --- a/core/fxge/agg/fx_agg_driver.cpp +++ b/core/fxge/agg/fx_agg_driver.cpp @@ -273,20 +273,20 @@ bool DibSetPixel(CFX_DIBitmap* pDevice, void CAgg_PathData::BuildPath(const CFX_PathData* pPathData, const CFX_Matrix* pObject2Device) { - int nPoints = pPathData->GetPointCount(); - FX_PATHPOINT* pPoints = pPathData->GetPoints(); - for (int i = 0; i < nPoints; i++) { - FX_FLOAT x = pPoints[i].m_PointX, y = pPoints[i].m_PointY; - if (pObject2Device) { + const std::vector& pPoints = pPathData->GetPoints(); + for (size_t i = 0; i < pPoints.size(); i++) { + FX_FLOAT x = pPoints[i].m_PointX; + FX_FLOAT y = pPoints[i].m_PointY; + if (pObject2Device) pObject2Device->TransformPoint(x, y); - } + HardClip(x, y); FXPT_TYPE point_type = pPoints[i].m_Type; if (point_type == FXPT_TYPE::MoveTo) { m_PathData.move_to(x, y); } else if (point_type == FXPT_TYPE::LineTo) { if (pPoints[i - 1].IsTypeAndOpen(FXPT_TYPE::MoveTo) && - (i == nPoints - 1 || + (i == pPoints.size() - 1 || pPoints[i + 1].IsTypeAndOpen(FXPT_TYPE::MoveTo)) && pPoints[i].m_PointX == pPoints[i - 1].m_PointX && pPoints[i].m_PointY == pPoints[i - 1].m_PointY) { @@ -553,7 +553,8 @@ bool CFX_AggDeviceDriver::SetClip_PathFill(const CFX_PathData* pPathData, m_pClipRgn = pdfium::MakeUnique( GetDeviceCaps(FXDC_PIXEL_WIDTH), GetDeviceCaps(FXDC_PIXEL_HEIGHT)); } - if (pPathData->GetPointCount() == 5 || pPathData->GetPointCount() == 4) { + size_t size = pPathData->GetPoints().size(); + if (size == 5 || size == 4) { CFX_FloatRect rectf; if (pPathData->IsRect(pObject2Device, &rectf)) { rectf.Intersect( -- cgit v1.2.3