gdi32: Implement the polygon entry points in the path driver.

This commit is contained in:
Alexandre Julliard 2011-10-25 15:40:42 +02:00
parent ac00dfc984
commit d4889bef47
3 changed files with 41 additions and 55 deletions

View File

@ -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; 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_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_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_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 */ /* painting.c */
extern POINT *GDI_Bezier( const POINT *Points, INT count, INT *nPtsOut ) DECLSPEC_HIDDEN; extern POINT *GDI_Bezier( const POINT *Points, INT count, INT *nPtsOut ) DECLSPEC_HIDDEN;

View File

@ -777,13 +777,9 @@ BOOL WINAPI Polygon( HDC hdc, const POINT* pt, INT count )
if (dc) if (dc)
{ {
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pPolygon );
update_dc( dc ); update_dc( dc );
if (PATH_IsPathOpen(dc->path)) ret = PATH_Polygon(dc, pt, count); ret = physdev->funcs->pPolygon( physdev, pt, count );
else
{
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pPolygon );
ret = physdev->funcs->pPolygon( physdev, pt, count );
}
release_dc_ptr( dc ); release_dc_ptr( dc );
} }
return ret; return ret;
@ -801,13 +797,9 @@ BOOL WINAPI PolyPolygon( HDC hdc, const POINT* pt, const INT* counts,
if (dc) if (dc)
{ {
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pPolyPolygon );
update_dc( dc ); update_dc( dc );
if (PATH_IsPathOpen(dc->path)) ret = PATH_PolyPolygon(dc, pt, counts, polygons); ret = physdev->funcs->pPolyPolygon( physdev, pt, counts, polygons );
else
{
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pPolyPolygon );
ret = physdev->funcs->pPolyPolygon( physdev, pt, counts, polygons );
}
release_dc_ptr( dc ); release_dc_ptr( dc );
} }
return ret; return ret;

View File

@ -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; struct path_physdev *physdev = get_path_physdev( dev );
POINT pt; POINT pt;
UINT i; INT i;
/* Check that path is open */ for(i = 0; i < cbPoints; i++) {
if(pPath->state!=PATH_Open) pt = pts[i];
return FALSE; LPtoDP( dev->hdc, &pt, 1 );
PATH_AddEntry(physdev->path, &pt, (i == 0) ? PT_MOVETO :
for(i = 0; i < cbPoints; i++) { ((i == cbPoints-1) ? PT_LINETO | PT_CLOSEFIGURE :
pt = pts[i]; PT_LINETO));
if(!LPtoDP(dc->hSelf, &pt, 1)) }
return FALSE; return TRUE;
PATH_AddEntry(pPath, &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 ) /*************************************************************
* pathdrv_PolyPolygon
*/
static BOOL pathdrv_PolyPolygon( PHYSDEV dev, const POINT* pts, const INT* counts, UINT polygons )
{ {
GdiPath *pPath = &dc->path; struct path_physdev *physdev = get_path_physdev( dev );
POINT pt, startpt; POINT pt, startpt;
UINT poly, i; UINT poly, i;
INT point; INT point;
/* Check that path is open */ for(i = 0, poly = 0; poly < polygons; poly++) {
if(pPath->state!=PATH_Open) for(point = 0; point < counts[poly]; point++, i++) {
return FALSE; pt = pts[i];
LPtoDP( dev->hdc, &pt, 1 );
for(i = 0, poly = 0; poly < polygons; poly++) { if(point == 0) startpt = pt;
for(point = 0; point < counts[poly]; point++, i++) { PATH_AddEntry(physdev->path, &pt, (point == 0) ? PT_MOVETO : PT_LINETO);
pt = pts[i]; }
if(!LPtoDP(dc->hSelf, &pt, 1)) /* win98 adds an extra line to close the figure for some reason */
return FALSE; PATH_AddEntry(physdev->path, &startpt, PT_LINETO | PT_CLOSEFIGURE);
if(point == 0) startpt = pt; }
PATH_AddEntry(pPath, &pt, (point == 0) ? PT_MOVETO : PT_LINETO); return TRUE;
}
/* win98 adds an extra line to close the figure for some reason */
PATH_AddEntry(pPath, &startpt, PT_LINETO | PT_CLOSEFIGURE);
}
return TRUE;
} }
BOOL PATH_PolyPolyline( DC *dc, const POINT* pts, const DWORD* counts, 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_PolyBezier, /* pPolyBezier */
pathdrv_PolyBezierTo, /* pPolyBezierTo */ pathdrv_PolyBezierTo, /* pPolyBezierTo */
pathdrv_PolyDraw, /* pPolyDraw */ pathdrv_PolyDraw, /* pPolyDraw */
NULL, /* pPolyPolygon */ pathdrv_PolyPolygon, /* pPolyPolygon */
NULL, /* pPolyPolyline */ NULL, /* pPolyPolyline */
NULL, /* pPolygon */ pathdrv_Polygon, /* pPolygon */
NULL, /* pPolyline */ NULL, /* pPolyline */
NULL, /* pPolylineTo */ NULL, /* pPolylineTo */
NULL, /* pPutImage */ NULL, /* pPutImage */