gdi32: Implement the Rectangle and RoundRect entry points in the path driver.
This commit is contained in:
parent
364e216462
commit
f8040958f5
|
@ -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_SavePath( DC *dst, DC *src ) DECLSPEC_HIDDEN;
|
||||||
extern BOOL PATH_RestorePath( DC *dst, DC *src ) DECLSPEC_HIDDEN;
|
extern BOOL PATH_RestorePath( DC *dst, DC *src ) 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,
|
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_Ellipse(DC *dc, INT x1, INT y1, INT x2, INT y2) DECLSPEC_HIDDEN;
|
extern BOOL PATH_Ellipse(DC *dc, INT x1, INT y1, INT x2, INT y2) DECLSPEC_HIDDEN;
|
||||||
|
@ -339,7 +338,6 @@ extern BOOL PATH_Polyline(DC *dc, const POINT *pt, DWORD cbCount) DECLSPEC_HIDDE
|
||||||
extern BOOL PATH_Polygon(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;
|
extern BOOL PATH_PolyPolygon(DC *dc, const POINT *pt, const INT *counts, UINT polygons) DECLSPEC_HIDDEN;
|
||||||
extern BOOL PATH_RoundRect(DC *dc, INT x1, INT y1, INT x2, INT y2, INT ell_width, INT ell_height) 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;
|
||||||
|
|
|
@ -421,15 +421,10 @@ BOOL WINAPI Rectangle( HDC hdc, INT left, INT top,
|
||||||
DC * dc = get_dc_ptr( hdc );
|
DC * dc = get_dc_ptr( hdc );
|
||||||
|
|
||||||
if (dc)
|
if (dc)
|
||||||
{
|
|
||||||
update_dc( dc );
|
|
||||||
if(PATH_IsPathOpen(dc->path))
|
|
||||||
ret = PATH_Rectangle(dc, left, top, right, bottom);
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pRectangle );
|
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pRectangle );
|
||||||
|
update_dc( dc );
|
||||||
ret = physdev->funcs->pRectangle( physdev, left, top, right, bottom );
|
ret = physdev->funcs->pRectangle( physdev, left, top, right, bottom );
|
||||||
}
|
|
||||||
release_dc_ptr( dc );
|
release_dc_ptr( dc );
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -446,15 +441,10 @@ BOOL WINAPI RoundRect( HDC hdc, INT left, INT top, INT right,
|
||||||
DC *dc = get_dc_ptr( hdc );
|
DC *dc = get_dc_ptr( hdc );
|
||||||
|
|
||||||
if (dc)
|
if (dc)
|
||||||
{
|
|
||||||
update_dc( dc );
|
|
||||||
if(PATH_IsPathOpen(dc->path))
|
|
||||||
ret = PATH_RoundRect(dc,left,top,right,bottom,ell_width,ell_height);
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pRoundRect );
|
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pRoundRect );
|
||||||
|
update_dc( dc );
|
||||||
ret = physdev->funcs->pRoundRect( physdev, left, top, right, bottom, ell_width, ell_height );
|
ret = physdev->funcs->pRoundRect( physdev, left, top, right, bottom, ell_width, ell_height );
|
||||||
}
|
|
||||||
release_dc_ptr( dc );
|
release_dc_ptr( dc );
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -273,9 +273,9 @@ static BOOL PATH_AssignGdiPath(GdiPath *pPathDest, const GdiPath *pPathSrc)
|
||||||
|
|
||||||
/* PATH_CheckCorners
|
/* PATH_CheckCorners
|
||||||
*
|
*
|
||||||
* Helper function for PATH_RoundRect() and PATH_Rectangle()
|
* Helper function for RoundRect() and Rectangle()
|
||||||
*/
|
*/
|
||||||
static BOOL PATH_CheckCorners(DC *dc, POINT corners[], INT x1, INT y1, INT x2, INT y2)
|
static void PATH_CheckCorners( HDC hdc, POINT corners[], INT x1, INT y1, INT x2, INT y2 )
|
||||||
{
|
{
|
||||||
INT temp;
|
INT temp;
|
||||||
|
|
||||||
|
@ -284,8 +284,7 @@ static BOOL PATH_CheckCorners(DC *dc, POINT corners[], INT x1, INT y1, INT x2, I
|
||||||
corners[0].y=y1;
|
corners[0].y=y1;
|
||||||
corners[1].x=x2;
|
corners[1].x=x2;
|
||||||
corners[1].y=y2;
|
corners[1].y=y2;
|
||||||
if(!LPtoDP(dc->hSelf, corners, 2))
|
LPtoDP( hdc, corners, 2 );
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
/* Make sure first corner is top left and second corner is bottom right */
|
/* Make sure first corner is top left and second corner is bottom right */
|
||||||
if(corners[0].x>corners[1].x)
|
if(corners[0].x>corners[1].x)
|
||||||
|
@ -302,13 +301,11 @@ static BOOL PATH_CheckCorners(DC *dc, POINT corners[], INT x1, INT y1, INT x2, I
|
||||||
}
|
}
|
||||||
|
|
||||||
/* In GM_COMPATIBLE, don't include bottom and right edges */
|
/* In GM_COMPATIBLE, don't include bottom and right edges */
|
||||||
if(dc->GraphicsMode==GM_COMPATIBLE)
|
if (GetGraphicsMode( hdc ) == GM_COMPATIBLE)
|
||||||
{
|
{
|
||||||
corners[1].x--;
|
corners[1].x--;
|
||||||
corners[1].y--;
|
corners[1].y--;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* PATH_AddFlatBezier
|
/* PATH_AddFlatBezier
|
||||||
|
@ -926,115 +923,85 @@ static BOOL pathdrv_LineTo( PHYSDEV dev, INT x, INT y )
|
||||||
return PATH_AddEntry(physdev->path, &point, PT_LINETO);
|
return PATH_AddEntry(physdev->path, &point, PT_LINETO);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* PATH_RoundRect
|
|
||||||
*
|
/*************************************************************
|
||||||
* Should be called when a call to RoundRect is performed on a DC that has
|
* pathdrv_RoundRect
|
||||||
* an open path. Returns TRUE if successful, else FALSE.
|
|
||||||
*
|
*
|
||||||
* FIXME: it adds the same entries to the path as windows does, but there
|
* FIXME: it adds the same entries to the path as windows does, but there
|
||||||
* is an error in the bezier drawing code so that there are small pixel-size
|
* is an error in the bezier drawing code so that there are small pixel-size
|
||||||
* gaps when the resulting path is drawn by StrokePath()
|
* gaps when the resulting path is drawn by StrokePath()
|
||||||
*/
|
*/
|
||||||
BOOL PATH_RoundRect(DC *dc, INT x1, INT y1, INT x2, INT y2, INT ell_width, INT ell_height)
|
static BOOL pathdrv_RoundRect( PHYSDEV dev, INT x1, INT y1, INT x2, INT y2, INT ell_width, INT ell_height )
|
||||||
{
|
{
|
||||||
GdiPath *pPath = &dc->path;
|
struct path_physdev *physdev = get_path_physdev( dev );
|
||||||
POINT corners[2], pointTemp;
|
POINT corners[2], pointTemp;
|
||||||
FLOAT_POINT ellCorners[2];
|
FLOAT_POINT ellCorners[2];
|
||||||
|
|
||||||
/* Check that path is open */
|
PATH_CheckCorners(dev->hdc,corners,x1,y1,x2,y2);
|
||||||
if(pPath->state!=PATH_Open)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
if(!PATH_CheckCorners(dc,corners,x1,y1,x2,y2))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
/* Add points to the roundrect path */
|
/* Add points to the roundrect path */
|
||||||
ellCorners[0].x = corners[1].x-ell_width;
|
ellCorners[0].x = corners[1].x-ell_width;
|
||||||
ellCorners[0].y = corners[0].y;
|
ellCorners[0].y = corners[0].y;
|
||||||
ellCorners[1].x = corners[1].x;
|
ellCorners[1].x = corners[1].x;
|
||||||
ellCorners[1].y = corners[0].y+ell_height;
|
ellCorners[1].y = corners[0].y+ell_height;
|
||||||
if(!PATH_DoArcPart(pPath, ellCorners, 0, -M_PI_2, PT_MOVETO))
|
if(!PATH_DoArcPart(physdev->path, ellCorners, 0, -M_PI_2, PT_MOVETO))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
pointTemp.x = corners[0].x+ell_width/2;
|
pointTemp.x = corners[0].x+ell_width/2;
|
||||||
pointTemp.y = corners[0].y;
|
pointTemp.y = corners[0].y;
|
||||||
if(!PATH_AddEntry(pPath, &pointTemp, PT_LINETO))
|
if(!PATH_AddEntry(physdev->path, &pointTemp, PT_LINETO))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
ellCorners[0].x = corners[0].x;
|
ellCorners[0].x = corners[0].x;
|
||||||
ellCorners[1].x = corners[0].x+ell_width;
|
ellCorners[1].x = corners[0].x+ell_width;
|
||||||
if(!PATH_DoArcPart(pPath, ellCorners, -M_PI_2, -M_PI, FALSE))
|
if(!PATH_DoArcPart(physdev->path, ellCorners, -M_PI_2, -M_PI, FALSE))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
pointTemp.x = corners[0].x;
|
pointTemp.x = corners[0].x;
|
||||||
pointTemp.y = corners[1].y-ell_height/2;
|
pointTemp.y = corners[1].y-ell_height/2;
|
||||||
if(!PATH_AddEntry(pPath, &pointTemp, PT_LINETO))
|
if(!PATH_AddEntry(physdev->path, &pointTemp, PT_LINETO))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
ellCorners[0].y = corners[1].y-ell_height;
|
ellCorners[0].y = corners[1].y-ell_height;
|
||||||
ellCorners[1].y = corners[1].y;
|
ellCorners[1].y = corners[1].y;
|
||||||
if(!PATH_DoArcPart(pPath, ellCorners, M_PI, M_PI_2, FALSE))
|
if(!PATH_DoArcPart(physdev->path, ellCorners, M_PI, M_PI_2, FALSE))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
pointTemp.x = corners[1].x-ell_width/2;
|
pointTemp.x = corners[1].x-ell_width/2;
|
||||||
pointTemp.y = corners[1].y;
|
pointTemp.y = corners[1].y;
|
||||||
if(!PATH_AddEntry(pPath, &pointTemp, PT_LINETO))
|
if(!PATH_AddEntry(physdev->path, &pointTemp, PT_LINETO))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
ellCorners[0].x = corners[1].x-ell_width;
|
ellCorners[0].x = corners[1].x-ell_width;
|
||||||
ellCorners[1].x = corners[1].x;
|
ellCorners[1].x = corners[1].x;
|
||||||
if(!PATH_DoArcPart(pPath, ellCorners, M_PI_2, 0, FALSE))
|
if(!PATH_DoArcPart(physdev->path, ellCorners, M_PI_2, 0, FALSE))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* Close the roundrect figure */
|
/* Close the roundrect figure */
|
||||||
if(!CloseFigure(dc->hSelf))
|
return CloseFigure( dev->hdc );
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* PATH_Rectangle
|
|
||||||
*
|
/*************************************************************
|
||||||
* Should be called when a call to Rectangle is performed on a DC that has
|
* pathdrv_Rectangle
|
||||||
* an open path. Returns TRUE if successful, else FALSE.
|
|
||||||
*/
|
*/
|
||||||
BOOL PATH_Rectangle(DC *dc, INT x1, INT y1, INT x2, INT y2)
|
static BOOL pathdrv_Rectangle( PHYSDEV dev, INT x1, INT y1, INT x2, INT y2 )
|
||||||
{
|
{
|
||||||
GdiPath *pPath = &dc->path;
|
struct path_physdev *physdev = get_path_physdev( dev );
|
||||||
POINT corners[2], pointTemp;
|
POINT corners[2], pointTemp;
|
||||||
|
|
||||||
/* Check that path is open */
|
PATH_CheckCorners(dev->hdc,corners,x1,y1,x2,y2);
|
||||||
if(pPath->state!=PATH_Open)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
if(!PATH_CheckCorners(dc,corners,x1,y1,x2,y2))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
/* Close any previous figure */
|
|
||||||
if(!CloseFigure(dc->hSelf))
|
|
||||||
{
|
|
||||||
/* The CloseFigure call shouldn't have failed */
|
|
||||||
assert(FALSE);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Add four points to the path */
|
/* Add four points to the path */
|
||||||
pointTemp.x=corners[1].x;
|
pointTemp.x=corners[1].x;
|
||||||
pointTemp.y=corners[0].y;
|
pointTemp.y=corners[0].y;
|
||||||
if(!PATH_AddEntry(pPath, &pointTemp, PT_MOVETO))
|
if(!PATH_AddEntry(physdev->path, &pointTemp, PT_MOVETO))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if(!PATH_AddEntry(pPath, corners, PT_LINETO))
|
if(!PATH_AddEntry(physdev->path, corners, PT_LINETO))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
pointTemp.x=corners[0].x;
|
pointTemp.x=corners[0].x;
|
||||||
pointTemp.y=corners[1].y;
|
pointTemp.y=corners[1].y;
|
||||||
if(!PATH_AddEntry(pPath, &pointTemp, PT_LINETO))
|
if(!PATH_AddEntry(physdev->path, &pointTemp, PT_LINETO))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if(!PATH_AddEntry(pPath, corners+1, PT_LINETO))
|
if(!PATH_AddEntry(physdev->path, corners+1, PT_LINETO))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* Close the rectangle figure */
|
/* Close the rectangle figure */
|
||||||
if(!CloseFigure(dc->hSelf))
|
return CloseFigure( dev->hdc );
|
||||||
{
|
|
||||||
/* The CloseFigure call shouldn't have failed */
|
|
||||||
assert(FALSE);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* PATH_Ellipse
|
/* PATH_Ellipse
|
||||||
|
@ -2373,10 +2340,10 @@ const struct gdi_dc_funcs path_driver =
|
||||||
NULL, /* pPutImage */
|
NULL, /* pPutImage */
|
||||||
NULL, /* pRealizeDefaultPalette */
|
NULL, /* pRealizeDefaultPalette */
|
||||||
NULL, /* pRealizePalette */
|
NULL, /* pRealizePalette */
|
||||||
NULL, /* pRectangle */
|
pathdrv_Rectangle, /* pRectangle */
|
||||||
NULL, /* pResetDC */
|
NULL, /* pResetDC */
|
||||||
NULL, /* pRestoreDC */
|
NULL, /* pRestoreDC */
|
||||||
NULL, /* pRoundRect */
|
pathdrv_RoundRect, /* pRoundRect */
|
||||||
NULL, /* pSaveDC */
|
NULL, /* pSaveDC */
|
||||||
NULL, /* pScaleViewportExt */
|
NULL, /* pScaleViewportExt */
|
||||||
NULL, /* pScaleWindowExt */
|
NULL, /* pScaleWindowExt */
|
||||||
|
|
Loading…
Reference in New Issue