gdi32: Implement the LineTo entry point in the path driver.

This commit is contained in:
Alexandre Julliard 2011-10-26 19:58:51 +02:00
parent 2c1ec7fc3b
commit fc5e29486d
3 changed files with 26 additions and 40 deletions

View File

@ -325,7 +325,6 @@ extern void PATH_DestroyGdiPath(GdiPath *pPath) DECLSPEC_HIDDEN;
extern BOOL PATH_SavePath( DC *dst, DC *src ) DECLSPEC_HIDDEN;
extern BOOL PATH_RestorePath( DC *dst, DC *src ) DECLSPEC_HIDDEN;
extern BOOL PATH_LineTo(DC *dc, INT x, INT y) DECLSPEC_HIDDEN;
extern BOOL PATH_Rectangle(DC *dc, INT x1, INT y1, INT x2, INT y2) 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;

View File

@ -232,18 +232,15 @@ BOOL nulldrv_PolylineTo( PHYSDEV dev, const POINT *points, INT count )
BOOL WINAPI LineTo( HDC hdc, INT x, INT y )
{
DC * dc = get_dc_ptr( hdc );
PHYSDEV physdev;
BOOL ret;
if(!dc) return FALSE;
update_dc( dc );
if(PATH_IsPathOpen(dc->path))
ret = PATH_LineTo(dc, x, y);
else
{
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pLineTo );
ret = physdev->funcs->pLineTo( physdev, x, y );
}
physdev = GET_DC_PHYSDEV( dc, pLineTo );
ret = physdev->funcs->pLineTo( physdev, x, y );
if(ret) {
dc->CursPosX = x;
dc->CursPosY = y;

View File

@ -895,42 +895,32 @@ static BOOL pathdrv_MoveTo( PHYSDEV dev, INT x, INT y )
return TRUE;
}
/* PATH_LineTo
*
* Should be called when a LineTo is performed on a DC that has an
* open path. This adds a PT_LINETO entry to the path (and possibly
* a PT_MOVETO entry, if this is the first LineTo in a stroke).
* Returns TRUE if successful, else FALSE.
/*************************************************************
* pathdrv_LineTo
*/
BOOL PATH_LineTo(DC *dc, INT x, INT y)
static BOOL pathdrv_LineTo( PHYSDEV dev, INT x, INT y )
{
GdiPath *pPath = &dc->path;
POINT point, pointCurPos;
struct path_physdev *physdev = get_path_physdev( dev );
POINT point, pointCurPos;
/* Check that path is open */
if(pPath->state!=PATH_Open)
return FALSE;
/* Convert point to device coordinates */
point.x = x;
point.y = y;
LPtoDP( dev->hdc, &point, 1 );
/* Convert point to device coordinates */
point.x=x;
point.y=y;
if(!LPtoDP(dc->hSelf, &point, 1))
return FALSE;
/* Add a PT_MOVETO if necessary */
if(physdev->path->newStroke)
{
physdev->path->newStroke = FALSE;
GetCurrentPositionEx( dev->hdc, &pointCurPos );
LPtoDP( dev->hdc, &pointCurPos, 1 );
if(!PATH_AddEntry(physdev->path, &pointCurPos, PT_MOVETO))
return FALSE;
}
/* Add a PT_MOVETO if necessary */
if(pPath->newStroke)
{
pPath->newStroke=FALSE;
pointCurPos.x = dc->CursPosX;
pointCurPos.y = dc->CursPosY;
if(!LPtoDP(dc->hSelf, &pointCurPos, 1))
return FALSE;
if(!PATH_AddEntry(pPath, &pointCurPos, PT_MOVETO))
return FALSE;
}
/* Add a PT_LINETO entry */
return PATH_AddEntry(pPath, &point, PT_LINETO);
/* Add a PT_LINETO entry */
return PATH_AddEntry(physdev->path, &point, PT_LINETO);
}
/* PATH_RoundRect
@ -2360,7 +2350,7 @@ const struct gdi_dc_funcs path_driver =
NULL, /* pGetTextMetrics */
NULL, /* pIntersectClipRect */
NULL, /* pInvertRgn */
NULL, /* pLineTo */
pathdrv_LineTo, /* pLineTo */
NULL, /* pModifyWorldTransform */
pathdrv_MoveTo, /* pMoveTo */
NULL, /* pOffsetClipRgn */