gdi32: Use NtGdiPolyPolyDraw for PolyPolyline 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:26:15 +02:00 committed by Alexandre Julliard
parent c64bfb5433
commit 62fc320c84
5 changed files with 44 additions and 48 deletions

View File

@ -707,18 +707,6 @@ static BOOL CDECL emfpathdrv_PolyDraw( PHYSDEV dev, const POINT *pts, const BYTE
next->funcs->pPolyDraw( next, pts, types, count ));
}
/***********************************************************************
* emfpathdrv_PolyPolyline
*/
static BOOL CDECL emfpathdrv_PolyPolyline( PHYSDEV dev, const POINT *pts, const DWORD *counts, DWORD polylines )
{
PHYSDEV emfdev = get_emfdev( dev );
PHYSDEV next = GET_NEXT_PHYSDEV( dev, pPolyPolyline );
return (emfdev->funcs->pPolyPolyline( emfdev, pts, counts, polylines ) &&
next->funcs->pPolyPolyline( next, pts, counts, polylines ));
}
/***********************************************************************
* emfpathdrv_Polyline
*/
@ -819,7 +807,7 @@ static const struct gdi_dc_funcs emfpath_driver =
emfpathdrv_PolyBezierTo, /* pPolyBezierTo */
emfpathdrv_PolyDraw, /* pPolyDraw */
NULL, /* pPolyPolygon */
emfpathdrv_PolyPolyline, /* pPolyPolyline */
NULL, /* pPolyPolyline */
NULL, /* pPolygon */
emfpathdrv_Polyline, /* pPolyline */
emfpathdrv_PolylineTo, /* pPolylineTo */

View File

