Module: wine Branch: master Commit: abdde73a1c143a47a11fda24632102a2d50573c9 URL: https://gitlab.winehq.org/wine/wine/-/commit/abdde73a1c143a47a11fda24632102a...
Author: Jeff Smith whydoubt@gmail.com Date: Thu Mar 5 14:00:47 2020 -0600
gdiplus: Dash pattern scaling does not shrink below line width 1.0.
Signed-off-by: Jeff Smith whydoubt@gmail.com
---
dlls/gdiplus/graphicspath.c | 3 ++- dlls/gdiplus/tests/graphicspath.c | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-)
diff --git a/dlls/gdiplus/graphicspath.c b/dlls/gdiplus/graphicspath.c index ad4dde58ccd..85e0f7d5777 100644 --- a/dlls/gdiplus/graphicspath.c +++ b/dlls/gdiplus/graphicspath.c @@ -2295,6 +2295,7 @@ static void widen_dashed_figure(GpPath *path, int start, int end, int closed, int dash_index=0; const REAL *dash_pattern; REAL *dash_pattern_scaled; + REAL dash_pattern_scaling = max(pen->width, 1.0); int dash_count; GpPointF *tmp_points; REAL segment_dy; @@ -2337,7 +2338,7 @@ static void widen_dashed_figure(GpPath *path, int start, int end, int closed, if (!dash_pattern_scaled) return;
for (i = 0; i < dash_count; i++) - dash_pattern_scaled[i] = pen->width * dash_pattern[i]; + dash_pattern_scaled[i] = dash_pattern_scaling * dash_pattern[i];
tmp_points = heap_alloc_zero((end - start + 2) * sizeof(GpPoint)); if (!tmp_points) { diff --git a/dlls/gdiplus/tests/graphicspath.c b/dlls/gdiplus/tests/graphicspath.c index 5082f0671d2..7cbcb51edfc 100644 --- a/dlls/gdiplus/tests/graphicspath.c +++ b/dlls/gdiplus/tests/graphicspath.c @@ -1278,6 +1278,17 @@ static path_test_t widenline_dash_path[] = { {45.0, 10.0, PathPointTypeLine|PathPointTypeCloseSubpath, 0, 0}, /*7*/ };
+static path_test_t widenline_thin_dash_path[] = { + {5.0, 4.75, PathPointTypeStart, 0, 0}, /*0*/ + {8.0, 4.75, PathPointTypeLine, 0, 0}, /*1*/ + {8.0, 5.25, PathPointTypeLine, 0, 0}, /*2*/ + {5.0, 5.25, PathPointTypeLine|PathPointTypeCloseSubpath, 0, 0}, /*3*/ + {9.0, 4.75, PathPointTypeStart, 0, 0}, /*4*/ + {9.5, 4.75, PathPointTypeLine, 0, 0}, /*5*/ + {9.5, 5.25, PathPointTypeLine, 0, 0}, /*6*/ + {9.0, 5.25, PathPointTypeLine|PathPointTypeCloseSubpath, 0, 0}, /*7*/ + }; + static path_test_t widenline_unit_path[] = { {5.0, 9.5, PathPointTypeStart, 0, 0}, /*0*/ {50.0, 9.5, PathPointTypeLine, 0, 0}, /*1*/ @@ -1375,6 +1386,18 @@ static void test_widen(void) status = GdipSetPenDashStyle(pen, DashStyleSolid); expect(Ok, status);
+ /* dashed line less than 1 pixel wide */ + GdipDeletePen(pen); + GdipCreatePen1(0xffffffff, 0.5, UnitPixel, &pen); + GdipSetPenDashStyle(pen, DashStyleDash); + + GdipResetPath(path); + GdipAddPathLine(path, 5.0, 5.0, 9.5, 5.0); + + status = GdipWidenPath(path, pen, m, 1.0); + expect(Ok, status); + ok_path_fudge(path, widenline_thin_dash_path, ARRAY_SIZE(widenline_thin_dash_path), FALSE, 0.000005); + /* pen width in UnitWorld */ GdipDeletePen(pen); status = GdipCreatePen1(0xffffffff, 10.0, UnitWorld, &pen);