Module: wine Branch: master Commit: 57d200903568bb2812f171cc1f0950a3ba4b8437 URL: http://source.winehq.org/git/wine.git/?a=commit;h=57d200903568bb2812f171cc1f...
Author: Alexandre Julliard julliard@winehq.org Date: Fri Jun 24 13:21:47 2016 +0900
gdi32: Add a helper function to reverse an array of points in paths.
Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/gdi32/path.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-)
diff --git a/dlls/gdi32/path.c b/dlls/gdi32/path.c index 9666ea3..59d46c3 100644 --- a/dlls/gdi32/path.c +++ b/dlls/gdi32/path.c @@ -276,6 +276,18 @@ static BYTE *add_points( struct gdi_path *path, const POINT *points, DWORD count 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 */ static BOOL start_new_stroke( struct path_physdev *physdev ) { @@ -1570,6 +1582,7 @@ static struct gdi_path *PATH_WidenPath(DC *dc) INT i, j, numStrokes, penWidth, penWidthIn, penWidthOut, size, penStyle; struct gdi_path *flat_path, *pNewPath, **pStrokes = NULL, *pUpPath, *pDownPath; EXTLOGPEN *elp; + BYTE *type; DWORD obj_type, joint, endcap, penType;
size = GetObjectW( dc->hPen, 0, NULL ); @@ -1828,18 +1841,11 @@ static struct gdi_path *PATH_WidenPath(DC *dc) } } } - for(j = 0; j < pUpPath->count; j++) { - POINT pt; - pt.x = pUpPath->points[j].x; - pt.y = pUpPath->points[j].y; - PATH_AddEntry(pNewPath, &pt, (j == 0 ? PT_MOVETO : PT_LINETO)); - } - 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)); - } + type = add_points( pNewPath, pUpPath->points, pUpPath->count, PT_LINETO ); + type[0] = PT_MOVETO; + reverse_points( pDownPath->points, pDownPath->count ); + type = add_points( pNewPath, pDownPath->points, pDownPath->count, PT_LINETO ); + if (pStrokes[i]->flags[pStrokes[i]->count - 1] & PT_CLOSEFIGURE) type[0] = PT_MOVETO;
free_gdi_path( pStrokes[i] ); free_gdi_path( pUpPath );