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/cfx_psrenderer.cpp | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'core/fxge/win32/cfx_psrenderer.cpp') diff --git a/core/fxge/win32/cfx_psrenderer.cpp b/core/fxge/win32/cfx_psrenderer.cpp index b62d0cb8f5..c01c4c0060 100644 --- a/core/fxge/win32/cfx_psrenderer.cpp +++ b/core/fxge/win32/cfx_psrenderer.cpp @@ -113,23 +113,24 @@ void CFX_PSRenderer::OutputPath(const CFX_PathData* pPathData, CFX_ByteTextBuf buf; buf.EstimateSize(nPoints * 10); for (int i = 0; i < nPoints; i++) { - uint8_t flag = pPathData->GetFlag(i); + FXPT_TYPE type = pPathData->GetType(i); + bool closing = pPathData->IsClosingFigure(i); FX_FLOAT x = pPathData->GetPointX(i); FX_FLOAT y = pPathData->GetPointY(i); if (pObject2Device) { pObject2Device->Transform(x, y); } buf << x << " " << y; - switch (flag & FXPT_TYPE) { - case FXPT_MOVETO: + switch (type) { + case FXPT_TYPE::MoveTo: buf << " m "; break; - case FXPT_LINETO: + case FXPT_TYPE::LineTo: buf << " l "; - if (flag & FXPT_CLOSEFIGURE) + if (closing) buf << "h "; break; - case FXPT_BEZIERTO: { + case FXPT_TYPE::BezierTo: { FX_FLOAT x1 = pPathData->GetPointX(i + 1); FX_FLOAT x2 = pPathData->GetPointX(i + 2); FX_FLOAT y1 = pPathData->GetPointY(i + 1); @@ -139,7 +140,7 @@ void CFX_PSRenderer::OutputPath(const CFX_PathData* pPathData, pObject2Device->Transform(x2, y2); } buf << " " << x1 << " " << y1 << " " << x2 << " " << y2 << " c"; - if (flag & FXPT_CLOSEFIGURE) + if (closing) buf << " h"; buf << "\n"; i += 2; @@ -599,16 +600,16 @@ void CFX_PSRenderer::FindPSFontGlyph(CFX_FaceCache* pFaceCache, << "{n "; for (int p = 0; p < TransformedPath.GetPointCount(); p++) { FX_FLOAT x = TransformedPath.GetPointX(p), y = TransformedPath.GetPointY(p); - switch (TransformedPath.GetFlag(p) & FXPT_TYPE) { - case FXPT_MOVETO: { + switch (TransformedPath.GetType(p)) { + case FXPT_TYPE::MoveTo: { buf << x << " " << y << " m\n"; break; } - case FXPT_LINETO: { + case FXPT_TYPE::LineTo: { buf << x << " " << y << " l\n"; break; } - case FXPT_BEZIERTO: { + case FXPT_TYPE::BezierTo: { buf << x << " " << y << " " << TransformedPath.GetPointX(p + 1) << " " << TransformedPath.GetPointY(p + 1) << " " << TransformedPath.GetPointX(p + 2) << " " -- cgit v1.2.3