Alexandre Julliard : gdi32: Get rid of the get_bitmap_funcs function.

Alexandre Julliard julliard at winehq.org
Tue Jan 10 13:11:20 CST 2012


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Jan  9 14:11:50 2012 +0100

gdi32: Get rid of the get_bitmap_funcs function.

DIBs no longer use the display driver functions.

---

 dlls/gdi32/bitmap.c      |   11 +++--------
 dlls/gdi32/brush.c       |    4 +---
 dlls/gdi32/dib.c         |   12 +++---------
 dlls/gdi32/gdi_private.h |    6 ------
 4 files changed, 7 insertions(+), 26 deletions(-)

diff --git a/dlls/gdi32/bitmap.c b/dlls/gdi32/bitmap.c
index ab93525..af96111 100644
--- a/dlls/gdi32/bitmap.c
+++ b/dlls/gdi32/bitmap.c
@@ -337,10 +337,8 @@ LONG WINAPI GetBitmapBits(
     struct bitblt_coords src;
     int dst_stride, max, ret;
     BITMAPOBJ *bmp = GDI_GetObjPtr( hbitmap, OBJ_BITMAP );
-    const struct gdi_dc_funcs *funcs;
 
     if (!bmp) return 0;
-    funcs = get_bitmap_funcs( bmp );
 
     dst_stride = get_bitmap_stride( bmp->bitmap.bmWidth, bmp->bitmap.bmBitsPixel );
     ret = max = dst_stride * bmp->bitmap.bmHeight;
@@ -356,7 +354,7 @@ LONG WINAPI GetBitmapBits(
     src.width = src.visrect.right - src.visrect.left;
     src.height = src.visrect.bottom - src.visrect.top;
 
-    if (!funcs->pGetImage( NULL, hbitmap, info, &src_bits, &src ))
+    if (!bmp->funcs->pGetImage( NULL, hbitmap, info, &src_bits, &src ))
     {
         const char *src_ptr = src_bits.ptr;
         int src_stride = get_dib_stride( info->bmiHeader.biWidth, info->bmiHeader.biBitCount );
@@ -410,15 +408,12 @@ LONG WINAPI SetBitmapBits(
     struct bitblt_coords src, dst;
     struct gdi_image_bits src_bits;
     HRGN clip = NULL;
-    const struct gdi_dc_funcs *funcs;
 
     if (!bits) return 0;
 
     bmp = GDI_GetObjPtr( hbitmap, OBJ_BITMAP );
     if (!bmp) return 0;
 
-    funcs = get_bitmap_funcs( bmp );
-
     if (count < 0) {
 	WARN("(%d): Negative number of bytes passed???\n", count );
 	count = -count;
@@ -487,14 +482,14 @@ LONG WINAPI SetBitmapBits(
     info->bmiHeader.biWidth         = 0;
     info->bmiHeader.biHeight        = 0;
     info->bmiHeader.biSizeImage     = 0;
-    err = funcs->pPutImage( NULL, hbitmap, 0, info, NULL, NULL, NULL, SRCCOPY );
+    err = bmp->funcs->pPutImage( NULL, hbitmap, 0, info, NULL, NULL, NULL, SRCCOPY );
 
     if (!err || err == ERROR_BAD_FORMAT)
     {
         info->bmiHeader.biWidth     = bmp->bitmap.bmWidth;
         info->bmiHeader.biHeight    = -dst.height;
         info->bmiHeader.biSizeImage = dst.height * dst_stride;
-        err = funcs->pPutImage( NULL, hbitmap, clip, info, &src_bits, &src, &dst, SRCCOPY );
+        err = bmp->funcs->pPutImage( NULL, hbitmap, clip, info, &src_bits, &src, &dst, SRCCOPY );
     }
     if (err) count = 0;
 
diff --git a/dlls/gdi32/brush.c b/dlls/gdi32/brush.c
index 7513fca..f8c91c1 100644
--- a/dlls/gdi32/brush.c
+++ b/dlls/gdi32/brush.c
@@ -58,7 +58,6 @@ static const struct gdi_obj_funcs brush_funcs =
 /* fetch the contents of the brush bitmap and cache them in the brush pattern */
 void cache_pattern_bits( PHYSDEV physdev, struct brush_pattern *pattern )
 {
-    const struct gdi_dc_funcs *funcs;
     struct gdi_image_bits bits;
     struct bitblt_coords src;
     BITMAPINFO *info;
@@ -76,8 +75,7 @@ void cache_pattern_bits( PHYSDEV physdev, struct brush_pattern *pattern )
     src.visrect.top    = src.y = 0;
     src.visrect.right  = src.width = bmp->bitmap.bmWidth;
     src.visrect.bottom = src.height = bmp->bitmap.bmHeight;
-    funcs = get_bitmap_funcs( bmp );
-    if (funcs->pGetImage( NULL, pattern->bitmap, info, &bits, &src ))
+    if (bmp->funcs->pGetImage( NULL, pattern->bitmap, info, &bits, &src ))
     {
         HeapFree( GetProcessHeap(), 0, info );
         goto done;
diff --git a/dlls/gdi32/dib.c b/dlls/gdi32/dib.c
index 143cc47..55ac726 100644
--- a/dlls/gdi32/dib.c
+++ b/dlls/gdi32/dib.c
@@ -657,7 +657,6 @@ INT WINAPI SetDIBits( HDC hdc, HBITMAP hbitmap, UINT startscan,
     struct bitblt_coords src, dst;
     INT src_to_dst_offset;
     HRGN clip = 0;
-    const struct gdi_dc_funcs *funcs;
 
     if (!bitmapinfo_from_user_bitmapinfo( src_info, info, coloruse, TRUE ) || coloruse > DIB_PAL_COLORS)
     {
@@ -715,8 +714,6 @@ INT WINAPI SetDIBits( HDC hdc, HBITMAP hbitmap, UINT startscan,
         if (lines < src.visrect.bottom) src.visrect.bottom = lines;
     }
 
-    funcs = get_bitmap_funcs( bitmap );
-
     result = lines;
 
     offset_rect( &src.visrect, 0, src_to_dst_offset );
@@ -736,11 +733,11 @@ INT WINAPI SetDIBits( HDC hdc, HBITMAP hbitmap, UINT startscan,
 
     copy_bitmapinfo( dst_info, src_info );
 
-    err = funcs->pPutImage( NULL, hbitmap, clip, dst_info, &src_bits, &src, &dst, 0 );
+    err = bitmap->funcs->pPutImage( NULL, hbitmap, clip, dst_info, &src_bits, &src, &dst, 0 );
     if (err == ERROR_BAD_FORMAT)
     {
         err = convert_bits( src_info, &src, dst_info, &src_bits, FALSE );
-        if (!err) err = funcs->pPutImage( NULL, hbitmap, clip, dst_info, &src_bits, &src, &dst, 0 );
+        if (!err) err = bitmap->funcs->pPutImage( NULL, hbitmap, clip, dst_info, &src_bits, &src, &dst, 0 );
     }
     if(err) result = 0;
 
@@ -1212,7 +1209,6 @@ INT WINAPI GetDIBits(
     BITMAPINFO *dst_info = (BITMAPINFO *)dst_bmibuf;
     char src_bmibuf[FIELD_OFFSET( BITMAPINFO, bmiColors[256] )];
     BITMAPINFO *src_info = (BITMAPINFO *)src_bmibuf;
-    const struct gdi_dc_funcs *funcs;
     struct gdi_image_bits src_bits;
     struct bitblt_coords src, dst;
     BOOL empty_rect = FALSE;
@@ -1239,8 +1235,6 @@ INT WINAPI GetDIBits(
 	return 0;
     }
 
-    funcs = get_bitmap_funcs( bmp );
-
     src.visrect.left   = 0;
     src.visrect.top    = 0;
     src.visrect.right  = bmp->bitmap.bmWidth;
@@ -1348,7 +1342,7 @@ INT WINAPI GetDIBits(
         lines = src.height;
     }
 
-    err = funcs->pGetImage( NULL, hbitmap, src_info, bits ? &src_bits : NULL, bits ? &src : NULL );
+    err = bmp->funcs->pGetImage( NULL, hbitmap, src_info, bits ? &src_bits : NULL, bits ? &src : NULL );
 
     if (err) goto done;
 
diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h
index 081ecfd..b5a80ca 100644
--- a/dlls/gdi32/gdi_private.h
+++ b/dlls/gdi32/gdi_private.h
@@ -486,12 +486,6 @@ static inline void copy_bitmapinfo( BITMAPINFO *dst, const BITMAPINFO *src )
     memcpy( dst, src, get_dib_info_size( src, DIB_RGB_COLORS ));
 }
 
-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;
 
 extern HMODULE gdi32_module DECLSPEC_HIDDEN;




More information about the wine-cvs mailing list