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 --- xfa/fde/cfde_path.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'xfa/fde/cfde_path.cpp') diff --git a/xfa/fde/cfde_path.cpp b/xfa/fde/cfde_path.cpp index 6db0ccc6bf..cd65d9ee09 100644 --- a/xfa/fde/cfde_path.cpp +++ b/xfa/fde/cfde_path.cpp @@ -16,7 +16,7 @@ bool CFDE_Path::StartFigure() { bool CFDE_Path::CloseFigure() { FX_PATHPOINT* pPoint = GetLastPoint(); if (pPoint) - pPoint->m_Flag |= FXPT_CLOSEFIGURE; + pPoint->m_CloseFigure = true; return true; } @@ -32,7 +32,7 @@ FX_PATHPOINT* CFDE_Path::GetLastPoint(int32_t iCount) const { bool CFDE_Path::FigureClosed() const { FX_PATHPOINT* pPoint = GetLastPoint(); - return pPoint ? (pPoint->m_Flag & FXPT_CLOSEFIGURE) : true; + return pPoint ? pPoint->m_CloseFigure : true; } FX_PATHPOINT* CFDE_Path::AddPoints(int32_t iCount) { @@ -48,14 +48,16 @@ void CFDE_Path::MoveTo(FX_FLOAT fx, FX_FLOAT fy) { FX_PATHPOINT* pPoint = AddPoints(1); pPoint->m_PointX = fx; pPoint->m_PointY = fy; - pPoint->m_Flag = FXPT_MOVETO; + pPoint->m_Type = FXPT_TYPE::MoveTo; + pPoint->m_CloseFigure = false; } void CFDE_Path::LineTo(FX_FLOAT fx, FX_FLOAT fy) { FX_PATHPOINT* pPoint = AddPoints(1); pPoint->m_PointX = fx; pPoint->m_PointY = fy; - pPoint->m_Flag = FXPT_LINETO; + pPoint->m_Type = FXPT_TYPE::LineTo; + pPoint->m_CloseFigure = false; } void CFDE_Path::BezierTo(const CFX_PointF& p1, @@ -64,13 +66,16 @@ void CFDE_Path::BezierTo(const CFX_PointF& p1, FX_PATHPOINT* p = AddPoints(3); p[0].m_PointX = p1.x; p[0].m_PointY = p1.y; - p[0].m_Flag = FXPT_BEZIERTO; + p[0].m_Type = FXPT_TYPE::BezierTo; + p[0].m_CloseFigure = false; p[1].m_PointX = p2.x; p[1].m_PointY = p2.y; - p[1].m_Flag = FXPT_BEZIERTO; + p[1].m_Type = FXPT_TYPE::BezierTo; + p[1].m_CloseFigure = false; p[2].m_PointX = p3.x; p[2].m_PointY = p3.y; - p[2].m_Flag = FXPT_BEZIERTO; + p[2].m_Type = FXPT_TYPE::BezierTo; + p[2].m_CloseFigure = false; } void CFDE_Path::ArcTo(bool bStart, -- cgit v1.2.3