gdi32: Use NtGdiPolyPolyDraw for Polyline 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:36 +02:00 committed by Alexandre Julliard
parent 62fc320c84
commit 77a6beb4f1
10 changed files with 37 additions and 47 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_Polyline
*/
static BOOL CDECL emfpathdrv_Polyline( PHYSDEV dev, const POINT *pts, INT count )
{
PHYSDEV emfdev = get_emfdev( dev );
PHYSDEV next = GET_NEXT_PHYSDEV( dev, pPolyline );
return (emfdev->funcs->pPolyline( emfdev, pts, count ) &&
next->funcs->pPolyline( next, pts, count ));
}
/***********************************************************************
* emfpathdrv_PolylineTo
*/
@ -809,7 +797,7 @@ static const struct gdi_dc_funcs emfpath_driver =
NULL, /* pPolyPolygon */
NULL, /* pPolyPolyline */
NULL, /* pPolygon */
emfpathdrv_Polyline, /* pPolyline */
NULL, /* pPolyline */
emfpathdrv_PolylineTo, /* pPolylineTo */
NULL, /* pPutImage */
NULL, /* pRealizeDefaultPalette */

View File

@ -104,7 +104,6 @@ extern BOOL CDECL EMFDRV_PolyBezierTo( PHYSDEV dev, const POINT *pts, DWORD
extern BOOL CDECL EMFDRV_PolyDraw( PHYSDEV dev, const POINT *pts, const BYTE *types, DWORD count ) DECLSPEC_HIDDEN;
extern BOOL CDECL EMFDRV_PolyPolygon( PHYSDEV dev, const POINT* pt, const INT* counts, UINT polys) DECLSPEC_HIDDEN;
extern BOOL CDECL EMFDRV_PolyPolyline( PHYSDEV dev, const POINT* pt, const DWORD* counts, DWORD polys) DECLSPEC_HIDDEN;
extern BOOL CDECL EMFDRV_Polyline( PHYSDEV dev, const POINT* pt,INT count) DECLSPEC_HIDDEN;
extern BOOL CDECL EMFDRV_PolylineTo( PHYSDEV dev, const POINT* pt,INT count) DECLSPEC_HIDDEN;
extern BOOL CDECL EMFDRV_Rectangle( PHYSDEV dev, INT left, INT top, INT right, INT bottom) DECLSPEC_HIDDEN;
extern BOOL CDECL EMFDRV_RestoreDC( PHYSDEV dev, INT level ) DECLSPEC_HIDDEN;

View File

@ -584,11 +584,11 @@ EMFDRV_Polylinegon( PHYSDEV dev, const POINT* pt, INT count, DWORD iType )
/**********************************************************************
* EMFDRV_Polyline
* EMFDC_Polyline
*/
BOOL CDECL EMFDRV_Polyline( PHYSDEV dev, const POINT* pt, INT count )
BOOL EMFDC_Polyline( DC_ATTR *dc_attr, const POINT *points, INT count )
{
return EMFDRV_Polylinegon( dev, pt, count, EMR_POLYLINE );
return EMFDRV_Polylinegon( dc_attr->emf, points, count, EMR_POLYLINE );
}
/**********************************************************************

View File

@ -111,7 +111,7 @@ static const struct gdi_dc_funcs emfdrv_driver =
EMFDRV_PolyPolygon, /* pPolyPolygon */
EMFDRV_PolyPolyline, /* pPolyPolyline */
NULL, /* pPolygon */
EMFDRV_Polyline, /* pPolyline */
NULL, /* pPolyline */
EMFDRV_PolylineTo, /* pPolylineTo */
NULL, /* pPutImage */
NULL, /* pRealizeDefaultPalette */

View File

@ -54,6 +54,7 @@ extern BOOL METADC_Pie( HDC hdc, INT left, INT top, INT right, INT bottom,
extern BOOL METADC_PolyPolygon( HDC hdc, const POINT *points, const INT *counts,
UINT polygons ) DECLSPEC_HIDDEN;
extern BOOL METADC_Polygon( HDC hdc, const POINT *points, INT count ) DECLSPEC_HIDDEN;
extern BOOL METADC_Polyline( HDC hdc, const POINT *points,INT count) 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;
@ -73,6 +74,7 @@ extern BOOL EMFDC_PolyPolyline( DC_ATTR *dc_attr, const POINT *points, const DWO
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;
extern BOOL EMFDC_Polyline( 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

@ -267,6 +267,21 @@ BOOL WINAPI PolyPolygon( HDC hdc, const POINT *points, const INT *counts, UINT p
return NtGdiPolyPolyDraw( hdc, points, (const UINT *)counts, polygons, NtGdiPolyPolygon );
}
/**********************************************************************
* Polyline (GDI32.@)
*/
BOOL WINAPI Polyline( HDC hdc, const POINT *points, INT count )
{
DC_ATTR *dc_attr;
TRACE( "%p, %p, %d\n", hdc, points, count );
if (is_meta_dc( hdc )) return METADC_Polyline( hdc, points, count );
if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
if (dc_attr->emf && !EMFDC_Polyline( dc_attr, points, count )) return FALSE;
return NtGdiPolyPolyDraw( hdc, points, (const UINT *)&count, 1, NtGdiPolyPolyline );
}
/**********************************************************************
* PolyPolyline (GDI32.@)
*/

View File

@ -149,9 +149,9 @@ static BOOL metadc_poly( HDC hdc, short func, POINTS *pt, short count )
/**********************************************************************
* MFDRV_Polyline
* METADC_Polyline
*/
BOOL CDECL MFDRV_Polyline( PHYSDEV dev, const POINT* pt, INT count )
BOOL METADC_Polyline( HDC hdc, const POINT *pt, INT count )
{
int i;
POINTS *pts;
@ -164,7 +164,7 @@ BOOL CDECL MFDRV_Polyline( PHYSDEV dev, const POINT* pt, INT count )
pts[i].x = pt[i].x;
pts[i].y = pt[i].y;
}
ret = metadc_poly( dev->hdc, META_POLYLINE, pts, count );
ret = metadc_poly( hdc, META_POLYLINE, pts, count );
HeapFree( GetProcessHeap(), 0, pts );
return ret;

View File

@ -174,7 +174,7 @@ static const struct gdi_dc_funcs MFDRV_Funcs =
NULL, /* pPolyPolygon */
NULL, /* pPolyPolyline */
NULL, /* pPolygon */
MFDRV_Polyline, /* pPolyline */
NULL, /* pPolyline */
NULL, /* pPolylineTo */
NULL, /* pPutImage */
NULL, /* pRealizeDefaultPalette */

View File

@ -96,7 +96,6 @@ extern BOOL CDECL MFDRV_PaintRgn( PHYSDEV dev, HRGN hrgn ) DECLSPEC_HIDDEN;
extern BOOL CDECL MFDRV_PatBlt( PHYSDEV dev, struct bitblt_coords *dst, DWORD rop ) DECLSPEC_HIDDEN;
extern BOOL CDECL MFDRV_PolyBezier( PHYSDEV dev, const POINT* pt, DWORD count ) DECLSPEC_HIDDEN;
extern BOOL CDECL MFDRV_PolyBezierTo( PHYSDEV dev, const POINT* pt, DWORD count ) DECLSPEC_HIDDEN;
extern BOOL CDECL MFDRV_Polyline( PHYSDEV dev, const POINT* pt,INT count) 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;

View File

@ -105,6 +105,11 @@ BOOL CDECL nulldrv_InvertRgn( PHYSDEV dev, HRGN rgn )
return ret;
}
static BOOL polyline( HDC hdc, const POINT *points, UINT count )
{
return NtGdiPolyPolyDraw( hdc, points, &count, 1, NtGdiPolyPolyline );
}
BOOL CDECL nulldrv_PolyBezier( PHYSDEV dev, const POINT *points, DWORD count )
{
BOOL ret = FALSE;
@ -113,7 +118,7 @@ BOOL CDECL nulldrv_PolyBezier( PHYSDEV dev, const POINT *points, DWORD count )
if ((pts = GDI_Bezier( points, count, &n )))
{
ret = Polyline( dev->hdc, pts, n );
ret = polyline( dev->hdc, pts, n );
HeapFree( GetProcessHeap(), 0, pts );
}
return ret;
@ -129,7 +134,8 @@ BOOL CDECL nulldrv_PolyBezierTo( PHYSDEV dev, const POINT *points, DWORD count )
{
pts[0] = dc->attr->cur_pos;
memcpy( pts + 1, points, sizeof(POINT) * count );
ret = PolyBezier( dev->hdc, pts, count + 1 );
count++;
ret = NtGdiPolyPolyDraw( dev->hdc, pts, &count, 1, NtGdiPolyBezier );
HeapFree( GetProcessHeap(), 0, pts );
}
return ret;
@ -172,7 +178,7 @@ BOOL CDECL nulldrv_PolyDraw( PHYSDEV dev, const POINT *points, const BYTE *types
switch (types[i])
{
case PT_MOVETO:
if (num_pts >= 2) Polyline( dev->hdc, line_pts, num_pts );
if (num_pts >= 2) polyline( dev->hdc, line_pts, num_pts );
num_pts = 0;
line_pts[num_pts++] = points[i];
break;
@ -203,7 +209,7 @@ BOOL CDECL nulldrv_PolyDraw( PHYSDEV dev, const POINT *points, const BYTE *types
if (types[i] & PT_CLOSEFIGURE) line_pts[num_pts++] = line_pts[0];
}
if (num_pts >= 2) Polyline( dev->hdc, line_pts, num_pts );
if (num_pts >= 2) polyline( dev->hdc, line_pts, num_pts );
HeapFree( GetProcessHeap(), 0, line_pts );
return TRUE;
}
@ -219,7 +225,7 @@ BOOL CDECL nulldrv_PolylineTo( PHYSDEV dev, const POINT *points, INT count )
{
pts[0] = dc->attr->cur_pos;
memcpy( pts + 1, points, sizeof(POINT) * count );
ret = Polyline( dev->hdc, pts, count + 1 );
ret = polyline( dev->hdc, pts, count + 1 );
HeapFree( GetProcessHeap(), 0, pts );
}
return ret;
@ -569,25 +575,6 @@ BOOL WINAPI InvertRgn( HDC hdc, HRGN hrgn )
}
/**********************************************************************
* Polyline (GDI32.@)
*/
BOOL WINAPI Polyline( HDC hdc, const POINT* pt, INT count )
{
PHYSDEV physdev;
BOOL ret;
DC * dc = get_dc_ptr( hdc );
TRACE( "%p, %p, %d\n", hdc, pt, count );
if (!dc) return FALSE;
update_dc( dc );
physdev = GET_DC_PHYSDEV( dc, pPolyline );
ret = physdev->funcs->pPolyline( physdev, pt, count );
release_dc_ptr( dc );
return ret;
}
/**********************************************************************
* PolylineTo (GDI32.@)
*/