Alexandre Julliard : gdi32: Calculate the image size in GradientFill only once we have the correct bit count .
Alexandre Julliard
julliard at winehq.org
Tue Jan 3 12:52:51 CST 2012
Module: wine
Branch: master
Commit: ccfbcfaf538ef6bf52e09a0d97e8ae6784718478
URL: http://source.winehq.org/git/wine.git/?a=commit;h=ccfbcfaf538ef6bf52e09a0d97e8ae6784718478
Author: Alexandre Julliard <julliard at winehq.org>
Date: Mon Jan 2 21:46:46 2012 +0100
gdi32: Calculate the image size in GradientFill only once we have the correct bit count.
---
dlls/gdi32/bitblt.c | 15 +++++++--------
1 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/dlls/gdi32/bitblt.c b/dlls/gdi32/bitblt.c
index 0d7ed3c..80a42ea 100644
--- a/dlls/gdi32/bitblt.c
+++ b/dlls/gdi32/bitblt.c
@@ -395,7 +395,7 @@ BOOL nulldrv_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, ULONG nvert,
struct gdi_image_bits bits;
unsigned int i;
POINT *pts;
- BOOL ret = TRUE;
+ BOOL ret = FALSE;
DWORD err;
HRGN rgn;
@@ -436,15 +436,14 @@ BOOL nulldrv_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, ULONG nvert,
info->bmiHeader.biClrImportant = 0;
info->bmiHeader.biWidth = dst.visrect.right - dst.visrect.left;
info->bmiHeader.biHeight = dst.visrect.bottom - dst.visrect.top;
- info->bmiHeader.biSizeImage = get_dib_image_size( info );
+ info->bmiHeader.biSizeImage = 0;
dev = GET_DC_PHYSDEV( dc, pPutImage );
err = dev->funcs->pPutImage( dev, 0, 0, info, NULL, NULL, NULL, 0 );
- if ((err && err != ERROR_BAD_FORMAT) ||
- !(bits.ptr = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, info->bmiHeader.biSizeImage )))
- {
- ret = FALSE;
+ if (err && err != ERROR_BAD_FORMAT) goto done;
+
+ info->bmiHeader.biSizeImage = get_dib_image_size( info );
+ if (!(bits.ptr = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, info->bmiHeader.biSizeImage )))
goto done;
- }
bits.is_copy = TRUE;
bits.free = free_heap_bits;
@@ -462,7 +461,7 @@ BOOL nulldrv_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, ULONG nvert,
rgn = CreateRectRgn( 0, 0, 0, 0 );
gradient_bitmapinfo( info, bits.ptr, vert_array, nvert, grad_array, ngrad, mode, pts, rgn );
OffsetRgn( rgn, dst.visrect.left, dst.visrect.top );
- if (dev->funcs->pPutImage( dev, 0, rgn, info, &bits, &src, &dst, SRCCOPY )) ret = FALSE;
+ ret = !dev->funcs->pPutImage( dev, 0, rgn, info, &bits, &src, &dst, SRCCOPY );
if (bits.free) bits.free( &bits );
DeleteObject( rgn );
More information about the wine-cvs
mailing list