gdi32: Use NtGdiPolyPolyDraw for PolyPolygon 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:25:17 +02:00 committed by Alexandre Julliard
parent 323416920f
commit 1b7a15e4cc
10 changed files with 73 additions and 30 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_PolyPolygon
*/
static BOOL CDECL emfpathdrv_PolyPolygon( PHYSDEV dev, const POINT *pts, const INT *counts, UINT polygons )
{
PHYSDEV emfdev = get_emfdev( dev );
PHYSDEV next = GET_NEXT_PHYSDEV( dev, pPolyPolygon );
return (emfdev->funcs->pPolyPolygon( emfdev, pts, counts, polygons ) &&
next->funcs->pPolyPolygon( next, pts, counts, polygons ));
}
/***********************************************************************
* emfpathdrv_PolyPolyline
*/
@ -842,7 +830,7 @@ static const struct gdi_dc_funcs emfpath_driver =
emfpathdrv_PolyBezier, /* pPolyBezier */
emfpathdrv_PolyBezierTo, /* pPolyBezierTo */
emfpathdrv_PolyDraw, /* pPolyDraw */
emfpathdrv_PolyPolygon, /* pPolyPolygon */
NULL, /* pPolyPolygon */
emfpathdrv_PolyPolyline, /* pPolyPolyline */
emfpathdrv_Polygon, /* pPolygon */
emfpathdrv_Polyline, /* pPolyline */

View File

@ -27,6 +27,7 @@
#include "winbase.h"
#include "wingdi.h"
#include "ntgdi_private.h"
#include "gdi_private.h"
/* Enhanced Metafile driver physical DC */

View File

@ -692,15 +692,23 @@ BOOL CDECL EMFDRV_PolyPolyline(PHYSDEV dev, const POINT* pt, const DWORD* counts
EMR_POLYPOLYLINE );
}
/**********************************************************************
* EMFDC_PolyPolygon
*/
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 );
}
/**********************************************************************
* EMFDRV_PolyPolygon
*/
BOOL CDECL EMFDRV_PolyPolygon( PHYSDEV dev, const POINT* pt, const INT* counts, UINT polys )
{
return EMFDRV_PolyPolylinegon( dev, pt, counts, polys, EMR_POLYPOLYGON );
/* FIXME: update bounding rect */
return TRUE;
}
/**********************************************************************
* EMFDRV_PolyDraw
*/

View File

@ -51,6 +51,8 @@ extern BOOL METADC_LineTo( HDC hdc, INT x, INT y ) DECLSPEC_HIDDEN;
extern BOOL METADC_MoveTo( HDC hdc, INT x, INT y ) DECLSPEC_HIDDEN;
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_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;
@ -65,6 +67,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_PolyPolygon( DC_ATTR *dc_attr, const POINT *points, const INT *counts,
UINT polys ) 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

@ -236,3 +236,18 @@ BOOL WINAPI RoundRect( HDC hdc, INT left, INT top, INT right,
return NtGdiRoundRect( hdc, left, top, right, bottom, ell_width, ell_height );
}
/**********************************************************************
* PolyPolygon (GDI32.@)
*/
BOOL WINAPI PolyPolygon( HDC hdc, const POINT *points, const INT *counts, UINT polygons )
{
DC_ATTR *dc_attr;
TRACE( "%p, %p, %p, %u\n", hdc, points, counts, polygons );
if (is_meta_dc( hdc )) return METADC_PolyPolygon( hdc, points, counts, polygons );
if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
if (dc_attr->emf && !EMFDC_PolyPolygon( dc_attr, points, counts, polygons )) return FALSE;
return NtGdiPolyPolyDraw( hdc, points, (const UINT *)counts, polygons, NtGdiPolyPolygon );
}

View File

