Module: wine Branch: master Commit: 0f5cc668bada79e38e8751bcf796f5b348ed3805 URL: http://source.winehq.org/git/wine.git/?a=commit;h=0f5cc668bada79e38e8751bcf7...
Author: Alexandre Julliard julliard@winehq.org Date: Tue Aug 21 12:54:01 2012 +0200
gdi32: Add a helper function to find a specific driver in the DC stack.
---
dlls/gdi32/gdi_private.h | 8 ++++++++ dlls/gdi32/path.c | 9 +++++---- 2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h index 44d5798..78ff1a7 100644 --- a/dlls/gdi32/gdi_private.h +++ b/dlls/gdi32/gdi_private.h @@ -179,6 +179,14 @@ static inline PHYSDEV pop_dc_driver( DC *dc, PHYSDEV dev ) return dev; }
+static inline PHYSDEV find_dc_driver( DC *dc, const struct gdi_dc_funcs *funcs ) +{ + PHYSDEV dev; + + for (dev = dc->physDev; dev; dev = dev->next) if (dev->funcs == funcs) return dev; + return NULL; +} + /* bitmap object */
typedef struct tagBITMAPOBJ diff --git a/dlls/gdi32/path.c b/dlls/gdi32/path.c index 0a591af..a58f4e6 100644 --- a/dlls/gdi32/path.c +++ b/dlls/gdi32/path.c @@ -856,14 +856,15 @@ static BOOL pathdrv_DeleteDC( PHYSDEV dev )
BOOL PATH_SavePath( DC *dst, DC *src ) { - struct path_physdev *physdev; + PHYSDEV dev;
if (src->path) { if (!(dst->path = copy_gdi_path( src->path ))) return FALSE; } - else if ((physdev = find_path_physdev( src ))) + else if ((dev = find_dc_driver( src, &path_driver ))) { + struct path_physdev *physdev = get_path_physdev( dev ); if (!(dst->path = copy_gdi_path( physdev->path ))) return FALSE; dst->path_open = TRUE; } @@ -880,7 +881,7 @@ BOOL PATH_RestorePath( DC *dst, DC *src ) if (!physdev) { if (!path_driver.pCreateDC( &dst->physDev, NULL, NULL, NULL, NULL )) return FALSE; - physdev = get_path_physdev( dst->physDev ); + physdev = get_path_physdev( find_dc_driver( dst, &path_driver )); } else free_gdi_path( physdev->path );
@@ -2101,7 +2102,7 @@ BOOL nulldrv_BeginPath( PHYSDEV dev ) free_gdi_path( path ); return FALSE; } - physdev = get_path_physdev( dc->physDev ); + physdev = get_path_physdev( find_dc_driver( dc, &path_driver )); physdev->path = path; if (dc->path) free_gdi_path( dc->path ); dc->path = NULL;