Jacek Caban : gdi32: Use NtGdiPolyPolyDraw for PolylineTo implementation.

Alexandre Julliard julliard at winehq.org
Thu Jul 22 16:28:19 CDT 2021


Module: wine
Branch: master
Commit: d69a6ab731ebe60db7ba486a5c63a0cbf44e95f6
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=d69a6ab731ebe60db7ba486a5c63a0cbf44e95f6

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Thu Jul 22 11:27:20 2021 +0200

gdi32: Use NtGdiPolyPolyDraw for PolylineTo 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 | 11 ++++++++++-
 dlls/gdi32/gdi_private.h       |  1 +
 dlls/gdi32/gdidc.c             | 14 ++++++++++++++
 dlls/gdi32/painting.c          | 35 ++++++++++-------------------------
 5 files changed, 36 insertions(+), 39 deletions(-)

diff --git a/dlls/gdi32/enhmfdrv/dc.c b/dlls/gdi32/enhmfdrv/dc.c
index d387d4810ab..e1566ab8e69 100644
--- a/dlls/gdi32/enhmfdrv/dc.c
+++ b/dlls/gdi32/enhmfdrv/dc.c
@@ -695,18 +695,6 @@ static BOOL CDECL emfpathdrv_PolyDraw( PHYSDEV dev, const POINT *pts, const BYTE
             next->funcs->pPolyDraw( next, pts, types, count ));
 }
 
-/***********************************************************************
- *           emfpathdrv_PolylineTo
- */
-static BOOL CDECL emfpathdrv_PolylineTo( PHYSDEV dev, const POINT *pts, INT count )
-{
-    PHYSDEV emfdev = get_emfdev( dev );
-    PHYSDEV next = GET_NEXT_PHYSDEV( dev, pPolylineTo );
-
-    return (emfdev->funcs->pPolylineTo( emfdev, pts, count ) &&
-            next->funcs->pPolylineTo( next, pts, count ));
-}
-
 
 static const struct gdi_dc_funcs emfpath_driver =
 {
@@ -784,7 +772,7 @@ static const struct gdi_dc_funcs emfpath_driver =
     emfpathdrv_PolyDraw,                /* pPolyDraw */
     NULL,                               /* pPolyPolygon */
     NULL,                               /* pPolyPolyline */
-    emfpathdrv_PolylineTo,              /* pPolylineTo */
+    NULL,                               /* pPolylineTo */
     NULL,                               /* pPutImage */
     NULL,                               /* pRealizeDefaultPalette */
     NULL,                               /* pRealizePalette */
diff --git a/dlls/gdi32/enhmfdrv/graphics.c b/dlls/gdi32/enhmfdrv/graphics.c
index 082432fa079..563698b9920 100644
--- a/dlls/gdi32/enhmfdrv/graphics.c
+++ b/dlls/gdi32/enhmfdrv/graphics.c
@@ -591,12 +591,21 @@ BOOL EMFDC_Polyline( DC_ATTR *dc_attr, const POINT *points, INT count )
     return EMFDRV_Polylinegon( dc_attr->emf, points, count, EMR_POLYLINE );
 }
 
+/**********************************************************************
+ *          EMFDC_PolylineTo
+ */
+BOOL EMFDC_PolylineTo( DC_ATTR *dc_attr, const POINT *pt, INT count )
+{
+    return EMFDRV_Polylinegon( dc_attr->emf, pt, count, EMR_POLYLINETO );
+}
+
 /**********************************************************************
  *          EMFDRV_PolylineTo
  */
 BOOL CDECL EMFDRV_PolylineTo( PHYSDEV dev, const POINT* pt, INT count )
 {
-    return EMFDRV_Polylinegon( dev, pt, count, EMR_POLYLINETO );
+    /* FIXME: update bounding rect */
+    return TRUE;
 }
 
 /**********************************************************************
diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h
index fcb7195b302..0fc83e3b6f7 100644
--- a/dlls/gdi32/gdi_private.h
+++ b/dlls/gdi32/gdi_private.h
@@ -76,6 +76,7 @@ extern BOOL EMFDC_PolyPolygon( DC_ATTR *dc_attr, const POINT *points, const INT
                                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_PolylineTo( 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,
diff --git a/dlls/gdi32/gdidc.c b/dlls/gdi32/gdidc.c
index d7cd6a45f14..21e74768aec 100644
--- a/dlls/gdi32/gdidc.c
+++ b/dlls/gdi32/gdidc.c
@@ -309,3 +309,17 @@ BOOL WINAPI PolyBezier( HDC hdc, const POINT *points, DWORD count )
     if (dc_attr->emf && !EMFDC_PolyBezier( dc_attr, points, count )) return FALSE;
     return NtGdiPolyPolyDraw( hdc, points, &count, 1, NtGdiPolyBezier );
 }
+
+/**********************************************************************
+ *          PolylineTo   (GDI32.@)
+ */
+BOOL WINAPI PolylineTo( HDC hdc, const POINT *points, DWORD count )
+{
+    DC_ATTR *dc_attr;
+
+    TRACE( "%p, %p, %u\n", hdc, points, count );
+
+    if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
+    if (dc_attr->emf && !EMFDC_PolylineTo( dc_attr, points, count )) return FALSE;
+    return NtGdiPolyPolyDraw( hdc, points, &count, 1, NtGdiPolylineTo );
+}
diff --git a/dlls/gdi32/painting.c b/dlls/gdi32/painting.c
index ea353aaca9e..4896400b568 100644
--- a/dlls/gdi32/painting.c
+++ b/dlls/gdi32/painting.c
@@ -575,31 +575,6 @@ BOOL WINAPI InvertRgn( HDC hdc, HRGN hrgn )
 }
 
 
-/**********************************************************************
- *          PolylineTo   (GDI32.@)
- */
-BOOL WINAPI PolylineTo( HDC hdc, const POINT* pt, DWORD cCount )
-{
-    DC * dc = get_dc_ptr( hdc );
-    PHYSDEV physdev;
-    BOOL ret;
-
-    TRACE( "%p, %p, %u\n", hdc, pt, cCount );
-
-    if(!dc) return FALSE;
-
-    update_dc( dc );
-    physdev = GET_DC_PHYSDEV( dc, pPolylineTo );
-    ret = physdev->funcs->pPolylineTo( physdev, pt, cCount );
-
-    if (ret && cCount)
-        dc->attr->cur_pos = pt[cCount - 1];
-
-    release_dc_ptr( dc );
-    return ret;
-}
-
-
 /**********************************************************************
  *          NtGdiPolyPolyDraw  (win32u.@)
  */
@@ -636,6 +611,16 @@ ULONG WINAPI NtGdiPolyPolyDraw( HDC hdc, const POINT *points, const UINT *counts
         else ret = FALSE;
         break;
 
+    case NtGdiPolylineTo:
+        if (count == 1)
+        {
+            physdev = GET_DC_PHYSDEV( dc, pPolylineTo );
+            ret = physdev->funcs->pPolylineTo( physdev, points, *counts );
+            if (ret && *counts) dc->attr->cur_pos = points[*counts - 1];
+        }
+        else ret = FALSE;
+        break;
+
     default:
         WARN( "invalid function %u\n", function );
         ret = FALSE;




More information about the wine-cvs mailing list