Commit 57d20090 authored by Alexandre Julliard's avatar Alexandre Julliard

gdi32: Add a helper function to reverse an array of points in paths.

parent cac22620
...@@ -276,6 +276,18 @@ static BYTE *add_points( struct gdi_path *path, const POINT *points, DWORD count ...@@ -276,6 +276,18 @@ static BYTE *add_points( struct gdi_path *path, const POINT *points, DWORD count
return ret; return ret;
} }
/* reverse the order of an array of points */
static void reverse_points( POINT *points, UINT count )
{
UINT i;
for (i = 0; i < count / 2; i++)
{
POINT pt = points[i];
points[i] = points[count - i - 1];
points[count - i - 1] = pt;
}
}
/* start a new path stroke if necessary */ /* start a new path stroke if necessary */
static BOOL start_new_stroke( struct path_physdev *physdev ) static BOOL start_new_stroke( struct path_physdev *physdev )
{ {
...@@ -1570,6 +1582,7 @@ static struct gdi_path *PATH_WidenPath(DC *dc) ...@@ -1570,6 +1582,7 @@ static struct gdi_path *PATH_WidenPath(DC *dc)
INT i, j, numStrokes, penWidth, penWidthIn, penWidthOut, size, penStyle; INT i, j, numStrokes, penWidth, penWidthIn, penWidthOut, size, penStyle;
struct gdi_path *flat_path, *pNewPath, **pStrokes = NULL, *pUpPath, *pDownPath; struct gdi_path *flat_path, *pNewPath, **pStrokes = NULL, *pUpPath, *pDownPath;
EXTLOGPEN *elp; EXTLOGPEN *elp;
BYTE *type;
DWORD obj_type, joint, endcap, penType; DWORD obj_type, joint, endcap, penType;
size = GetObjectW( dc->hPen, 0, NULL ); size = GetObjectW( dc->hPen, 0, NULL );
...@@ -1828,18 +1841,11 @@ static struct gdi_path *PATH_WidenPath(DC *dc) ...@@ -1828,18 +1841,11 @@ static struct gdi_path *PATH_WidenPath(DC *dc)
} }
} }
} }
for(j = 0; j < pUpPath->count; j++) { type = add_points( pNewPath, pUpPath->points, pUpPath->count, PT_LINETO );
POINT pt; type[0] = PT_MOVETO;
pt.x = pUpPath->points[j].x; reverse_points( pDownPath->points, pDownPath->count );
pt.y = pUpPath->points[j].y; type = add_points( pNewPath, pDownPath->points, pDownPath->count, PT_LINETO );
PATH_AddEntry(pNewPath, &pt, (j == 0 ? PT_MOVETO : PT_LINETO)); if (pStrokes[i]->flags[pStrokes[i]->count - 1] & PT_CLOSEFIGURE) type[0] = PT_MOVETO;
}
for(j = 0; j < pDownPath->count; j++) {
POINT pt;
pt.x = pDownPath->points[pDownPath->count - j - 1].x;
pt.y = pDownPath->points[pDownPath->count - j - 1].y;
PATH_AddEntry(pNewPath, &pt, ( (j == 0 && (pStrokes[i]->flags[pStrokes[i]->count - 1] & PT_CLOSEFIGURE)) ? PT_MOVETO : PT_LINETO));
}
free_gdi_path( pStrokes[i] ); free_gdi_path( pStrokes[i] );
free_gdi_path( pUpPath ); free_gdi_path( pUpPath );
......
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