gdi32: Use NtGdiPolyPolyDraw for PolyBezier 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:
Jacek Caban 2021-07-22 11:27:07 +02:00 committed by Alexandre Julliard
parent 1f5cc0e5ef
commit 5be1b7c75b
5 changed files with 37 additions and 49 deletions

View File

@ -671,18 +671,6 @@ static BOOL CDECL emfpathdrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags,
next->funcs->pExtTextOut( next, x, y, flags, rect, str, count, dx ));
}
/***********************************************************************
* emfpathdrv_PolyBezier
*/
static BOOL CDECL emfpathdrv_PolyBezier( PHYSDEV dev, const POINT *pts, DWORD count )
{
PHYSDEV emfdev = get_emfdev( dev );
PHYSDEV next = GET_NEXT_PHYSDEV( dev, pPolyBezier );
return (emfdev->funcs->pPolyBezier( emfdev, pts, count ) &&
next->funcs->pPolyBezier( next, pts, count ));
}
/***********************************************************************
* emfpathdrv_PolyBezierTo
*/
@ -791,7 +779,7 @@ static const struct gdi_dc_funcs emfpath_driver =
NULL, /* pPaintRgn */
NULL, /* pPatBlt */
NULL, /* pPie */
emfpathdrv_PolyBezier, /* pPolyBezier */
NULL, /* pPolyBezier */
emfpathdrv_PolyBezierTo, /* pPolyBezierTo */
emfpathdrv_PolyDraw, /* pPolyDraw */
NULL, /* pPolyPolygon */

View File

@ -608,12 +608,21 @@ BOOL EMFDC_Polygon( DC_ATTR *dc_attr, const POINT *pt, INT count )
return EMFDRV_Polylinegon( dc_attr->emf, pt, count, EMR_POLYGON );
}
/**********************************************************************
* EMFDC_PolyBezier
*/
BOOL EMFDC_PolyBezier( DC_ATTR *dc_attr, const POINT *pts, DWORD count )
{
return EMFDRV_Polylinegon( dc_attr->emf, pts, count, EMR_POLYBEZIER );
}
/**********************************************************************
* EMFDRV_PolyBezier
*/
BOOL CDECL EMFDRV_PolyBezier( PHYSDEV dev, const POINT *pts, DWORD count )
{
return EMFDRV_Polylinegon( dev, pts, count, EMR_POLYBEZIER );
/* FIXME: update bounding rect */
return TRUE;
}
/**********************************************************************

View File

@ -69,6 +69,7 @@ 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_PolyBezier( DC_ATTR *dc_attr, const POINT *points, DWORD count ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_PolyPolyline( DC_ATTR *dc_attr, const POINT *points, const DWORD *counts,
DWORD polys ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_PolyPolygon( DC_ATTR *dc_attr, const POINT *points, const INT *counts,

View File

@ -295,3 +295,17 @@ BOOL WINAPI PolyPolyline( HDC hdc, const POINT *points, const DWORD *counts, DWO
if (dc_attr->emf && !EMFDC_PolyPolyline( dc_attr, points, counts, polylines )) return FALSE;
return NtGdiPolyPolyDraw( hdc, points, counts, polylines, NtGdiPolyPolyline );
}
/******************************************************************************
* PolyBezier (GDI32.@)
*/
BOOL WINAPI PolyBezier( HDC hdc, const POINT *points, DWORD count )
{
DC_ATTR *dc_attr;
TRACE( "%p, %p, %u\n", hdc, points, count );
if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
if (dc_attr->emf && !EMFDC_PolyBezier( dc_attr, points, count )) return FALSE;
return NtGdiPolyPolyDraw( hdc, points, &count, 1, NtGdiPolyBezier );
}

View File

@ -625,6 +625,17 @@ ULONG WINAPI NtGdiPolyPolyDraw( HDC hdc, const POINT *points, const UINT *counts
ret = physdev->funcs->pPolyPolyline( physdev, points, counts, count );
break;
case NtGdiPolyBezier:
/* *counts must be 3 * n + 1 (where n >= 1) */
if (count == 1 && *counts != 1 && *counts % 3 == 1)
{
physdev = GET_DC_PHYSDEV( dc, pPolyBezier );
ret = physdev->funcs->pPolyBezier( physdev, points, *counts );
if (ret) dc->attr->cur_pos = points[*counts - 1];
}
else ret = FALSE;
break;
default:
WARN( "invalid function %u\n", function );
ret = FALSE;
@ -664,41 +675,6 @@ BOOL WINAPI FloodFill( HDC hdc, INT x, INT y, COLORREF color )
return ExtFloodFill( hdc, x, y, color, FLOODFILLBORDER );
}
/******************************************************************************
* PolyBezier [GDI32.@]
* Draws one or more Bezier curves
*
* PARAMS
* hDc [I] Handle to device context
* lppt [I] Pointer to endpoints and control points
* cPoints [I] Count of endpoints and control points
*
* RETURNS
* Success: TRUE
* Failure: FALSE
*/
BOOL WINAPI PolyBezier( HDC hdc, const POINT* lppt, DWORD cPoints )
{
PHYSDEV physdev;
BOOL ret;
DC * dc;
TRACE( "%p, %p, %u\n", hdc, lppt, cPoints );
/* cPoints must be 3 * n + 1 (where n>=1) */
if (cPoints == 1 || (cPoints % 3) != 1) return FALSE;
dc = get_dc_ptr( hdc );
if(!dc) return FALSE;
update_dc( dc );
physdev = GET_DC_PHYSDEV( dc, pPolyBezier );
ret = physdev->funcs->pPolyBezier( physdev, lppt, cPoints );
release_dc_ptr( dc );
return ret;
}
/******************************************************************************
* PolyBezierTo [GDI32.@]
* Draws one or more Bezier curves