From df9e0ccf5c7c56cdab457cb1023582a7078df2a7 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Thu, 8 Dec 2011 19:53:44 +0100 Subject: [PATCH] gdi32: Use the convert_bits helper function in SetDIBits and SetDIBitsToDevice. --- dlls/gdi32/dib.c | 33 ++++----------------------------- 1 file changed, 4 insertions(+), 29 deletions(-) diff --git a/dlls/gdi32/dib.c b/dlls/gdi32/dib.c index 0b8bb769439..ed5eea7b62d 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;