Alexandre Julliard : gdi32: Use the convert_bits helper function in SetDIBits and SetDIBitsToDevice.

Alexandre Julliard julliard at winehq.org
Thu Dec 8 13:43:40 CST 2011


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Thu Dec  8 19:53:44 2011 +0100

gdi32: Use the convert_bits helper function in SetDIBits and SetDIBitsToDevice.

---

 dlls/gdi32/dib.c |   33 ++++-----------------------------
 1 files changed, 4 insertions(+), 29 deletions(-)

diff --git a/dlls/gdi32/dib.c b/dlls/gdi32/dib.c
index 0b8bb76..ed5eea7 100644
--- a/dlls/gdi32/dib.c
+++ b/dlls/gdi32/dib.c
@@ -680,21 +680,8 @@ INT WINAPI SetDIBits( HDC hdc, HBITMAP hbitmap, UINT startscan,
     err = funcs->pPutImage( NULL, hbitmap, clip, dst_info, &src_bits, &src, &dst, 0 );
     if (err == ERROR_BAD_FORMAT)
     {
-        void *ptr;
-
-        dst_info->bmiHeader.biWidth = dst.width;
-        ptr = HeapAlloc( GetProcessHeap(), 0, get_dib_image_size( dst_info ));
-        if (ptr)
-        {
-            err = convert_bitmapinfo( src_info, src_bits.ptr, &src, dst_info, ptr, FALSE );
-            if (src_bits.free) src_bits.free( &src_bits );
-            src_bits.ptr = ptr;
-            src_bits.is_copy = TRUE;
-            src_bits.free = free_heap_bits;
-            if (!err)
-                err = funcs->pPutImage( NULL, hbitmap, clip, dst_info, &src_bits, &src, &dst, 0 );
-        }
-        else err = ERROR_OUTOFMEMORY;
+        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) result = 0;
 
@@ -810,20 +797,8 @@ INT nulldrv_SetDIBitsToDevice( PHYSDEV dev, INT x_dst, INT y_dst, DWORD cx, DWOR
     err = dev->funcs->pPutImage( dev, 0, clip, dst_info, &src_bits, &src, &dst, SRCCOPY );
     if (err == ERROR_BAD_FORMAT)
     {
-        void *ptr;
-
-        dst_info->bmiHeader.biWidth = src.visrect.right - src.visrect.left;
-        ptr = HeapAlloc( GetProcessHeap(), 0, get_dib_image_size( dst_info ));
-        if (ptr)
-        {
-            err = convert_bitmapinfo( src_info, src_bits.ptr, &src, dst_info, ptr, FALSE );
-            if (src_bits.free) src_bits.free( &src_bits );
-            src_bits.ptr = ptr;
-            src_bits.is_copy = TRUE;
-            src_bits.free = free_heap_bits;
-            if (!err) err = dev->funcs->pPutImage( dev, 0, clip, dst_info, &src_bits, &src, &dst, SRCCOPY );
-        }
-        else err = ERROR_OUTOFMEMORY;
+        err = convert_bits( src_info, &src, dst_info, &src_bits, FALSE );
+        if (!err) err = dev->funcs->pPutImage( dev, 0, clip, dst_info, &src_bits, &src, &dst, SRCCOPY );
     }
     if (err) lines = 0;
 




More information about the wine-cvs mailing list