gdi32: Fix setting the path flags in PolyPolyline and PolyPolygon.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2016-06-22 14:27:28 +09:00
parent 8a29c57fd2
commit e68d68fb7d
1 changed files with 22 additions and 9 deletions

View File

@ -1298,16 +1298,24 @@ static BOOL pathdrv_Polygon( PHYSDEV dev, const POINT *pts, INT cbPoints )
static BOOL pathdrv_PolyPolygon( PHYSDEV dev, const POINT* pts, const INT* counts, UINT polygons ) static BOOL pathdrv_PolyPolygon( PHYSDEV dev, const POINT* pts, const INT* counts, UINT polygons )
{ {
struct path_physdev *physdev = get_path_physdev( dev ); struct path_physdev *physdev = get_path_physdev( dev );
UINT poly; UINT poly, count;
BYTE *type; BYTE *type;
for(poly = 0; poly < polygons; poly++) { if (!polygons) return FALSE;
type = add_log_points( physdev, pts, counts[poly], PT_LINETO ); for (poly = count = 0; poly < polygons; poly++)
if (!type) return FALSE; {
if (counts[poly] < 2) return FALSE;
count += counts[poly];
}
type = add_log_points( physdev, pts, count, PT_LINETO );
if (!type) return FALSE;
/* make the first point of each polyline a PT_MOVETO, and close the last one */
for (poly = 0; poly < polygons; type += counts[poly++])
{
type[0] = PT_MOVETO; type[0] = PT_MOVETO;
/* win98 adds an extra line to close the figure for some reason */ type[counts[poly] - 1] = PT_LINETO | PT_CLOSEFIGURE;
add_log_points( physdev, pts, 1, PT_LINETO | PT_CLOSEFIGURE );
pts += counts[poly];
} }
return TRUE; return TRUE;
} }
@ -1322,13 +1330,18 @@ static BOOL pathdrv_PolyPolyline( PHYSDEV dev, const POINT* pts, const DWORD* co
UINT poly, count; UINT poly, count;
BYTE *type; BYTE *type;
for (poly = count = 0; poly < polylines; poly++) count += counts[poly]; if (!polylines) return FALSE;
for (poly = count = 0; poly < polylines; poly++)
{
if (counts[poly] < 2) return FALSE;
count += counts[poly];
}
type = add_log_points( physdev, pts, count, PT_LINETO ); type = add_log_points( physdev, pts, count, PT_LINETO );
if (!type) return FALSE; if (!type) return FALSE;
/* make the first point of each polyline a PT_MOVETO */ /* make the first point of each polyline a PT_MOVETO */
for (poly = 0; poly < polylines; poly++, type += counts[poly]) *type = PT_MOVETO; for (poly = 0; poly < polylines; type += counts[poly++]) *type = PT_MOVETO;
return TRUE; return TRUE;
} }