diff options
author | dan sinclair <dsinclair@chromium.org> | 2017-02-22 19:56:15 -0500 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-02-23 01:17:40 +0000 |
commit | b147e07ee36be10ca0796a6566be107077c21a03 (patch) | |
tree | 637b1b206000a88fb3e198f648e86a9ee5178f1b /core/fxge/win32/fx_win32_device.cpp | |
parent | e3f237740fd8bea50b4a6f37f56455dfa0328546 (diff) | |
download | pdfium-b147e07ee36be10ca0796a6566be107077c21a03.tar.xz |
Convert point x,y into CFX_PointF
This Cl converts the PointX,PointY pairs into a CFX_PointF.
Change-Id: I46897832077c317a5bffb4e568550705decbc40c
Reviewed-on: https://pdfium-review.googlesource.com/2821
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Nicolás Peña <npm@chromium.org>
Diffstat (limited to 'core/fxge/win32/fx_win32_device.cpp')
-rw-r--r-- | core/fxge/win32/fx_win32_device.cpp | 57 |
1 files changed, 26 insertions, 31 deletions
diff --git a/core/fxge/win32/fx_win32_device.cpp b/core/fxge/win32/fx_win32_device.cpp index b5ce7345c6..92e9b41e06 100644 --- a/core/fxge/win32/fx_win32_device.cpp +++ b/core/fxge/win32/fx_win32_device.cpp @@ -169,45 +169,42 @@ void SetPathToDC(HDC hDC, const std::vector<FX_PATHPOINT>& pPoints = pPathData->GetPoints(); for (size_t i = 0; i < pPoints.size(); i++) { - FX_FLOAT posx = pPoints[i].m_PointX; - FX_FLOAT posy = pPoints[i].m_PointY; + CFX_PointF pos = pPoints[i].m_Point; if (pMatrix) - pMatrix->TransformPoint(posx, posy); + pos = pMatrix->Transform(pos); - int screen_x = FXSYS_round(posx), screen_y = FXSYS_round(posy); + CFX_Point screen(FXSYS_round(pos.x), FXSYS_round(pos.y)); FXPT_TYPE point_type = pPoints[i].m_Type; if (point_type == FXPT_TYPE::MoveTo) { - MoveToEx(hDC, screen_x, screen_y, nullptr); + MoveToEx(hDC, screen.x, screen.y, nullptr); } else if (point_type == FXPT_TYPE::LineTo) { - if (pPoints[i].m_PointY == pPoints[i - 1].m_PointY && - pPoints[i].m_PointX == pPoints[i - 1].m_PointX) { - screen_x++; - } - LineTo(hDC, screen_x, screen_y); + if (pPoints[i].m_Point == pPoints[i - 1].m_Point) + screen.x++; + + LineTo(hDC, screen.x, screen.y); } else if (point_type == FXPT_TYPE::BezierTo) { POINT lppt[3]; - lppt[0].x = screen_x; - lppt[0].y = screen_y; - posx = pPoints[i + 1].m_PointX; - posy = pPoints[i + 1].m_PointY; + lppt[0].x = screen.x; + lppt[0].y = screen.y; + + pos = pPoints[i + 1].m_Point; if (pMatrix) - pMatrix->TransformPoint(posx, posy); + pos = pMatrix->Transform(pos); - lppt[1].x = FXSYS_round(posx); - lppt[1].y = FXSYS_round(posy); - posx = pPoints[i + 2].m_PointX; - posy = pPoints[i + 2].m_PointY; + lppt[1].x = FXSYS_round(pos.x); + lppt[1].y = FXSYS_round(pos.y); + + pos = pPoints[i + 2].m_Point; if (pMatrix) - pMatrix->TransformPoint(posx, posy); + pos = pMatrix->Transform(pos); - lppt[2].x = FXSYS_round(posx); - lppt[2].y = FXSYS_round(posy); + lppt[2].x = FXSYS_round(pos.x); + lppt[2].y = FXSYS_round(pos.y); PolyBezierTo(hDC, lppt, 3); i += 2; } - if (pPoints[i].m_CloseFigure) { + if (pPoints[i].m_CloseFigure) CloseFigure(hDC); - } } EndPath(hDC); } @@ -1047,15 +1044,13 @@ bool CGdiDeviceDriver::DrawPath(const CFX_PathData* pPathData, } if (pPathData->GetPoints().size() == 2 && pGraphState && pGraphState->m_DashCount) { - FX_FLOAT x1 = pPathData->GetPointX(0); - FX_FLOAT y1 = pPathData->GetPointY(0); - FX_FLOAT x2 = pPathData->GetPointX(1); - FX_FLOAT y2 = pPathData->GetPointY(1); + CFX_PointF pos1 = pPathData->GetPoint(0); + CFX_PointF pos2 = pPathData->GetPoint(1); if (pMatrix) { - pMatrix->TransformPoint(x1, y1); - pMatrix->TransformPoint(x2, y2); + pos1 = pMatrix->Transform(pos1); + pos2 = pMatrix->Transform(pos2); } - DrawLine(x1, y1, x2, y2); + DrawLine(pos1.x, pos1.y, pos2.x, pos2.y); } else { SetPathToDC(m_hDC, pPathData, pMatrix); if (pGraphState && stroke_alpha) { |