From 2f7653c0d8fe60f1a4956382dcb3d73822694dda Mon Sep 17 00:00:00 2001 From: Jane Liu Date: Fri, 18 Aug 2017 14:04:56 -0400 Subject: Converted DrawCosmeticLine() to take point objects Converted CFX_RenderDevice::DrawCosmeticLine() and IFX_RenderDeviceDriver:: DrawCosmeticLine() to take in CFX_PointF objects instead of two coordinates per point. Bug=pdfium:769 Change-Id: I6116e4106a61487184a71e79c1dca3a85e8c7c27 Reviewed-on: https://pdfium-review.googlesource.com/11410 Reviewed-by: dsinclair Commit-Queue: dsinclair --- core/fxge/cfx_renderdevice.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'core/fxge/cfx_renderdevice.cpp') diff --git a/core/fxge/cfx_renderdevice.cpp b/core/fxge/cfx_renderdevice.cpp index a7b1a93643..8f35dce2da 100644 --- a/core/fxge/cfx_renderdevice.cpp +++ b/core/fxge/cfx_renderdevice.cpp @@ -514,8 +514,7 @@ bool CFX_RenderDevice::DrawPathWithBlend(const CFX_PathData* pPathData, pos1 = pObject2Device->Transform(pos1); pos2 = pObject2Device->Transform(pos2); } - DrawCosmeticLine(pos1.x, pos1.y, pos2.x, pos2.y, fill_color, fill_mode, - blend_type); + DrawCosmeticLine(pos1, pos2, fill_color, fill_mode, blend_type); return true; } @@ -691,21 +690,19 @@ bool CFX_RenderDevice::FillRectWithBlend(const FX_RECT* pRect, return true; } -bool CFX_RenderDevice::DrawCosmeticLine(float x1, - float y1, - float x2, - float y2, +bool CFX_RenderDevice::DrawCosmeticLine(const CFX_PointF& ptMoveTo, + const CFX_PointF& ptLineTo, uint32_t color, int fill_mode, int blend_type) { - if ((color >= 0xff000000) && - m_pDeviceDriver->DrawCosmeticLine(x1, y1, x2, y2, color, blend_type)) { + if ((color >= 0xff000000) && m_pDeviceDriver->DrawCosmeticLine( + ptMoveTo, ptLineTo, color, blend_type)) { return true; } CFX_GraphStateData graph_state; CFX_PathData path; - path.AppendPoint(CFX_PointF(x1, y1), FXPT_TYPE::MoveTo, false); - path.AppendPoint(CFX_PointF(x2, y2), FXPT_TYPE::LineTo, false); + path.AppendPoint(ptMoveTo, FXPT_TYPE::MoveTo, false); + path.AppendPoint(ptLineTo, FXPT_TYPE::LineTo, false); return m_pDeviceDriver->DrawPath(&path, nullptr, &graph_state, 0, color, fill_mode, blend_type); } -- cgit v1.2.3