diff options
author | Nicolas Pena <npm@chromium.org> | 2017-02-07 14:21:36 -0500 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-02-07 19:46:09 +0000 |
commit | 79365f7e3d2d62138e79e4403d4959318776c139 (patch) | |
tree | b00196a8cdc6777ee0224653ef70bb2f2f7bb8b9 /core/fxge/win32/cfx_psrenderer.cpp | |
parent | c222907f453e8a0e6376a86f89354eedb8285854 (diff) | |
download | pdfium-79365f7e3d2d62138e79e4403d4959318776c139.tar.xz |
Use enum class for PathPoint types.
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 <npm@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core/fxge/win32/cfx_psrenderer.cpp')
-rw-r--r-- | core/fxge/win32/cfx_psrenderer.cpp | 23 |
1 files changed, 12 insertions, 11 deletions
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) << " " |