Alexandre Julliard : gdi32: Implement the polyline entry points in the path driver.

Alexandre Julliard julliard at winehq.org
Thu Oct 27 13:30:11 CDT 2011


Module: wine
Branch: master
Commit: 613972efe5dc54e3259a59f8faae24a33476e235
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=613972efe5dc54e3259a59f8faae24a33476e235

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Oct 26 20:20:24 2011 +0200

gdi32: Implement the polyline entry points in the path driver.

---

 dlls/gdi32/gdi_private.h |    3 -
 dlls/gdi32/painting.c    |   28 ++++--------
 dlls/gdi32/path.c        |  110 ++++++++++++++++++++--------------------------
 3 files changed, 57 insertions(+), 84 deletions(-)

diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h
index 73b7db5..9682531 100644
--- a/dlls/gdi32/gdi_private.h
+++ b/dlls/gdi32/gdi_private.h
@@ -327,9 +327,6 @@ extern BOOL PATH_RestorePath( DC *dst, DC *src ) DECLSPEC_HIDDEN;
 
 extern BOOL PATH_ExtTextOut(DC *dc, INT x, INT y, UINT flags, const RECT *lprc,
                             LPCWSTR str, UINT count, const INT *dx) DECLSPEC_HIDDEN;
-extern BOOL PATH_PolylineTo(DC *dc, const POINT *pt, DWORD cbCount) DECLSPEC_HIDDEN;
-extern BOOL PATH_Polyline(DC *dc, const POINT *pt, DWORD cbCount) DECLSPEC_HIDDEN;
-extern BOOL PATH_PolyPolyline(DC *dc, const POINT *pt, const DWORD *counts, DWORD polylines) DECLSPEC_HIDDEN;
 
 /* painting.c */
 extern POINT *GDI_Bezier( const POINT *Points, INT count, INT *nPtsOut ) DECLSPEC_HIDDEN;
diff --git a/dlls/gdi32/painting.c b/dlls/gdi32/painting.c
index 87b5302..183cdfa 100644
--- a/dlls/gdi32/painting.c
+++ b/dlls/gdi32/painting.c
@@ -728,13 +728,9 @@ BOOL WINAPI Polyline( HDC hdc, const POINT* pt, INT count )
 
     if (dc)
     {
+        PHYSDEV physdev = GET_DC_PHYSDEV( dc, pPolyline );
         update_dc( dc );
-        if (PATH_IsPathOpen(dc->path)) ret = PATH_Polyline(dc, pt, count);
-        else
-        {
-            PHYSDEV physdev = GET_DC_PHYSDEV( dc, pPolyline );
-            ret = physdev->funcs->pPolyline( physdev, pt, count );
-        }
+        ret = physdev->funcs->pPolyline( physdev, pt, count );
         release_dc_ptr( dc );
     }
     return ret;
@@ -746,17 +742,15 @@ BOOL WINAPI Polyline( HDC hdc, const POINT* pt, INT count )
 BOOL WINAPI PolylineTo( HDC hdc, const POINT* pt, DWORD cCount )
 {
     DC * dc = get_dc_ptr( hdc );
-    BOOL ret = FALSE;
+    PHYSDEV physdev;
+    BOOL ret;
 
     if(!dc) return FALSE;
 
     update_dc( dc );
-    if(PATH_IsPathOpen(dc->path)) ret = PATH_PolylineTo(dc, pt, cCount);
-    else
-    {
-        PHYSDEV physdev = GET_DC_PHYSDEV( dc, pPolylineTo );
-        ret = physdev->funcs->pPolylineTo( physdev, pt, cCount );
-    }
+    physdev = GET_DC_PHYSDEV( dc, pPolylineTo );
+    ret = physdev->funcs->pPolylineTo( physdev, pt, cCount );
+
     if (ret && cCount)
     {
         dc->CursPosX = pt[cCount-1].x;
@@ -816,13 +810,9 @@ BOOL WINAPI PolyPolyline( HDC hdc, const POINT* pt, const DWORD* counts,
 
     if (dc)
     {
+        PHYSDEV physdev = GET_DC_PHYSDEV( dc, pPolyPolyline );
         update_dc( dc );
-        if (PATH_IsPathOpen(dc->path)) ret = PATH_PolyPolyline(dc, pt, counts, polylines);
-        else
-        {
-            PHYSDEV physdev = GET_DC_PHYSDEV( dc, pPolyPolyline );
-            ret = physdev->funcs->pPolyPolyline( physdev, pt, counts, polylines );
-        }
+        ret = physdev->funcs->pPolyPolyline( physdev, pt, counts, polylines );
         release_dc_ptr( dc );
     }
     return ret;
diff --git a/dlls/gdi32/path.c b/dlls/gdi32/path.c
index c7dde62..956eaa2 100644
--- a/dlls/gdi32/path.c
+++ b/dlls/gdi32/path.c
@@ -1321,55 +1321,43 @@ static BOOL pathdrv_PolyDraw( PHYSDEV dev, const POINT *pts, const BYTE *types,
     return TRUE;
 }
 
-BOOL PATH_Polyline(DC *dc, const POINT *pts, DWORD cbPoints)
-{
-   GdiPath     *pPath = &dc->path;
-   POINT       pt;
-   UINT        i;
 
-   /* Check that path is open */
-   if(pPath->state!=PATH_Open)
-      return FALSE;
+/*************************************************************
+ *           pathdrv_Polyline
+ */
+static BOOL pathdrv_Polyline( PHYSDEV dev, const POINT *pts, INT cbPoints )
+{
+    struct path_physdev *physdev = get_path_physdev( dev );
+    POINT pt;
+    INT i;
 
-   for(i = 0; i < cbPoints; i++) {
-       pt = pts[i];
-       if(!LPtoDP(dc->hSelf, &pt, 1))
-	   return FALSE;
-       PATH_AddEntry(pPath, &pt, (i == 0) ? PT_MOVETO : PT_LINETO);
-   }
-   return TRUE;
+    for(i = 0; i < cbPoints; i++) {
+        pt = pts[i];
+        LPtoDP( dev->hdc, &pt, 1 );
+        PATH_AddEntry(physdev->path, &pt, (i == 0) ? PT_MOVETO : PT_LINETO);
+    }
+    return TRUE;
 }
 
-BOOL PATH_PolylineTo(DC *dc, const POINT *pts, DWORD cbPoints)
-{
-   GdiPath     *pPath = &dc->path;
-   POINT       pt;
-   UINT        i;
 
-   /* Check that path is open */
-   if(pPath->state!=PATH_Open)
-      return FALSE;
+/*************************************************************
+ *           pathdrv_PolylineTo
+ */
+static BOOL pathdrv_PolylineTo( PHYSDEV dev, const POINT *pts, INT cbPoints )
+{
+    struct path_physdev *physdev = get_path_physdev( dev );
+    POINT pt;
+    INT i;
 
-   /* Add a PT_MOVETO if necessary */
-   if(pPath->newStroke)
-   {
-      pPath->newStroke=FALSE;
-      pt.x = dc->CursPosX;
-      pt.y = dc->CursPosY;
-      if(!LPtoDP(dc->hSelf, &pt, 1))
-         return FALSE;
-      if(!PATH_AddEntry(pPath, &pt, PT_MOVETO))
-         return FALSE;
-   }
+    if (!start_new_stroke( physdev )) return FALSE;
 
-   for(i = 0; i < cbPoints; i++) {
-       pt = pts[i];
-       if(!LPtoDP(dc->hSelf, &pt, 1))
-	   return FALSE;
-       PATH_AddEntry(pPath, &pt, PT_LINETO);
-   }
+    for(i = 0; i < cbPoints; i++) {
+        pt = pts[i];
+        LPtoDP( dev->hdc, &pt, 1 );
+        PATH_AddEntry(physdev->path, &pt, PT_LINETO);
+    }
 
-   return TRUE;
+    return TRUE;
 }
 
 
@@ -1416,26 +1404,24 @@ static BOOL pathdrv_PolyPolygon( PHYSDEV dev, const POINT* pts, const INT* count
     return TRUE;
 }
 
-BOOL PATH_PolyPolyline( DC *dc, const POINT* pts, const DWORD* counts,
-			DWORD polylines )
-{
-   GdiPath     *pPath = &dc->path;
-   POINT       pt;
-   UINT        poly, point, i;
 
-   /* Check that path is open */
-   if(pPath->state!=PATH_Open)
-      return FALSE;
+/*************************************************************
+ *           pathdrv_PolyPolyline
+ */
+static BOOL pathdrv_PolyPolyline( PHYSDEV dev, const POINT* pts, const DWORD* counts, DWORD polylines )
+{
+    struct path_physdev *physdev = get_path_physdev( dev );
+    POINT pt;
+    UINT poly, point, i;
 
-   for(i = 0, poly = 0; poly < polylines; poly++) {
-       for(point = 0; point < counts[poly]; point++, i++) {
-	   pt = pts[i];
-	   if(!LPtoDP(dc->hSelf, &pt, 1))
-	       return FALSE;
-	   PATH_AddEntry(pPath, &pt, (point == 0) ? PT_MOVETO : PT_LINETO);
-       }
-   }
-   return TRUE;
+    for(i = 0, poly = 0; poly < polylines; poly++) {
+        for(point = 0; point < counts[poly]; point++, i++) {
+            pt = pts[i];
+            LPtoDP( dev->hdc, &pt, 1 );
+            PATH_AddEntry(physdev->path, &pt, (point == 0) ? PT_MOVETO : PT_LINETO);
+        }
+    }
+    return TRUE;
 }
 
 
@@ -2359,10 +2345,10 @@ const struct gdi_dc_funcs path_driver =
     pathdrv_PolyBezierTo,               /* pPolyBezierTo */
     pathdrv_PolyDraw,                   /* pPolyDraw */
     pathdrv_PolyPolygon,                /* pPolyPolygon */
-    NULL,                               /* pPolyPolyline */
+    pathdrv_PolyPolyline,               /* pPolyPolyline */
     pathdrv_Polygon,                    /* pPolygon */
-    NULL,                               /* pPolyline */
-    NULL,                               /* pPolylineTo */
+    pathdrv_Polyline,                   /* pPolyline */
+    pathdrv_PolylineTo,                 /* pPolylineTo */
     NULL,                               /* pPutImage */
     NULL,                               /* pRealizeDefaultPalette */
     NULL,                               /* pRealizePalette */




More information about the wine-cvs mailing list