[PATCH v2 01/11] gdi32: Pass a DC pointer to get_gdi_flat_path().

Huw Davies huw at codeweavers.com
Fri Jul 29 09:09:26 CDT 2016


Signed-off-by: Huw Davies <huw at codeweavers.com>
---
 dlls/gdi32/dibdrv/graphics.c   | 3 ++-
 dlls/gdi32/enhmfdrv/graphics.c | 3 ++-
 dlls/gdi32/gdi_private.h       | 2 +-
 dlls/gdi32/path.c              | 8 ++------
 4 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/dlls/gdi32/dibdrv/graphics.c b/dlls/gdi32/dibdrv/graphics.c
index 08e777d..ba5fb70 100644
--- a/dlls/gdi32/dibdrv/graphics.c
+++ b/dlls/gdi32/dibdrv/graphics.c
@@ -408,6 +408,7 @@ static BOOL draw_arc( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
 /* helper for path stroking and filling functions */
 static BOOL stroke_and_fill_path( dibdrv_physdev *dev, BOOL stroke, BOOL fill )
 {
+    DC *dc = get_physdev_dc( &dev->dev );
     struct gdi_path *path;
     POINT *points;
     BYTE *types;
@@ -417,7 +418,7 @@ static BOOL stroke_and_fill_path( dibdrv_physdev *dev, BOOL stroke, BOOL fill )
 
     if (dev->brush.style == BS_NULL) fill = FALSE;
 
-    if (!(path = get_gdi_flat_path( dev->dev.hdc, fill ? &interior : NULL ))) return FALSE;
+    if (!(path = get_gdi_flat_path( dc, fill ? &interior : NULL ))) return FALSE;
     if (!(total = get_gdi_path_data( path, &points, &types ))) goto done;
 
     if (stroke && dev->pen_uses_region) outline = CreateRectRgn( 0, 0, 0, 0 );
diff --git a/dlls/gdi32/enhmfdrv/graphics.c b/dlls/gdi32/enhmfdrv/graphics.c
index f74e86b..7aaff9d 100644
--- a/dlls/gdi32/enhmfdrv/graphics.c
+++ b/dlls/gdi32/enhmfdrv/graphics.c
@@ -99,6 +99,7 @@ static void get_points_bounds( RECTL *bounds, const POINT *pts, UINT count, HDC
 /* helper for path stroke and fill functions */
 static BOOL emfdrv_stroke_and_fill_path( PHYSDEV dev, INT type )
 {
+    DC *dc = get_physdev_dc( dev );
     EMRSTROKEANDFILLPATH emr;
     struct gdi_path *path;
     POINT *points;
@@ -107,7 +108,7 @@ static BOOL emfdrv_stroke_and_fill_path( PHYSDEV dev, INT type )
     emr.emr.iType = type;
     emr.emr.nSize = sizeof(emr);
 
-    if ((path = get_gdi_flat_path( dev->hdc, NULL )))
+    if ((path = get_gdi_flat_path( dc, NULL )))
     {
         int count = get_gdi_path_data( path, &points, &flags );
         get_points_bounds( &emr.rclBounds, points, count, 0 );
diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h
index 5bad7b7..3df3a2c 100644
--- a/dlls/gdi32/gdi_private.h
+++ b/dlls/gdi32/gdi_private.h
@@ -334,7 +334,7 @@ typedef struct
 /* path.c */
 
 extern void free_gdi_path( struct gdi_path *path ) DECLSPEC_HIDDEN;
-extern struct gdi_path *get_gdi_flat_path( HDC hdc, HRGN *rgn ) DECLSPEC_HIDDEN;
+extern struct gdi_path *get_gdi_flat_path( DC *dc, HRGN *rgn ) DECLSPEC_HIDDEN;
 extern int get_gdi_path_data( struct gdi_path *path, POINT **points, BYTE **flags ) DECLSPEC_HIDDEN;
 extern BOOL PATH_SavePath( DC *dst, DC *src ) DECLSPEC_HIDDEN;
 extern BOOL PATH_RestorePath( DC *dst, DC *src ) DECLSPEC_HIDDEN;
diff --git a/dlls/gdi32/path.c b/dlls/gdi32/path.c
index 2126dab..c03208f 100644
--- a/dlls/gdi32/path.c
+++ b/dlls/gdi32/path.c
@@ -536,24 +536,20 @@ static BOOL PATH_DoArcPart(struct gdi_path *pPath, FLOAT_POINT corners[],
 /* retrieve a flattened path in device coordinates, and optionally its region */
 /* the DC path is deleted; the returned data must be freed by caller using free_gdi_path() */
 /* helper for stroke_and_fill_path in the DIB driver */
-struct gdi_path *get_gdi_flat_path( HDC hdc, HRGN *rgn )
+struct gdi_path *get_gdi_flat_path( DC *dc, HRGN *rgn )
 {
-    DC *dc = get_dc_ptr( hdc );
     struct gdi_path *ret = NULL;
 
-    if (!dc) return NULL;
-
     if (dc->path)
     {
         ret = PATH_FlattenPath( dc->path );
 
         free_gdi_path( dc->path );
         dc->path = NULL;
-        if (ret && rgn) *rgn = path_to_region( ret, GetPolyFillMode( hdc ) );
+        if (ret && rgn) *rgn = path_to_region( ret, dc->polyFillMode );
     }
     else SetLastError( ERROR_CAN_NOT_COMPLETE );
 
-    release_dc_ptr( dc );
     return ret;
 }
 
-- 
2.7.4




More information about the wine-patches mailing list