gdi32: Use NtGdiPolyPolyDraw for PolylineTo 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:20 +02:00 committed by Alexandre Julliard
parent 5be1b7c75b
commit d69a6ab731
5 changed files with 36 additions and 39 deletions

View file

@ -695,18 +695,6 @@ static BOOL CDECL emfpathdrv_PolyDraw( PHYSDEV dev, const POINT *pts, const BYTE
next->funcs->pPolyDraw( next, pts, types, count ));
}
/***********************************************************************
* emfpathdrv_PolylineTo
*/
static BOOL CDECL emfpathdrv_PolylineTo( PHYSDEV dev, const POINT *pts, INT count )
{
PHYSDEV emfdev = get_emfdev( dev );
PHYSDEV next = GET_NEXT_PHYSDEV( dev, pPolylineTo );
return (emfdev->funcs->pPolylineTo( emfdev, pts, count ) &&
next->funcs->pPolylineTo( next, pts, count ));
}
static const struct gdi_dc_funcs emfpath_driver =
{
@ -784,7 +772,7 @@ static const struct gdi_dc_funcs emfpath_driver =
emfpathdrv_PolyDraw, /* pPolyDraw */
NULL, /* pPolyPolygon */
NULL, /* pPolyPolyline */
emfpathdrv_PolylineTo, /* pPolylineTo */
NULL, /* pPolylineTo */
NULL, /* pPutImage */
NULL, /* pRealizeDefaultPalette */
NULL, /* pRealizePalette */

View file

@ -591,12 +591,21 @@ BOOL EMFDC_Polyline( DC_ATTR *dc_attr, const POINT *points, INT count )
return EMFDRV_Polylinegon( dc_attr->emf, points, count, EMR_POLYLINE );
}
/**********************************************************************
* EMFDC_PolylineTo
*/
BOOL EMFDC_PolylineTo( DC_ATTR *dc_attr, const POINT *pt, INT count )
{
return EMFDRV_Polylinegon( dc_attr->emf, pt, count, EMR_POLYLINETO );
}
/**********************************************************************
* EMFDRV_PolylineTo
*/
BOOL CDECL EMFDRV_PolylineTo( PHYSDEV dev, const POINT* pt, INT count )
{
return EMFDRV_Polylinegon( dev, pt, count, EMR_POLYLINETO );
/* FIXME: update bounding rect */
return TRUE;
}
/**********************************************************************

View file

@ -76,6 +76,7 @@ extern BOOL EMFDC_PolyPolygon( DC_ATTR *dc_attr, const POINT *points, const INT
UINT polys ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_Polygon( DC_ATTR *dc_attr, const POINT *points, INT count ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_Polyline( DC_ATTR *dc_attr, const POINT *points, INT count) DECLSPEC_HIDDEN;
extern BOOL EMFDC_PolylineTo( DC_ATTR *dc_attr, const POINT *points, INT count ) 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,

View file

@ -309,3 +309,17 @@ BOOL WINAPI PolyBezier( HDC hdc, const POINT *points, DWORD count )
if (dc_attr->emf && !EMFDC_PolyBezier( dc_attr, points, count )) return FALSE;
return NtGdiPolyPolyDraw( hdc, points, &count, 1, NtGdiPolyBezier );
}
/**********************************************************************
* PolylineTo (GDI32.@)
*/
BOOL WINAPI PolylineTo( 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_PolylineTo( dc_attr, points, count )) return FALSE;
return NtGdiPolyPolyDraw( hdc, points, &count, 1, NtGdiPolylineTo );
}

View file

@ -575,31 +575,6 @@ BOOL WINAPI InvertRgn( HDC hdc, HRGN hrgn )
}
/**********************************************************************
* PolylineTo (GDI32.@)
*/
BOOL WINAPI PolylineTo( HDC hdc, const POINT* pt, DWORD cCount )
{
DC * dc = get_dc_ptr( hdc );
PHYSDEV physdev;
BOOL ret;
TRACE( "%p, %p, %u\n", hdc, pt, cCount );
if(!dc) return FALSE;
update_dc( dc );
physdev = GET_DC_PHYSDEV( dc, pPolylineTo );
ret = physdev->funcs->pPolylineTo( physdev, pt, cCount );
if (ret && cCount)
dc->attr->cur_pos = pt[cCount - 1];
release_dc_ptr( dc );
return ret;
}
/**********************************************************************
* NtGdiPolyPolyDraw (win32u.@)
*/
@ -636,6 +611,16 @@ ULONG WINAPI NtGdiPolyPolyDraw( HDC hdc, const POINT *points, const UINT *counts
else ret = FALSE;
break;
case NtGdiPolylineTo:
if (count == 1)
{
physdev = GET_DC_PHYSDEV( dc, pPolylineTo );
ret = physdev->funcs->pPolylineTo( physdev, points, *counts );
if (ret && *counts) dc->attr->cur_pos = points[*counts - 1];
}
else ret = FALSE;
break;
default:
WARN( "invalid function %u\n", function );
ret = FALSE;