Commit ccfbcfaf authored by Alexandre Julliard's avatar Alexandre Julliard

gdi32: Calculate the image size in GradientFill only once we have the correct bit count.

parent a38a496a
...@@ -395,7 +395,7 @@ BOOL nulldrv_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, ULONG nvert, ...@@ -395,7 +395,7 @@ BOOL nulldrv_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, ULONG nvert,
struct gdi_image_bits bits; struct gdi_image_bits bits;
unsigned int i; unsigned int i;
POINT *pts; POINT *pts;
BOOL ret = TRUE; BOOL ret = FALSE;
DWORD err; DWORD err;
HRGN rgn; HRGN rgn;
...@@ -436,15 +436,14 @@ BOOL nulldrv_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, ULONG nvert, ...@@ -436,15 +436,14 @@ BOOL nulldrv_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, ULONG nvert,
info->bmiHeader.biClrImportant = 0; info->bmiHeader.biClrImportant = 0;
info->bmiHeader.biWidth = dst.visrect.right - dst.visrect.left; info->bmiHeader.biWidth = dst.visrect.right - dst.visrect.left;
info->bmiHeader.biHeight = dst.visrect.bottom - dst.visrect.top; 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 ); dev = GET_DC_PHYSDEV( dc, pPutImage );
err = dev->funcs->pPutImage( dev, 0, 0, info, NULL, NULL, NULL, 0 ); err = dev->funcs->pPutImage( dev, 0, 0, info, NULL, NULL, NULL, 0 );
if ((err && err != ERROR_BAD_FORMAT) || if (err && err != ERROR_BAD_FORMAT) goto done;
!(bits.ptr = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, info->bmiHeader.biSizeImage )))
{ info->bmiHeader.biSizeImage = get_dib_image_size( info );
ret = FALSE; if (!(bits.ptr = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, info->bmiHeader.biSizeImage )))
goto done; goto done;
}
bits.is_copy = TRUE; bits.is_copy = TRUE;
bits.free = free_heap_bits; bits.free = free_heap_bits;
...@@ -462,7 +461,7 @@ BOOL nulldrv_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, ULONG nvert, ...@@ -462,7 +461,7 @@ BOOL nulldrv_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, ULONG nvert,
rgn = CreateRectRgn( 0, 0, 0, 0 ); rgn = CreateRectRgn( 0, 0, 0, 0 );
gradient_bitmapinfo( info, bits.ptr, vert_array, nvert, grad_array, ngrad, mode, pts, rgn ); gradient_bitmapinfo( info, bits.ptr, vert_array, nvert, grad_array, ngrad, mode, pts, rgn );
OffsetRgn( rgn, dst.visrect.left, dst.visrect.top ); 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 ); if (bits.free) bits.free( &bits );
DeleteObject( rgn ); DeleteObject( rgn );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment