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

This commit is contained in:
Alexandre Julliard 2011-10-26 20:20:24 +02:00
parent d4889bef47
commit 613972efe5
3 changed files with 57 additions and 84 deletions

View File

@ -327,9 +327,6 @@ extern BOOL PATH_RestorePath( DC *dst, DC *src ) DECLSPEC_HIDDEN;
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_PolyPolyline(DC *dc, const POINT *pt, const DWORD *counts, DWORD polylines) DECLSPEC_HIDDEN;
/* painting.c */
extern POINT *GDI_Bezier( const POINT *Points, INT count, INT *nPtsOut ) DECLSPEC_HIDDEN;

View File

@ -727,14 +727,10 @@ BOOL WINAPI Polyline( HDC hdc, const POINT* pt, INT count )
DC * dc = get_dc_ptr( hdc );
if (dc)
{
update_dc( dc );
if (PATH_IsPathOpen(dc->path)) ret = PATH_Polyline(dc, pt, count);
else
{
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pPolyline );
update_dc( dc );
ret = physdev->funcs->pPolyline( physdev, pt, count );
}
release_dc_ptr( dc );
}
return ret;
@ -746,17 +742,15 @@ BOOL WINAPI Polyline( HDC hdc, const POINT* pt, INT count )
BOOL WINAPI PolylineTo( HDC hdc, const POINT* pt, DWORD cCount )
{
DC * dc = get_dc_ptr( hdc );
BOOL ret = FALSE;
PHYSDEV physdev;
BOOL ret;
if(!dc) return FALSE;
update_dc( dc );
if(PATH_IsPathOpen(dc->path)) ret = PATH_PolylineTo(dc, pt, cCount);
else
{
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pPolylineTo );
physdev = GET_DC_PHYSDEV( dc, pPolylineTo );
ret = physdev->funcs->pPolylineTo( physdev, pt, cCount );
}
if (ret && cCount)
{
dc->CursPosX = pt[cCount-1].x;
@ -815,14 +809,10 @@ BOOL WINAPI PolyPolyline( HDC hdc, const POINT* pt, const DWORD* counts,
DC * dc = get_dc_ptr( hdc );
if (dc)
{
update_dc( dc );
if (PATH_IsPathOpen(dc->path)) ret = PATH_PolyPolyline(dc, pt, counts, polylines);
else
{
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pPolyPolyline );
update_dc( dc );
ret = physdev->funcs->pPolyPolyline( physdev, pt, counts, polylines );
}
release_dc_ptr( dc );
}
return ret;

View File

@ -1321,52 +1321,40 @@ static BOOL pathdrv_PolyDraw( PHYSDEV dev, const POINT *pts, const BYTE *types,
return TRUE;
}
BOOL PATH_Polyline(DC *dc, const POINT *pts, DWORD cbPoints)
{
GdiPath *pPath = &dc->path;
POINT pt;
UINT i;
/* Check that path is open */
if(pPath->state!=PATH_Open)
return FALSE;
/*************************************************************
* pathdrv_Polyline
*/
static BOOL pathdrv_Polyline( PHYSDEV dev, const POINT *pts, INT cbPoints )
{
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 : PT_LINETO);
LPtoDP( dev->hdc, &pt, 1 );
PATH_AddEntry(physdev->path, &pt, (i == 0) ? PT_MOVETO : PT_LINETO);
}
return TRUE;
}
BOOL PATH_PolylineTo(DC *dc, const POINT *pts, DWORD cbPoints)
/*************************************************************
* pathdrv_PolylineTo
*/
static BOOL pathdrv_PolylineTo( PHYSDEV dev, const POINT *pts, INT cbPoints )
{
GdiPath *pPath = &dc->path;
struct path_physdev *physdev = get_path_physdev( dev );
POINT pt;
UINT i;
INT i;
/* Check that path is open */
if(pPath->state!=PATH_Open)
return FALSE;
/* Add a PT_MOVETO if necessary */
if(pPath->newStroke)
{
pPath->newStroke=FALSE;
pt.x = dc->CursPosX;
pt.y = dc->CursPosY;
if(!LPtoDP(dc->hSelf, &pt, 1))
return FALSE;
if(!PATH_AddEntry(pPath, &pt, PT_MOVETO))
return FALSE;
}
if (!start_new_stroke( physdev )) return FALSE;
for(i = 0; i < cbPoints; i++) {
pt = pts[i];
if(!LPtoDP(dc->hSelf, &pt, 1))
return FALSE;
PATH_AddEntry(pPath, &pt, PT_LINETO);
LPtoDP( dev->hdc, &pt, 1 );
PATH_AddEntry(physdev->path, &pt, PT_LINETO);
}
return TRUE;
@ -1416,23 +1404,21 @@ static BOOL pathdrv_PolyPolygon( PHYSDEV dev, const POINT* pts, const INT* count
return TRUE;
}
BOOL PATH_PolyPolyline( DC *dc, const POINT* pts, const DWORD* counts,
DWORD polylines )
/*************************************************************
* pathdrv_PolyPolyline
*/
static BOOL pathdrv_PolyPolyline( PHYSDEV dev, const POINT* pts, const DWORD* counts, DWORD polylines )
{
GdiPath *pPath = &dc->path;
struct path_physdev *physdev = get_path_physdev( dev );
POINT pt;
UINT poly, point, i;
/* Check that path is open */
if(pPath->state!=PATH_Open)
return FALSE;
for(i = 0, poly = 0; poly < polylines; poly++) {
for(point = 0; point < counts[poly]; point++, i++) {
pt = pts[i];
if(!LPtoDP(dc->hSelf, &pt, 1))
return FALSE;
PATH_AddEntry(pPath, &pt, (point == 0) ? PT_MOVETO : PT_LINETO);
LPtoDP( dev->hdc, &pt, 1 );
PATH_AddEntry(physdev->path, &pt, (point == 0) ? PT_MOVETO : PT_LINETO);
}
}
return TRUE;
@ -2359,10 +2345,10 @@ const struct gdi_dc_funcs path_driver =
pathdrv_PolyBezierTo, /* pPolyBezierTo */
pathdrv_PolyDraw, /* pPolyDraw */
pathdrv_PolyPolygon, /* pPolyPolygon */
NULL, /* pPolyPolyline */
pathdrv_PolyPolyline, /* pPolyPolyline */
pathdrv_Polygon, /* pPolygon */
NULL, /* pPolyline */
NULL, /* pPolylineTo */
pathdrv_Polyline, /* pPolyline */
pathdrv_PolylineTo, /* pPolylineTo */
NULL, /* pPutImage */
NULL, /* pRealizeDefaultPalette */
NULL, /* pRealizePalette */