From 79365f7e3d2d62138e79e4403d4959318776c139 Mon Sep 17 00:00:00 2001 From: Nicolas Pena Date: Tue, 7 Feb 2017 14:21:36 -0500 Subject: Use enum class for PathPoint types. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This hopefully makes it less confusing what the description of a point is. Currently we have defines for the types, which is confusing because a point can only be one of the three. And it is mixed up with whether the point is closing a figure or not. Change-Id: Icd71355d69c77b3d52ca78e03bc379081ff87753 Reviewed-on: https://pdfium-review.googlesource.com/2552 Commit-Queue: Nicolás Peña Reviewed-by: Tom Sepez --- core/fxge/win32/fx_win32_gdipext.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'core/fxge/win32/fx_win32_gdipext.cpp') diff --git a/core/fxge/win32/fx_win32_gdipext.cpp b/core/fxge/win32/fx_win32_gdipext.cpp index cd18525b00..65f7b3e732 100644 --- a/core/fxge/win32/fx_win32_gdipext.cpp +++ b/core/fxge/win32/fx_win32_gdipext.cpp @@ -1151,16 +1151,17 @@ bool CGdiplusExt::DrawPath(HDC hDC, if (y < -50000 * 1.0f) { points[i].Y = -50000 * 1.0f; } - int point_type = pPoints[i].m_Flag & FXPT_TYPE; - if (point_type == FXPT_MOVETO) { + FXPT_TYPE point_type = pPoints[i].m_Type; + if (point_type == FXPT_TYPE::MoveTo) { types[i] = PathPointTypeStart; nSubPathes++; bSubClose = false; startpoint = i; - } else if (point_type == FXPT_LINETO) { + } else if (point_type == FXPT_TYPE::LineTo) { types[i] = PathPointTypeLine; - if (pPoints[i - 1].m_Flag == FXPT_MOVETO && - (i == nPoints - 1 || pPoints[i + 1].m_Flag == FXPT_MOVETO) && + if (pPoints[i - 1].IsTypeAndOpen(FXPT_TYPE::MoveTo) && + (i == nPoints - 1 || + pPoints[i + 1].IsTypeAndOpen(FXPT_TYPE::MoveTo)) && points[i].Y == points[i - 1].Y && points[i].X == points[i - 1].X) { points[i].X += 0.01f; continue; @@ -1169,11 +1170,11 @@ bool CGdiplusExt::DrawPath(HDC hDC, points[i].Y != points[i - 1].Y) { bSmooth = true; } - } else if (point_type == FXPT_BEZIERTO) { + } else if (point_type == FXPT_TYPE::BezierTo) { types[i] = PathPointTypeBezier; bSmooth = true; } - if (pPoints[i].m_Flag & FXPT_CLOSEFIGURE) { + if (pPoints[i].m_CloseFigure) { if (bSubClose) { types[pos_subclose] &= ~PathPointTypeCloseSubpath; } else { -- cgit v1.2.3