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;
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;

View File

@ -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;

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;
POINT pt;
UINT i;
struct path_physdev *physdev = get_path_physdev( dev );
POINT pt;
INT i;
/* Check that path is open */
if(pPath->state!=PATH_Open)
return FALSE;
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 )
/*************************************************************
* pathdrv_PolyPolygon
*/
static BOOL pathdrv_PolyPolygon( PHYSDEV dev, const POINT* pts, const INT* counts, UINT polygons )
{
GdiPath *pPath = &dc->path;
POINT pt, startpt;
UINT poly, i;
INT point;
struct path_physdev *physdev = get_path_physdev( dev );
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;
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 */