Commit abdde73a authored by Jeff Smith's avatar Jeff Smith Committed by Alexandre Julliard

gdiplus: Dash pattern scaling does not shrink below line width 1.0.

parent 7026effe
......@@ -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) {
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment