[PATCH] gdiplus: Scale widened dashes to the pen width.
Zebediah Figura
z.figura12 at gmail.com
Mon Jun 26 13:52:10 CDT 2017
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
---
dlls/gdiplus/graphicspath.c | 4 +++-
dlls/gdiplus/tests/graphicspath.c | 27 +++++++++++++++++++++++++++
2 files changed, 30 insertions(+), 1 deletion(-)
diff --git a/dlls/gdiplus/graphicspath.c b/dlls/gdiplus/graphicspath.c
index e34f4edc12e..0ce3137e95d 100644
--- a/dlls/gdiplus/graphicspath.c
+++ b/dlls/gdiplus/graphicspath.c
@@ -2089,7 +2089,9 @@ static void widen_dashed_figure(GpPath *path, GpPen *pen, int start, int end,
else
{
/* advance to next dash in pattern */
- segment_pos += dash_pattern[dash_index] - dash_pos;
+ segment_pos += (dash_pattern[dash_index] - dash_pos) * pen->width;
+ if (segment_pos > segment_length)
+ segment_pos = segment_length;
dash_pos = 0.0;
if (++dash_index == dash_count)
dash_index = 0;
diff --git a/dlls/gdiplus/tests/graphicspath.c b/dlls/gdiplus/tests/graphicspath.c
index c44ed5e4240..2a94e845c92 100644
--- a/dlls/gdiplus/tests/graphicspath.c
+++ b/dlls/gdiplus/tests/graphicspath.c
@@ -1065,6 +1065,17 @@ static path_test_t widenline_wide_path[] = {
{5.0, 20.0, PathPointTypeLine|PathPointTypeCloseSubpath, 0, 0} /*3*/
};
+static path_test_t widenline_dash_path[] = {
+ {5.0, 0.0, PathPointTypeStart, 0, 0}, /*0*/
+ {35.0, 0.0, PathPointTypeLine, 0, 0}, /*1*/
+ {35.0, 10.0, PathPointTypeLine, 0, 0}, /*2*/
+ {5.0, 10.0, PathPointTypeLine|PathPointTypeCloseSubpath, 0, 0}, /*3*/
+ {45.0, 0.0, PathPointTypeStart, 0, 0}, /*4*/
+ {50.0, 0.0, PathPointTypeLine, 0, 0}, /*5*/
+ {50.0, 10.0, PathPointTypeLine, 0, 0}, /*6*/
+ {45.0, 10.0, PathPointTypeLine|PathPointTypeCloseSubpath, 0, 0}, /*7*/
+ };
+
static void test_widen(void)
{
GpStatus status;
@@ -1139,6 +1150,22 @@ static void test_widen(void)
status = GdipScaleMatrix(m, 1.0, 0.5, MatrixOrderAppend);
expect(Ok, status);
+ /* dashed line */
+ status = GdipResetPath(path);
+ expect(Ok, status);
+ status = GdipAddPathLine(path, 5.0, 5.0, 50.0, 5.0);
+ expect(Ok, status);
+
+ status = GdipSetPenDashStyle(pen, DashStyleDash);
+ expect(Ok, status);
+
+ status = GdipWidenPath(path, pen, m, 1.0);
+ expect(Ok, status);
+ ok_path(path, widenline_dash_path, sizeof(widenline_dash_path)/sizeof(path_test_t), FALSE);
+
+ status = GdipSetPenDashStyle(pen, DashStyleSolid);
+ expect(Ok, status);
+
/* pen width in UnitWorld */
GdipDeletePen(pen);
status = GdipCreatePen1(0xffffffff, 10.0, UnitWorld, &pen);
--
2.13.1
More information about the wine-patches
mailing list