Huw Davies : gdi32: Add a helper to retrieve the bitmap functions.

Alexandre Julliard julliard at winehq.org
Mon Aug 22 13:29:08 CDT 2011


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

Author: Huw Davies <huw at codeweavers.com>
Date:   Fri Aug 19 16:26:13 2011 +0100

gdi32: Add a helper to retrieve the bitmap functions.

---

 dlls/gdi32/dib.c         |    6 ++----
 dlls/gdi32/gdi_private.h |    6 ++++++
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/dlls/gdi32/dib.c b/dlls/gdi32/dib.c
index ebc6fe4..add3a70 100644
--- a/dlls/gdi32/dib.c
+++ b/dlls/gdi32/dib.c
@@ -583,8 +583,7 @@ INT WINAPI SetDIBits( HDC hdc, HBITMAP hbitmap, UINT startscan,
     physdev = GET_DC_PHYSDEV( dc, pCreateBitmap );
     if (!BITMAP_SetOwnerDC( hbitmap, physdev )) goto done;
 
-    funcs = bitmap->funcs;
-    if (bitmap->dib) funcs = dc->dibdrv.dev.funcs;
+    funcs = get_bitmap_funcs( bitmap );
 
     result = lines;
 
@@ -947,8 +946,7 @@ INT WINAPI GetDIBits(
 	return 0;
     }
 
-    funcs = bmp->funcs;
-    if (bmp->dib) funcs = dc->dibdrv.dev.funcs;
+    funcs = get_bitmap_funcs( bmp );
 
     if (dst_info->bmiHeader.biBitCount == 0) /* query bitmap info only */
     {
diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h
index b24f4eb..3e3cc3c 100644
--- a/dlls/gdi32/gdi_private.h
+++ b/dlls/gdi32/gdi_private.h
@@ -571,6 +571,12 @@ static inline int get_dib_num_of_colors( const BITMAPINFO *info )
     return info->bmiHeader.biBitCount > 8 ? 0 : 1 << info->bmiHeader.biBitCount;
 }
 
+static inline const struct gdi_dc_funcs *get_bitmap_funcs( const BITMAPOBJ *bitmap )
+{
+    if( bitmap->dib ) return &dib_driver;
+    return bitmap->funcs;
+}
+
 extern void free_heap_bits( struct gdi_image_bits *bits ) DECLSPEC_HIDDEN;
 
 #endif /* __WINE_GDI_PRIVATE_H */




More information about the wine-cvs mailing list