From 67520ebaf57c76a6b69820a93c902c804843ea7b Mon Sep 17 00:00:00 2001 From: Huw Davies Date: Fri, 29 Jul 2016 15:09:26 +0100 Subject: [PATCH] gdi32: Pass a DC pointer to get_gdi_flat_path(). Signed-off-by: Huw Davies Signed-off-by: Alexandre Julliard --- 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 3ea39a160e3..e6d65e18d4a 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 f74e86b086b..7aaff9d61a7 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 5bad7b77c79..3df3a2c5d58 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 2126dab26cf..c03208f5fc9 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; }