Commit 680220c5 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

gdi32: Use NtGdiEllipse for Ellipse implementation.

parent b9f773de
......@@ -657,18 +657,6 @@ static BOOL CDECL emfpathdrv_DeleteDC( PHYSDEV dev )
}
/***********************************************************************
* emfpathdrv_Ellipse
*/
static BOOL CDECL emfpathdrv_Ellipse( PHYSDEV dev, INT x1, INT y1, INT x2, INT y2 )
{
PHYSDEV emfdev = get_emfdev( dev );
PHYSDEV next = GET_NEXT_PHYSDEV( dev, pEllipse );
return (emfdev->funcs->pEllipse( emfdev, x1, y1, x2, y2 ) &&
next->funcs->pEllipse( next, x1, y1, x2, y2 ));
}
/***********************************************************************
* emfpathdrv_EndPath
*/
static BOOL CDECL emfpathdrv_EndPath( PHYSDEV dev )
......@@ -834,7 +822,7 @@ static const struct gdi_dc_funcs emfpath_driver =
emfpathdrv_DeleteDC, /* pDeleteDC */
NULL, /* pDeleteObject */
NULL, /* pDeviceCapabilities */
emfpathdrv_Ellipse, /* pEllipse */
NULL, /* pEllipse */
NULL, /* pEndDoc */
NULL, /* pEndPage */
emfpathdrv_EndPath, /* pEndPath */
......
......@@ -373,37 +373,52 @@ BOOL CDECL EMFDRV_AngleArc( PHYSDEV dev, INT x, INT y, DWORD radius, FLOAT start
}
/***********************************************************************
* EMFDRV_Ellipse
* EMFDC_Ellipse
*/
BOOL CDECL EMFDRV_Ellipse( PHYSDEV dev, INT left, INT top, INT right, INT bottom )
BOOL EMFDC_Ellipse( 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;
EMRELLIPSE emr;
INT temp;
TRACE("%d,%d - %d,%d\n", left, top, right, bottom);
if (left == right || top == bottom) return FALSE;
if(left == right || top == bottom) return FALSE;
emr.emr.iType = EMR_ELLIPSE;
emr.emr.nSize = sizeof(emr);
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(left > right) {temp = left; left = right; right = temp;}
if(top > bottom) {temp = top; top = bottom; bottom = temp;}
return EMFDRV_WriteRecord( &emf->dev, &emr.emr );
}
if(dc->attr->graphics_mode == GM_COMPATIBLE) {
right--;
bottom--;
}
/***********************************************************************
* EMFDRV_Ellipse
*/
BOOL CDECL EMFDRV_Ellipse( PHYSDEV dev, INT left, INT top, INT right, INT bottom )
{
DC *dc = get_physdev_dc( dev );
RECTL bounds;
emr.emr.iType = EMR_ELLIPSE;
emr.emr.nSize = sizeof(emr);
emr.rclBox.left = left;
emr.rclBox.top = top;
emr.rclBox.right = right;
emr.rclBox.bottom = bottom;
if (left == right || top == bottom) return FALSE;
if(!physDev->path)
EMFDRV_UpdateBBox( dev, &emr.rclBox );
return EMFDRV_WriteRecord( dev, &emr.emr );
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;
}
/***********************************************************************
......
......@@ -46,6 +46,7 @@ extern BOOL METADC_Arc( HDC hdc, INT left, INT top, INT right, INT bottom,
INT xstart, INT ystart, INT xend, INT yend ) DECLSPEC_HIDDEN;
extern BOOL METADC_Chord( HDC hdc, INT left, INT top, INT right, INT bottom, INT xstart,
INT ystart, INT xend, INT yend ) DECLSPEC_HIDDEN;
extern BOOL METADC_Ellipse( HDC hdc, INT left, INT top, INT right, INT bottom ) DECLSPEC_HIDDEN;
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,
......@@ -55,6 +56,8 @@ extern BOOL METADC_Pie( HDC hdc, INT left, INT top, INT right, INT bottom,
extern BOOL EMFDC_ArcChordPie( DC_ATTR *dc_attr, INT left, INT top, INT right,
INT bottom, INT xstart, INT ystart, INT xend,
INT yend, DWORD type ) DECLSPEC_HIDDEN;
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;
......
......@@ -169,3 +169,18 @@ BOOL WINAPI Pie( HDC hdc, INT left, INT top, INT right, INT bottom,
return NtGdiArcInternal( NtGdiPie, hdc, left, top, right, bottom,
xstart, ystart, xend, yend );
}
/***********************************************************************
* Ellipse (GDI32.@)
*/
BOOL WINAPI Ellipse( 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_Ellipse( hdc, left, top, right, bottom );
if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
if (dc_attr->emf && !EMFDC_Ellipse( dc_attr, left, top, right, bottom )) return FALSE;
return NtGdiEllipse( hdc, left, top, right, bottom );
}
......@@ -90,11 +90,11 @@ BOOL METADC_Chord( HDC hdc, INT left, INT top, INT right, INT bottom,
}
/***********************************************************************
* MFDRV_Ellipse
* METADC_Ellipse
*/
BOOL CDECL MFDRV_Ellipse( PHYSDEV dev, INT left, INT top, INT right, INT bottom )
BOOL METADC_Ellipse( HDC hdc, INT left, INT top, INT right, INT bottom )
{
return MFDRV_MetaParam4(dev, META_ELLIPSE, left, top, right, bottom);
return metadc_param4( hdc, META_ELLIPSE, left, top, right, bottom );
}
/***********************************************************************
......
......@@ -114,7 +114,7 @@ static const struct gdi_dc_funcs MFDRV_Funcs =
MFDRV_DeleteDC, /* pDeleteDC */
MFDRV_DeleteObject, /* pDeleteObject */
NULL, /* pDeviceCapabilities */
MFDRV_Ellipse, /* pEllipse */
NULL, /* pEllipse */
NULL, /* pEndDoc */
NULL, /* pEndPage */
MFDRV_EndPath, /* pEndPath */
......@@ -614,6 +614,15 @@ BOOL metadc_param2( HDC hdc, short func, short param1, short param2 )
return MFDRV_MetaParam2( &dev->dev, func, param1, param2 );
}
BOOL metadc_param4( HDC hdc, short func, short param1, short param2,
short param3, short param4 )
{
METAFILEDRV_PDEVICE *dev;
if (!(dev = get_metadc_ptr( hdc ))) return FALSE;
return MFDRV_MetaParam4( &dev->dev, func, param1, param2, param3, param4 );
}
BOOL metadc_param8( HDC hdc, short func, short param1, short param2,
short param3, short param4, short param5,
short param6, short param7, short param8)
......
......@@ -60,6 +60,8 @@ extern BOOL MFDRV_RemoveHandle( PHYSDEV dev, UINT index ) DECLSPEC_HIDDEN;
extern INT16 MFDRV_CreateBrushIndirect( PHYSDEV dev, HBRUSH hBrush ) DECLSPEC_HIDDEN;
extern BOOL metadc_param2( HDC hdc, short func, short param1, short param2 ) DECLSPEC_HIDDEN;
extern BOOL metadc_param4( HDC hdc, short func, short param1, short param2,
short param3, short param4 ) DECLSPEC_HIDDEN;
extern BOOL metadc_param8( HDC hdc, short func, short param1, short param2,
short param3, short param4, short param5, short param6,
short param7, short param8 ) DECLSPEC_HIDDEN;
......@@ -72,7 +74,6 @@ extern BOOL CDECL MFDRV_ArcTo( PHYSDEV dev, INT left, INT top, INT right, INT bo
extern BOOL CDECL MFDRV_BeginPath( PHYSDEV dev ) DECLSPEC_HIDDEN;
extern BOOL CDECL MFDRV_CloseFigure( PHYSDEV dev ) DECLSPEC_HIDDEN;
extern BOOL CDECL MFDRV_DeleteObject( PHYSDEV dev, HGDIOBJ obj ) DECLSPEC_HIDDEN;
extern BOOL CDECL MFDRV_Ellipse( PHYSDEV dev, INT left, INT top, INT right, INT bottom ) DECLSPEC_HIDDEN;
extern BOOL CDECL MFDRV_EndPath( PHYSDEV dev ) DECLSPEC_HIDDEN;
extern INT CDECL MFDRV_ExcludeClipRect( PHYSDEV dev, INT left, INT top, INT right, INT bottom ) DECLSPEC_HIDDEN;
extern BOOL CDECL MFDRV_ExtFloodFill( PHYSDEV dev, INT x, INT y, COLORREF color, UINT fillType ) DECLSPEC_HIDDEN;
......
......@@ -339,17 +339,14 @@ BOOL WINAPI NtGdiArcInternal( UINT type, HDC hdc, INT left, INT top, INT right,
/***********************************************************************
* Ellipse (GDI32.@)
* NtGdiEllipse (win32u.@)
*/
BOOL WINAPI Ellipse( HDC hdc, INT left, INT top,
INT right, INT bottom )
BOOL WINAPI NtGdiEllipse( HDC hdc, INT left, INT top, INT right, INT bottom )
{
BOOL ret;
PHYSDEV physdev;
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, pEllipse );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment