Module: wine Branch: master Commit: d4889bef47331f556cc1bfdbecfb8a65ccd513cb URL: http://source.winehq.org/git/wine.git/?a=commit;h=d4889bef47331f556cc1bfdbec...
Author: Alexandre Julliard julliard@winehq.org Date: Tue Oct 25 15:40:42 2011 +0200
gdi32: Implement the polygon entry points in the path driver.
---
dlls/gdi32/gdi_private.h | 2 - dlls/gdi32/painting.c | 16 ++------- dlls/gdi32/path.c | 80 ++++++++++++++++++++++------------------------ 3 files changed, 42 insertions(+), 56 deletions(-)
diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h index 68b5abf..73b7db5 100644 --- a/dlls/gdi32/gdi_private.h +++ b/dlls/gdi32/gdi_private.h @@ -329,9 +329,7 @@ extern BOOL PATH_ExtTextOut(DC *dc, INT x, INT y, UINT flags, const RECT *lprc, LPCWSTR str, UINT count, const INT *dx) DECLSPEC_HIDDEN; extern BOOL PATH_PolylineTo(DC *dc, const POINT *pt, DWORD cbCount) DECLSPEC_HIDDEN; extern BOOL PATH_Polyline(DC *dc, const POINT *pt, DWORD cbCount) DECLSPEC_HIDDEN; -extern BOOL PATH_Polygon(DC *dc, const POINT *pt, DWORD cbCount) DECLSPEC_HIDDEN; extern BOOL PATH_PolyPolyline(DC *dc, const POINT *pt, const DWORD *counts, DWORD polylines) DECLSPEC_HIDDEN; -extern BOOL PATH_PolyPolygon(DC *dc, const POINT *pt, const INT *counts, UINT polygons) DECLSPEC_HIDDEN;
/* painting.c */ extern POINT *GDI_Bezier( const POINT *Points, INT count, INT *nPtsOut ) DECLSPEC_HIDDEN; diff --git a/dlls/gdi32/painting.c b/dlls/gdi32/painting.c index d0c2955..87b5302 100644 --- a/dlls/gdi32/painting.c +++ b/dlls/gdi32/painting.c @@ -777,13 +777,9 @@ BOOL WINAPI Polygon( HDC hdc, const POINT* pt, INT count )
if (dc) { + PHYSDEV physdev = GET_DC_PHYSDEV( dc, pPolygon ); update_dc( dc ); - if (PATH_IsPathOpen(dc->path)) ret = PATH_Polygon(dc, pt, count); - else - { - PHYSDEV physdev = GET_DC_PHYSDEV( dc, pPolygon ); - ret = physdev->funcs->pPolygon( physdev, pt, count ); - } + ret = physdev->funcs->pPolygon( physdev, pt, count ); release_dc_ptr( dc ); } return ret; @@ -801,13 +797,9 @@ BOOL WINAPI PolyPolygon( HDC hdc, const POINT* pt, const INT* counts,
if (dc) { + PHYSDEV physdev = GET_DC_PHYSDEV( dc, pPolyPolygon ); update_dc( dc ); - if (PATH_IsPathOpen(dc->path)) ret = PATH_PolyPolygon(dc, pt, counts, polygons); - else - { - PHYSDEV physdev = GET_DC_PHYSDEV( dc, pPolyPolygon ); - ret = physdev->funcs->pPolyPolygon( physdev, pt, counts, polygons ); - } + ret = physdev->funcs->pPolyPolygon( physdev, pt, counts, polygons ); release_dc_ptr( dc ); } return ret; diff --git a/dlls/gdi32/path.c b/dlls/gdi32/path.c index 896d145..c7dde62 100644 --- a/dlls/gdi32/path.c +++ b/dlls/gdi32/path.c @@ -1373,51 +1373,47 @@ BOOL PATH_PolylineTo(DC *dc, const POINT *pts, DWORD cbPoints) }
-BOOL PATH_Polygon(DC *dc, const POINT *pts, DWORD cbPoints) +/************************************************************* + * pathdrv_Polygon + */ +static BOOL pathdrv_Polygon( PHYSDEV dev, const POINT *pts, INT cbPoints ) { - GdiPath *pPath = &dc->path; - POINT pt; - UINT i; - - /* Check that path is open */ - if(pPath->state!=PATH_Open) - return FALSE; + struct path_physdev *physdev = get_path_physdev( dev ); + POINT pt; + INT i;
- for(i = 0; i < cbPoints; i++) { - pt = pts[i]; - if(!LPtoDP(dc->hSelf, &pt, 1)) - return FALSE; - PATH_AddEntry(pPath, &pt, (i == 0) ? PT_MOVETO : - ((i == cbPoints-1) ? PT_LINETO | PT_CLOSEFIGURE : - PT_LINETO)); - } - return TRUE; + for(i = 0; i < cbPoints; i++) { + pt = pts[i]; + LPtoDP( dev->hdc, &pt, 1 ); + PATH_AddEntry(physdev->path, &pt, (i == 0) ? PT_MOVETO : + ((i == cbPoints-1) ? PT_LINETO | PT_CLOSEFIGURE : + PT_LINETO)); + } + return TRUE; }
-BOOL PATH_PolyPolygon( DC *dc, const POINT* pts, const INT* counts, - UINT polygons ) -{ - GdiPath *pPath = &dc->path; - POINT pt, startpt; - UINT poly, i; - INT point;
- /* Check that path is open */ - if(pPath->state!=PATH_Open) - return FALSE; - - for(i = 0, poly = 0; poly < polygons; poly++) { - for(point = 0; point < counts[poly]; point++, i++) { - pt = pts[i]; - if(!LPtoDP(dc->hSelf, &pt, 1)) - return FALSE; - if(point == 0) startpt = pt; - PATH_AddEntry(pPath, &pt, (point == 0) ? PT_MOVETO : PT_LINETO); - } - /* win98 adds an extra line to close the figure for some reason */ - PATH_AddEntry(pPath, &startpt, PT_LINETO | PT_CLOSEFIGURE); - } - return TRUE; +/************************************************************* + * pathdrv_PolyPolygon + */ +static BOOL pathdrv_PolyPolygon( PHYSDEV dev, const POINT* pts, const INT* counts, UINT polygons ) +{ + struct path_physdev *physdev = get_path_physdev( dev ); + POINT pt, startpt; + UINT poly, i; + INT point; + + for(i = 0, poly = 0; poly < polygons; poly++) { + for(point = 0; point < counts[poly]; point++, i++) { + pt = pts[i]; + LPtoDP( dev->hdc, &pt, 1 ); + if(point == 0) startpt = pt; + PATH_AddEntry(physdev->path, &pt, (point == 0) ? PT_MOVETO : PT_LINETO); + } + /* win98 adds an extra line to close the figure for some reason */ + PATH_AddEntry(physdev->path, &startpt, PT_LINETO | PT_CLOSEFIGURE); + } + return TRUE; }
BOOL PATH_PolyPolyline( DC *dc, const POINT* pts, const DWORD* counts, @@ -2362,9 +2358,9 @@ const struct gdi_dc_funcs path_driver = pathdrv_PolyBezier, /* pPolyBezier */ pathdrv_PolyBezierTo, /* pPolyBezierTo */ pathdrv_PolyDraw, /* pPolyDraw */ - NULL, /* pPolyPolygon */ + pathdrv_PolyPolygon, /* pPolyPolygon */ NULL, /* pPolyPolyline */ - NULL, /* pPolygon */ + pathdrv_Polygon, /* pPolygon */ NULL, /* pPolyline */ NULL, /* pPolylineTo */ NULL, /* pPutImage */