@ -195,9 +195,9 @@ BOOL CDECL MFDRV_Polygon( PHYSDEV dev, const POINT* pt, INT count )
/**********************************************************************
* MFDRV_PolyPolygon
* METADC_PolyPolygon
*/
BOOL CDECL MFDRV_PolyPolygon( PHYSDEV dev, const POINT* pt, const INT* counts, UINT polygons)
BOOL METADC_PolyPolygon( HDC hdc, const POINT *pt, const INT *counts, UINT polygons )
{
BOOL ret;
DWORD len;
@ -239,7 +239,7 @@ BOOL CDECL MFDRV_PolyPolygon( PHYSDEV dev, const POINT* pt, const INT* counts, U
*(mr->rdParm) = polygons;
memcpy(mr->rdParm + 1, pointcounts, polygons*sizeof(INT16));
memcpy(mr->rdParm + 1+polygons, pts , totalpoint16*sizeof(*pts));
ret = MFDRV_WriteRecord( dev, mr, mr->rdSize * 2);
ret = metadc_record( hdc, mr, mr->rdSize * 2);
HeapFree( GetProcessHeap(), 0, pts );
HeapFree( GetProcessHeap(), 0, pointcounts );

View File

@ -171,7 +171,7 @@ static const struct gdi_dc_funcs MFDRV_Funcs =
MFDRV_PolyBezier, /* pPolyBezier */
MFDRV_PolyBezierTo, /* pPolyBezierTo */
NULL, /* pPolyDraw */
MFDRV_PolyPolygon, /* pPolyPolygon */
NULL, /* pPolyPolygon */
NULL, /* pPolyPolyline */
MFDRV_Polygon, /* pPolygon */
MFDRV_Polyline, /* pPolyline */
@ -606,6 +606,14 @@ static METAFILEDRV_PDEVICE *get_metadc_ptr( HDC hdc )
return metafile;
}
BOOL metadc_record( HDC hdc, METARECORD *mr, DWORD rlen )
{
METAFILEDRV_PDEVICE *dev;
if (!(dev = get_metadc_ptr( hdc ))) return FALSE;
return MFDRV_WriteRecord( &dev->dev, mr, rlen );
}
BOOL metadc_param2( HDC hdc, short func, short param1, short param2 )
{
METAFILEDRV_PDEVICE *dev;

View File

@ -67,6 +67,7 @@ extern BOOL metadc_param6( HDC hdc, short func, short param1, short param2, shor
extern BOOL metadc_param8( HDC hdc, short func, short param1, short param2,
short param3, short param4, short param5, short param6,
short param7, short param8 ) DECLSPEC_HIDDEN;
extern BOOL metadc_record( HDC hdc, METARECORD *mr, DWORD rlen ) DECLSPEC_HIDDEN;
/* Metafile driver functions */
@ -95,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_PolyPolygon( PHYSDEV dev, const POINT* pt, const INT* counts, UINT polygons) 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;

View File

@ -634,21 +634,30 @@ BOOL WINAPI Polygon( HDC hdc, const POINT* pt, INT count )
/**********************************************************************
* PolyPolygon (GDI32.@)
* NtGdiPolyPolyDraw (win32u.@)
*/
BOOL WINAPI PolyPolygon( HDC hdc, const POINT* pt, const INT* counts,
UINT polygons )
ULONG WINAPI NtGdiPolyPolyDraw( HDC hdc, const POINT *points, const UINT *counts,
UINT count, UINT function )
{
PHYSDEV physdev;
BOOL ret;
DC * dc = get_dc_ptr( hdc );
ULONG ret;
DC *dc;
TRACE( "%p, %p, %p, %u\n", hdc, pt, counts, polygons );
if (!dc) return FALSE;
if (!(dc = get_dc_ptr( hdc ))) return FALSE;
update_dc( dc );
physdev = GET_DC_PHYSDEV( dc, pPolyPolygon );
ret = physdev->funcs->pPolyPolygon( physdev, pt, counts, polygons );
switch (function)
{
case NtGdiPolyPolygon:
physdev = GET_DC_PHYSDEV( dc, pPolyPolygon );
ret = physdev->funcs->pPolyPolygon( physdev, points, (const INT *)counts, count );
break;
default:
WARN( "invalid function %u\n", function );
ret = FALSE;
break;
}
release_dc_ptr( dc );
return ret;
}

View File

@ -83,6 +83,16 @@ enum
NtGdiPie,
};
enum
{
NtGdiPolyPolygon = 1,
NtGdiPolyPolyline,
NtGdiPolyBezier,
NtGdiPolyBezierTo,
NtGdiPolylineTo,
NtGdiPolyPolygonRgn,
};
/* structs not compatible with native Windows */
#ifdef __WINESRC__