gdi32: Use NtGdiRectangle for Rectangle implementation.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
ffaf75a082
commit
0636b36013
|
@ -779,18 +779,6 @@ static BOOL CDECL emfpathdrv_PolylineTo( PHYSDEV dev, const POINT *pts, INT coun
|
|||
next->funcs->pPolylineTo( next, pts, count ));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* emfpathdrv_Rectangle
|
||||
*/
|
||||
static BOOL CDECL emfpathdrv_Rectangle( PHYSDEV dev, INT x1, INT y1, INT x2, INT y2 )
|
||||
{
|
||||
PHYSDEV emfdev = get_emfdev( dev );
|
||||
PHYSDEV next = GET_NEXT_PHYSDEV( dev, pRectangle );
|
||||
|
||||
return (emfdev->funcs->pRectangle( emfdev, x1, y1, x2, y2 ) &&
|
||||
next->funcs->pRectangle( next, x1, y1, x2, y2 ));
|
||||
}
|
||||
|
||||
|
||||
static const struct gdi_dc_funcs emfpath_driver =
|
||||
{
|
||||
|
@ -874,7 +862,7 @@ static const struct gdi_dc_funcs emfpath_driver =
|
|||
NULL, /* pPutImage */
|
||||
NULL, /* pRealizeDefaultPalette */
|
||||
NULL, /* pRealizePalette */
|
||||
emfpathdrv_Rectangle, /* pRectangle */
|
||||
NULL, /* pRectangle */
|
||||
NULL, /* pResetDC */
|
||||
NULL, /* pRestoreDC */
|
||||
NULL, /* pRoundRect */
|
||||
|
|
|
@ -422,37 +422,52 @@ BOOL CDECL EMFDRV_Ellipse( PHYSDEV dev, INT left, INT top, INT right, INT bottom
|
|||
}
|
||||
|
||||
/***********************************************************************
|
||||
* EMFDRV_Rectangle
|
||||
* EMFDC_Rectangle
|
||||
*/
|
||||
BOOL CDECL EMFDRV_Rectangle(PHYSDEV dev, INT left, INT top, INT right, INT bottom)
|
||||
BOOL EMFDC_Rectangle( DC_ATTR *dc_attr, INT left, INT top, INT right, INT bottom )
|
||||
{
|
||||
EMFDRV_PDEVICE *physDev = get_emf_physdev( dev );
|
||||
DC *dc = get_physdev_dc( dev );
|
||||
EMFDRV_PDEVICE *emf = dc_attr->emf;
|
||||
EMRRECTANGLE emr;
|
||||
INT temp;
|
||||
|
||||
TRACE("%d,%d - %d,%d\n", left, top, right, bottom);
|
||||
|
||||
if(left == right || top == bottom) return FALSE;
|
||||
|
||||
if(left > right) {temp = left; left = right; right = temp;}
|
||||
if(top > bottom) {temp = top; top = bottom; bottom = temp;}
|
||||
|
||||
if(dc->attr->graphics_mode == GM_COMPATIBLE) {
|
||||
right--;
|
||||
bottom--;
|
||||
}
|
||||
|
||||
emr.emr.iType = EMR_RECTANGLE;
|
||||
emr.emr.nSize = sizeof(emr);
|
||||
emr.rclBox.left = left;
|
||||
emr.rclBox.top = top;
|
||||
emr.rclBox.right = right;
|
||||
emr.rclBox.bottom = bottom;
|
||||
emr.rclBox.left = min( left, right );
|
||||
emr.rclBox.top = min( top, bottom );
|
||||
emr.rclBox.right = max( left, right );
|
||||
emr.rclBox.bottom = max( top, bottom );
|
||||
if (dc_attr->graphics_mode == GM_COMPATIBLE)
|
||||
{
|
||||
emr.rclBox.right--;
|
||||
emr.rclBox.bottom--;
|
||||
}
|
||||
|
||||
if(!physDev->path)
|
||||
EMFDRV_UpdateBBox( dev, &emr.rclBox );
|
||||
return EMFDRV_WriteRecord( dev, &emr.emr );
|
||||
return EMFDRV_WriteRecord( &emf->dev, &emr.emr );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* EMFDC_Rectangle
|
||||
*/
|
||||
BOOL EMFDRV_Rectangle( PHYSDEV dev, INT left, INT top, INT right, INT bottom )
|
||||
{
|
||||
DC *dc = get_physdev_dc( dev );
|
||||
RECTL bounds;
|
||||
|
||||
if (left == right || top == bottom) return FALSE;
|
||||
|
||||
bounds.left = min( left, right );
|
||||
bounds.top = min( top, bottom );
|
||||
bounds.right = max( left, right );
|
||||
bounds.bottom = max( top, bottom );
|
||||
if (dc->attr->graphics_mode == GM_COMPATIBLE)
|
||||
{
|
||||
bounds.right--;
|
||||
bounds.bottom--;
|
||||
}
|
||||
|
||||
EMFDRV_UpdateBBox( dev, &bounds );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
|
|
@ -51,6 +51,7 @@ extern BOOL METADC_LineTo( HDC hdc, INT x, INT y ) DECLSPEC_HIDDEN;
|
|||
extern BOOL METADC_MoveTo( HDC hdc, INT x, INT y ) DECLSPEC_HIDDEN;
|
||||
extern BOOL METADC_Pie( HDC hdc, INT left, INT top, INT right, INT bottom,
|
||||
INT xstart, INT ystart, INT xend, INT yend ) DECLSPEC_HIDDEN;
|
||||
extern BOOL METADC_Rectangle( HDC hdc, INT left, INT top, INT right, INT bottom) DECLSPEC_HIDDEN;
|
||||
extern BOOL METADC_RoundRect( HDC hdc, INT left, INT top, INT right, INT bottom,
|
||||
INT ell_width, INT ell_height ) DECLSPEC_HIDDEN;
|
||||
|
||||
|
@ -62,6 +63,8 @@ extern BOOL EMFDC_Ellipse( DC_ATTR *dc_attr, INT left, INT top, INT right,
|
|||
INT bottom ) DECLSPEC_HIDDEN;
|
||||
extern BOOL EMFDC_LineTo( DC_ATTR *dc_attr, INT x, INT y ) DECLSPEC_HIDDEN;
|
||||
extern BOOL EMFDC_MoveTo( DC_ATTR *dc_attr, INT x, INT y ) DECLSPEC_HIDDEN;
|
||||
extern BOOL EMFDC_Rectangle( DC_ATTR *dc_attr, INT left, INT top, INT right,
|
||||
INT bottom) DECLSPEC_HIDDEN;
|
||||
extern BOOL EMFDC_RoundRect( DC_ATTR *dc_attr, INT left, INT top, INT right, INT bottom,
|
||||
INT ell_width, INT ell_height ) DECLSPEC_HIDDEN;
|
||||
|
||||
|
|
|
@ -185,6 +185,21 @@ BOOL WINAPI Ellipse( HDC hdc, INT left, INT top, INT right, INT bottom )
|
|||
return NtGdiEllipse( hdc, left, top, right, bottom );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* Rectangle (GDI32.@)
|
||||
*/
|
||||
BOOL WINAPI Rectangle( HDC hdc, INT left, INT top, INT right, INT bottom )
|
||||
{
|
||||
DC_ATTR *dc_attr;
|
||||
|
||||
TRACE( "%p, (%d, %d)-(%d, %d)\n", hdc, left, top, right, bottom );
|
||||
|
||||
if (is_meta_dc( hdc )) return METADC_Rectangle( hdc, left, top, right, bottom );
|
||||
if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
|
||||
if (dc_attr->emf && !EMFDC_Rectangle( dc_attr, left, top, right, bottom )) return FALSE;
|
||||
return NtGdiRectangle( hdc, left, top, right, bottom );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* RoundRect (GDI32.@)
|
||||
*/
|
||||
|
|
|
@ -98,11 +98,11 @@ BOOL METADC_Ellipse( HDC hdc, INT left, INT top, INT right, INT bottom )
|
|||
}
|
||||
|
||||
/***********************************************************************
|
||||
* MFDRV_Rectangle
|
||||
* METADC_Rectangle
|
||||
*/
|
||||
BOOL CDECL MFDRV_Rectangle(PHYSDEV dev, INT left, INT top, INT right, INT bottom)
|
||||
BOOL METADC_Rectangle( HDC hdc, INT left, INT top, INT right, INT bottom )
|
||||
{
|
||||
return MFDRV_MetaParam4(dev, META_RECTANGLE, left, top, right, bottom);
|
||||
return metadc_param4( hdc, META_RECTANGLE, left, top, right, bottom );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
|
|
@ -179,7 +179,7 @@ static const struct gdi_dc_funcs MFDRV_Funcs =
|
|||
NULL, /* pPutImage */
|
||||
NULL, /* pRealizeDefaultPalette */
|
||||
MFDRV_RealizePalette, /* pRealizePalette */
|
||||
MFDRV_Rectangle, /* pRectangle */
|
||||
NULL, /* pRectangle */
|
||||
NULL, /* pResetDC */
|
||||
MFDRV_RestoreDC, /* pRestoreDC */
|
||||
NULL, /* pRoundRect */
|
||||
|
|
|
@ -98,7 +98,6 @@ extern BOOL CDECL MFDRV_PolyBezierTo( PHYSDEV dev, const POINT* pt, DWORD count
|
|||
extern BOOL CDECL MFDRV_PolyPolygon( PHYSDEV dev, const POINT* pt, const INT* counts, UINT polygons) DECLSPEC_HIDDEN;
|
||||
extern BOOL CDECL MFDRV_Polygon( PHYSDEV dev, const POINT* pt, INT count ) DECLSPEC_HIDDEN;
|
||||
extern BOOL CDECL MFDRV_Polyline( PHYSDEV dev, const POINT* pt,INT count) DECLSPEC_HIDDEN;
|
||||
extern BOOL CDECL MFDRV_Rectangle( PHYSDEV dev, INT left, INT top, INT right, INT bottom) DECLSPEC_HIDDEN;
|
||||
extern BOOL CDECL MFDRV_RestoreDC( PHYSDEV dev, INT level ) DECLSPEC_HIDDEN;
|
||||
extern INT CDECL MFDRV_SaveDC( PHYSDEV dev ) DECLSPEC_HIDDEN;
|
||||
extern BOOL CDECL MFDRV_ScaleViewportExtEx( PHYSDEV dev, INT xNum, INT xDenom, INT yNum, INT yDenom, SIZE *size ) DECLSPEC_HIDDEN;
|
||||
|
|
|
@ -357,17 +357,14 @@ BOOL WINAPI NtGdiEllipse( HDC hdc, INT left, INT top, INT right, INT bottom )
|
|||
|
||||
|
||||
/***********************************************************************
|
||||
* Rectangle (GDI32.@)
|
||||
* NtGdiRectangle (win32u.@)
|
||||
*/
|
||||
BOOL WINAPI Rectangle( HDC hdc, INT left, INT top,
|
||||
INT right, INT bottom )
|
||||
BOOL WINAPI NtGdiRectangle( HDC hdc, INT left, INT top, INT right, INT bottom )
|
||||
{
|
||||
PHYSDEV physdev;
|
||||
BOOL ret;
|
||||
DC * dc = get_dc_ptr( hdc );
|
||||
|
||||
TRACE( "%p, (%d, %d)-(%d, %d)\n", hdc, left, top, right, bottom );
|
||||
|
||||
if (!dc) return FALSE;
|
||||
update_dc( dc );
|
||||
physdev = GET_DC_PHYSDEV( dc, pRectangle );
|
||||
|
|
Loading…
Reference in New Issue