gdi32: Use NtGdiPolyPolyDraw for Polygon 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:00 +02:00 committed by Alexandre Julliard
parent 3a7c1630ea
commit c64bfb5433
11 changed files with 34 additions and 49 deletions

View File

@ -719,18 +719,6 @@ static BOOL CDECL emfpathdrv_PolyPolyline( PHYSDEV dev, const POINT *pts, const
next->funcs->pPolyPolyline( next, pts, counts, polylines ));
}
/***********************************************************************
* emfpathdrv_Polygon
*/
static BOOL CDECL emfpathdrv_Polygon( PHYSDEV dev, const POINT *pts, INT count )
{
PHYSDEV emfdev = get_emfdev( dev );
PHYSDEV next = GET_NEXT_PHYSDEV( dev, pPolygon );
return (emfdev->funcs->pPolygon( emfdev, pts, count ) &&
next->funcs->pPolygon( next, pts, count ));
}
/***********************************************************************
* emfpathdrv_Polyline
*/
@ -832,7 +820,7 @@ static const struct gdi_dc_funcs emfpath_driver =
emfpathdrv_PolyDraw, /* pPolyDraw */
NULL, /* pPolyPolygon */
emfpathdrv_PolyPolyline, /* pPolyPolyline */
emfpathdrv_Polygon, /* pPolygon */
NULL, /* pPolygon */
emfpathdrv_Polyline, /* pPolyline */
emfpathdrv_PolylineTo, /* pPolylineTo */
NULL, /* pPutImage */

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_Polygon( PHYSDEV dev, const POINT* pt, INT count ) 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;

View File

@ -600,12 +600,12 @@ BOOL CDECL EMFDRV_PolylineTo( PHYSDEV dev, const POINT* pt, INT count )
}
/**********************************************************************
* EMFDRV_Polygon
* EMFDC_Polygon
*/
BOOL CDECL EMFDRV_Polygon( PHYSDEV dev, const POINT* pt, INT count )
BOOL EMFDC_Polygon( DC_ATTR *dc_attr, const POINT *pt, INT count )
{
if(count < 2) return FALSE;
return EMFDRV_Polylinegon( dev, pt, count, EMR_POLYGON );
return EMFDRV_Polylinegon( dc_attr->emf, pt, count, EMR_POLYGON );
}
/**********************************************************************

View File

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

View File

@ -6270,6 +6270,7 @@ done:
if (lf.lfUnderline)
{
const UINT cnt = 5;
pts[0].x = x - (underlinePos + underlineWidth / 2) * sinEsc;
pts[0].y = y - (underlinePos + underlineWidth / 2) * cosEsc;
pts[1].x = x + width.x - (underlinePos + underlineWidth / 2) * sinEsc;
@ -6281,11 +6282,12 @@ done:
pts[4].x = pts[0].x;
pts[4].y = pts[0].y;
dp_to_lp(dc, pts, 5);
Polygon(hdc, pts, 5);
NtGdiPolyPolyDraw( hdc, pts, &cnt, 1, NtGdiPolyPolygon );
}
if (lf.lfStrikeOut)
{
const UINT cnt = 5;
pts[0].x = x - (strikeoutPos + strikeoutWidth / 2) * sinEsc;
pts[0].y = y - (strikeoutPos + strikeoutWidth / 2) * cosEsc;
pts[1].x = x + width.x - (strikeoutPos + strikeoutWidth / 2) * sinEsc;
@ -6297,7 +6299,7 @@ done:
pts[4].x = pts[0].x;
pts[4].y = pts[0].y;
dp_to_lp(dc, pts, 5);
Polygon(hdc, pts, 5);
NtGdiPolyPolyDraw( hdc, pts, &cnt, 1, NtGdiPolyPolygon );
}
NtGdiSelectPen(hdc, hpen);

View File

@ -53,6 +53,7 @@ extern BOOL METADC_Pie( HDC hdc, INT left, INT top, INT right, INT bottom,
INT xstart, INT ystart, INT xend, INT yend ) DECLSPEC_HIDDEN;
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_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;
@ -69,6 +70,7 @@ 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_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_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

@ -237,6 +237,21 @@ BOOL WINAPI RoundRect( HDC hdc, INT left, INT top, INT right,
return NtGdiRoundRect( hdc, left, top, right, bottom, ell_width, ell_height );
}
/**********************************************************************
* Polygon (GDI32.@)
*/
BOOL WINAPI Polygon( 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_Polygon( hdc, points, count );
if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
if (dc_attr->emf && !EMFDC_Polygon( dc_attr, points, count )) return FALSE;
return NtGdiPolyPolyDraw( hdc, points, (const UINT *)&count, 1, NtGdiPolyPolygon );
}
/**********************************************************************
* PolyPolygon (GDI32.@)
*/

View File

@ -126,9 +126,9 @@ COLORREF CDECL MFDRV_SetPixel( PHYSDEV dev, INT x, INT y, COLORREF color )
/******************************************************************
* MFDRV_MetaPoly - implements Polygon and Polyline
* metadc_poly - implements Polygon and Polyline
*/
static BOOL MFDRV_MetaPoly(PHYSDEV dev, short func, POINTS *pt, short count)
static BOOL metadc_poly( HDC hdc, short func, POINTS *pt, short count )
{
BOOL ret;
DWORD len;
@ -142,7 +142,7 @@ static BOOL MFDRV_MetaPoly(PHYSDEV dev, short func, POINTS *pt, short count)
mr->rdFunction = func;
*(mr->rdParm) = count;
memcpy(mr->rdParm + 1, pt, count * 4);
ret = MFDRV_WriteRecord( dev, mr, mr->rdSize * 2);
ret = metadc_record( hdc, mr, mr->rdSize * 2);
HeapFree( GetProcessHeap(), 0, mr);
return ret;
}
@ -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 = MFDRV_MetaPoly(dev, META_POLYLINE, pts, count);
ret = metadc_poly( dev->hdc, META_POLYLINE, pts, count );
HeapFree( GetProcessHeap(), 0, pts );
return ret;
@ -172,9 +172,9 @@ BOOL CDECL MFDRV_Polyline( PHYSDEV dev, const POINT* pt, INT count )
/**********************************************************************
* MFDRV_Polygon
* METADC_Polygon
*/
BOOL CDECL MFDRV_Polygon( PHYSDEV dev, const POINT* pt, INT count )
BOOL METADC_Polygon( HDC hdc, const POINT *pt, INT count )
{
int i;
POINTS *pts;
@ -187,7 +187,7 @@ BOOL CDECL MFDRV_Polygon( PHYSDEV dev, const POINT* pt, INT count )
pts[i].x = pt[i].x;
pts[i].y = pt[i].y;
}
ret = MFDRV_MetaPoly(dev, META_POLYGON, pts, count);
ret = metadc_poly( hdc, META_POLYGON, pts, count );
HeapFree( GetProcessHeap(), 0, pts );
return ret;

View File

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

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_Polygon( PHYSDEV dev, const POINT* pt, INT 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;

View File

@ -613,26 +613,6 @@ BOOL WINAPI PolylineTo( HDC hdc, const POINT* pt, DWORD cCount )
}
/**********************************************************************
* Polygon (GDI32.@)
*/
BOOL WINAPI Polygon( 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, pPolygon );
ret = physdev->funcs->pPolygon( physdev, pt, count );
release_dc_ptr( dc );
return ret;
}
/**********************************************************************
* NtGdiPolyPolyDraw (win32u.@)
*/