summaryrefslogtreecommitdiff
path: root/core/fxge/win32
diff options
context:
space:
mode:
authorJane Liu <janeliulwq@google.com>2017-08-18 14:04:56 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-08-21 14:50:36 +0000
commit2f7653c0d8fe60f1a4956382dcb3d73822694dda (patch)
tree5841475fc11d51c0787aed1e73b80e46805e967d /core/fxge/win32
parent8b2107ed93465c6f9c1dd647e93446354dbe3738 (diff)
downloadpdfium-2f7653c0d8fe60f1a4956382dcb3d73822694dda.tar.xz
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 <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fxge/win32')
-rw-r--r--core/fxge/win32/fx_win32_device.cpp20
-rw-r--r--core/fxge/win32/win32_int.h6
2 files changed, 11 insertions, 15 deletions
diff --git a/core/fxge/win32/fx_win32_device.cpp b/core/fxge/win32/fx_win32_device.cpp
index b707a76c08..101c945fc5 100644
--- a/core/fxge/win32/fx_win32_device.cpp
+++ b/core/fxge/win32/fx_win32_device.cpp
@@ -998,14 +998,14 @@ bool CGdiDeviceDriver::DrawPath(const CFX_PathData* pPathData,
FX_RECT bbox = bbox_f.GetInnerRect();
if (bbox.Width() <= 0) {
- return DrawCosmeticLine((float)(bbox.left), (float)(bbox.top),
- (float)(bbox.left), (float)(bbox.bottom + 1),
+ return DrawCosmeticLine(CFX_PointF(bbox.left, bbox.top),
+ CFX_PointF(bbox.left, bbox.bottom + 1),
fill_color, FXDIB_BLEND_NORMAL);
}
if (bbox.Height() <= 0) {
- return DrawCosmeticLine((float)(bbox.left), (float)(bbox.top),
- (float)(bbox.right + 1), (float)(bbox.top),
- fill_color, FXDIB_BLEND_NORMAL);
+ return DrawCosmeticLine(CFX_PointF(bbox.left, bbox.top),
+ CFX_PointF(bbox.right + 1, bbox.top), fill_color,
+ FXDIB_BLEND_NORMAL);
}
}
int fill_alpha = FXARGB_A(fill_color);
@@ -1137,10 +1137,8 @@ bool CGdiDeviceDriver::SetClip_PathStroke(
return ret;
}
-bool CGdiDeviceDriver::DrawCosmeticLine(float x1,
- float y1,
- float x2,
- float y2,
+bool CGdiDeviceDriver::DrawCosmeticLine(const CFX_PointF& ptMoveTo,
+ const CFX_PointF& ptLineTo,
uint32_t color,
int blend_type) {
if (blend_type != FXDIB_BLEND_NORMAL)
@@ -1154,8 +1152,8 @@ bool CGdiDeviceDriver::DrawCosmeticLine(float x1,
HPEN hPen = CreatePen(PS_SOLID, 1, rgb);
hPen = (HPEN)SelectObject(m_hDC, hPen);
- MoveToEx(m_hDC, FXSYS_round(x1), FXSYS_round(y1), nullptr);
- LineTo(m_hDC, FXSYS_round(x2), FXSYS_round(y2));
+ MoveToEx(m_hDC, FXSYS_round(ptMoveTo.x), FXSYS_round(ptMoveTo.y), nullptr);
+ LineTo(m_hDC, FXSYS_round(ptLineTo.x), FXSYS_round(ptLineTo.y));
hPen = (HPEN)SelectObject(m_hDC, hPen);
DeleteObject(hPen);
return true;
diff --git a/core/fxge/win32/win32_int.h b/core/fxge/win32/win32_int.h
index c51bae7f67..f9fcbe83af 100644
--- a/core/fxge/win32/win32_int.h
+++ b/core/fxge/win32/win32_int.h
@@ -150,10 +150,8 @@ class CGdiDeviceDriver : public IFX_RenderDeviceDriver {
bool FillRectWithBlend(const FX_RECT* pRect,
uint32_t fill_color,
int blend_type) override;
- bool DrawCosmeticLine(float x1,
- float y1,
- float x2,
- float y2,
+ bool DrawCosmeticLine(const CFX_PointF& ptMoveTo,
+ const CFX_PointF& ptLineTo,
uint32_t color,
int blend_type) override;
bool GetClipBox(FX_RECT* pRect) override;