gdiplus: Set flatness more appropriately in GdipDrawPath.

If the path is going to be scaled before rendering, 1.0 does not make
sense as an error value.

Signed-off-by: Vincent Povirk <vincent@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Vincent Povirk 2017-06-29 13:41:05 -05:00 committed by Alexandre Julliard
parent 2eeef78e8d
commit 6ec3cd9434
1 changed files with 17 additions and 1 deletions

View File

@ -3715,6 +3715,7 @@ static GpStatus SOFTWARE_GdipDrawPath(GpGraphics *graphics, GpPen *pen, GpPath *
GpStatus stat;
GpPath *wide_path;
GpMatrix *transform=NULL;
REAL flatness=1.0;
/* Check if the final pen thickness in pixels is too thin. */
if (pen->unit == UnitPixel)
@ -3756,9 +3757,24 @@ static GpStatus SOFTWARE_GdipDrawPath(GpGraphics *graphics, GpPen *pen, GpPath *
stat = get_graphics_transform(graphics, CoordinateSpaceDevice,
CoordinateSpaceWorld, transform);
}
else
{
/* Set flatness based on the final coordinate space */
GpMatrix t;
stat = get_graphics_transform(graphics, CoordinateSpaceDevice,
CoordinateSpaceWorld, &t);
if (stat != Ok)
return stat;
flatness = 1.0/sqrt(fmax(
t.matrix[0] * t.matrix[0] + t.matrix[1] * t.matrix[1],
t.matrix[2] * t.matrix[2] + t.matrix[3] * t.matrix[3]));
}
if (stat == Ok)
stat = GdipWidenPath(wide_path, pen, transform, 1.0);
stat = GdipWidenPath(wide_path, pen, transform, flatness);
if (pen->unit == UnitPixel)
{