@ -626,15 +626,13 @@ BOOL CDECL EMFDRV_PolyBezierTo( PHYSDEV dev, const POINT *pts, DWORD count )
/**********************************************************************
* EMFDRV_PolyPolylinegon
* EMFDC_PolyPolylinegon
*
* Helper for EMFDRV_PolyPoly{line|gon}
*/
static BOOL
EMFDRV_PolyPolylinegon( PHYSDEV dev, const POINT* pt, const INT* counts, UINT polys,
DWORD iType)
static BOOL EMFDC_PolyPolylinegon( EMFDRV_PDEVICE *emf, const POINT *pt, const INT *counts,
UINT polys, DWORD type)
{
EMFDRV_PDEVICE *physDev = get_emf_physdev( dev );
EMRPOLYPOLYLINE *emr;
DWORD cptl = 0, poly, size;
BOOL ret, use_small_emr, bounds_valid = TRUE;
@ -654,11 +652,11 @@ EMFDRV_PolyPolylinegon( PHYSDEV dev, const POINT* pt, const INT* counts, UINT po
emr = HeapAlloc( GetProcessHeap(), 0, size );
emr->emr.iType = iType;
emr->emr.iType = type;
if(use_small_emr) emr->emr.iType += EMR_POLYPOLYLINE16 - EMR_POLYPOLYLINE;
emr->emr.nSize = size;
if(bounds_valid && !physDev->path)
if(bounds_valid && !emf->path)
get_points_bounds( &emr->rclBounds, pt, cptl, 0 );
else
emr->rclBounds = empty_bounds;
@ -671,25 +669,33 @@ EMFDRV_PolyPolylinegon( PHYSDEV dev, const POINT* pt, const INT* counts, UINT po
store_points( (POINTL *)(emr->aPolyCounts + polys), pt, cptl, use_small_emr );
}
ret = EMFDRV_WriteRecord( dev, &emr->emr );
ret = EMFDRV_WriteRecord( &emf->dev, &emr->emr );
if(ret && !bounds_valid)
{
ret = FALSE;
SetLastError( ERROR_INVALID_PARAMETER );
}
if(ret && !physDev->path)
EMFDRV_UpdateBBox( dev, &emr->rclBounds );
if(ret && !emf->path)
EMFDRV_UpdateBBox( &emf->dev, &emr->rclBounds );
HeapFree( GetProcessHeap(), 0, emr );
return ret;
}
/**********************************************************************
* EMFDRV_PolyPolyline
* EMFDC_PolyPolyline
*/
BOOL CDECL EMFDRV_PolyPolyline(PHYSDEV dev, const POINT* pt, const DWORD* counts, DWORD polys)
BOOL EMFDC_PolyPolyline( DC_ATTR *dc_attr, const POINT *pt, const DWORD *counts, DWORD polys)
{
return EMFDRV_PolyPolylinegon( dev, pt, (const INT *)counts, polys,
EMR_POLYPOLYLINE );
return EMFDC_PolyPolylinegon( dc_attr->emf, pt, (const INT *)counts, polys, EMR_POLYPOLYLINE );
}
/**********************************************************************
* EMFDRV_PolyPoline
*/
BOOL CDECL EMFDRV_PolyPolyline( PHYSDEV dev, const POINT *pt, const DWORD* counts, UINT polys )
{
/* FIXME: update bounding rect */
return TRUE;
}
/**********************************************************************
@ -697,7 +703,7 @@ BOOL CDECL EMFDRV_PolyPolyline(PHYSDEV dev, const POINT* pt, const DWORD* counts
*/
BOOL EMFDC_PolyPolygon( DC_ATTR *dc_attr, const POINT *pt, const INT *counts, UINT polys )
{
return EMFDRV_PolyPolylinegon( dc_attr->emf, pt, counts, polys, EMR_POLYPOLYGON );
return EMFDC_PolyPolylinegon( dc_attr->emf, pt, counts, polys, EMR_POLYPOLYGON );
}
/**********************************************************************

View File

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

View File

@ -266,3 +266,17 @@ BOOL WINAPI PolyPolygon( HDC hdc, const POINT *points, const INT *counts, UINT p
if (dc_attr->emf && !EMFDC_PolyPolygon( dc_attr, points, counts, polygons )) return FALSE;
return NtGdiPolyPolyDraw( hdc, points, (const UINT *)counts, polygons, NtGdiPolyPolygon );
}
/**********************************************************************
* PolyPolyline (GDI32.@)
*/
BOOL WINAPI PolyPolyline( HDC hdc, const POINT *points, const DWORD *counts, DWORD polylines )
{
DC_ATTR *dc_attr;
TRACE( "%p, %p, %p, %u\n", hdc, points, counts, polylines );
if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
if (dc_attr->emf && !EMFDC_PolyPolyline( dc_attr, points, counts, polylines )) return FALSE;
return NtGdiPolyPolyDraw( hdc, points, counts, polylines, NtGdiPolyPolyline );
}

View File

@ -632,6 +632,12 @@ ULONG WINAPI NtGdiPolyPolyDraw( HDC hdc, const POINT *points, const UINT *counts
physdev = GET_DC_PHYSDEV( dc, pPolyPolygon );
ret = physdev->funcs->pPolyPolygon( physdev, points, (const INT *)counts, count );
break;
case NtGdiPolyPolyline:
physdev = GET_DC_PHYSDEV( dc, pPolyPolyline );
ret = physdev->funcs->pPolyPolyline( physdev, points, counts, count );
break;
default:
WARN( "invalid function %u\n", function );
ret = FALSE;
@ -642,26 +648,6 @@ ULONG WINAPI NtGdiPolyPolyDraw( HDC hdc, const POINT *points, const UINT *counts
return ret;
}
/**********************************************************************
* PolyPolyline (GDI32.@)
*/
BOOL WINAPI PolyPolyline( HDC hdc, const POINT* pt, const DWORD* counts,
DWORD polylines )
{
PHYSDEV physdev;
BOOL ret;
DC * dc = get_dc_ptr( hdc );
TRACE( "%p, %p, %p, %u\n", hdc, pt, counts, polylines );
if (!dc) return FALSE;
update_dc( dc );
physdev = GET_DC_PHYSDEV( dc, pPolyPolyline );
ret = physdev->funcs->pPolyPolyline( physdev, pt, counts, polylines );
release_dc_ptr( dc );
return ret;
}
/**********************************************************************
* ExtFloodFill (GDI32.@)
*/