Jacek Caban : gdi32: Use NtGdiPolyPolyDraw for PolyPolyline implementation.
Alexandre Julliard
julliard at winehq.org
Thu Jul 22 16:28:19 CDT 2021
Module: wine
Branch: master
Commit: 62fc320c84ec517afa8ee3582243efbf1ab08253
URL: https://source.winehq.org/git/wine.git/?a=commit;h=62fc320c84ec517afa8ee3582243efbf1ab08253
Author: Jacek Caban <jacek at codeweavers.com>
Date: Thu Jul 22 11:26:15 2021 +0200
gdi32: Use NtGdiPolyPolyDraw for PolyPolyline implementation.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/gdi32/enhmfdrv/dc.c | 14 +-------------
dlls/gdi32/enhmfdrv/graphics.c | 36 +++++++++++++++++++++---------------
dlls/gdi32/gdi_private.h | 2 ++
dlls/gdi32/gdidc.c | 14 ++++++++++++++
dlls/gdi32/painting.c | 26 ++++++--------------------
5 files changed, 44 insertions(+), 48 deletions(-)
diff --git a/dlls/gdi32/enhmfdrv/dc.c b/dlls/gdi32/enhmfdrv/dc.c
index c4037e5fa99..313535de973 100644
--- a/dlls/gdi32/enhmfdrv/dc.c
+++ b/dlls/gdi32/enhmfdrv/dc.c
@@ -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 */
diff --git a/dlls/gdi32/enhmfdrv/graphics.c b/dlls/gdi32/enhmfdrv/graphics.c
index 6d15946d2fb..852dd9de68f 100644
--- a/dlls/gdi32/enhmfdrv/graphics.c
+++ b/dlls/gdi32/enhmfdrv/graphics.c
@@ -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 EMFDC_PolyPolyline( DC_ATTR *dc_attr, const POINT *pt, const DWORD *counts, DWORD polys)
+{
+ 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, DWORD polys)
+BOOL CDECL EMFDRV_PolyPolyline( PHYSDEV dev, const POINT *pt, const DWORD* counts, UINT polys )
{
- return EMFDRV_PolyPolylinegon( dev, pt, (const INT *)counts, polys,
- EMR_POLYPOLYLINE );
+ /* 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 );
}
/**********************************************************************
diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h
index 645e78805fd..424d432f0d0 100644
--- a/dlls/gdi32/gdi_private.h
+++ b/dlls/gdi32/gdi_private.h
@@ -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;
diff --git a/dlls/gdi32/gdidc.c b/dlls/gdi32/gdidc.c
index d224a59941a..89405358194 100644
--- a/dlls/gdi32/gdidc.c
+++ b/dlls/gdi32/gdidc.c
@@ -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 );
+}
diff --git a/dlls/gdi32/painting.c b/dlls/gdi32/painting.c
index f8544b209d8..5be668cd282 100644
--- a/dlls/gdi32/painting.c
+++ b/dlls/gdi32/painting.c
@@ -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.@)
*/
More information about the wine-cvs
mailing list