Commit d03d23d9 authored by Huw D M Davies's avatar Huw D M Davies Committed by Alexandre Julliard

Fix allocation size in CreateDIBPatternBrush*.

parent ea495f0d
...@@ -113,8 +113,9 @@ HBRUSH16 WINAPI CreateDIBPatternBrush16( HGLOBAL16 hbitmap, UINT16 coloruse ) ...@@ -113,8 +113,9 @@ HBRUSH16 WINAPI CreateDIBPatternBrush16( HGLOBAL16 hbitmap, UINT16 coloruse )
if (info->bmiHeader.biCompression) if (info->bmiHeader.biCompression)
size = info->bmiHeader.biSizeImage; size = info->bmiHeader.biSizeImage;
else else
size = (info->bmiHeader.biWidth * info->bmiHeader.biBitCount + 31) / 32 size = DIB_GetDIBWidthBytes(info->bmiHeader.biWidth,
* 8 * info->bmiHeader.biHeight; info->bmiHeader.biBitCount) *
info->bmiHeader.biHeight;
size += DIB_BitmapInfoSize( info, coloruse ); size += DIB_BitmapInfoSize( info, coloruse );
if (!(logbrush.lbHatch = (INT16)GlobalAlloc16( GMEM_MOVEABLE, size ))) if (!(logbrush.lbHatch = (INT16)GlobalAlloc16( GMEM_MOVEABLE, size )))
...@@ -162,8 +163,9 @@ HBRUSH32 WINAPI CreateDIBPatternBrush32( ...@@ -162,8 +163,9 @@ HBRUSH32 WINAPI CreateDIBPatternBrush32(
if (info->bmiHeader.biCompression) if (info->bmiHeader.biCompression)
size = info->bmiHeader.biSizeImage; size = info->bmiHeader.biSizeImage;
else else
size = (info->bmiHeader.biWidth * info->bmiHeader.biBitCount + 31) / 32 size = DIB_GetDIBWidthBytes(info->bmiHeader.biWidth,
* 8 * info->bmiHeader.biHeight; info->bmiHeader.biBitCount) *
info->bmiHeader.biHeight;
size += DIB_BitmapInfoSize( info, coloruse ); size += DIB_BitmapInfoSize( info, coloruse );
if (!(logbrush.lbHatch = (INT32)GlobalAlloc16( GMEM_MOVEABLE, size ))) if (!(logbrush.lbHatch = (INT32)GlobalAlloc16( GMEM_MOVEABLE, size )))
...@@ -174,7 +176,7 @@ HBRUSH32 WINAPI CreateDIBPatternBrush32( ...@@ -174,7 +176,7 @@ HBRUSH32 WINAPI CreateDIBPatternBrush32(
newInfo = (BITMAPINFO *) GlobalLock16( (HGLOBAL16)logbrush.lbHatch ); newInfo = (BITMAPINFO *) GlobalLock16( (HGLOBAL16)logbrush.lbHatch );
memcpy( newInfo, info, size ); memcpy( newInfo, info, size );
GlobalUnlock16( (HGLOBAL16)logbrush.lbHatch ); GlobalUnlock16( (HGLOBAL16)logbrush.lbHatch );
GlobalUnlock16( hbitmap ); GlobalUnlock32( hbitmap );
return CreateBrushIndirect32( &logbrush ); return CreateBrushIndirect32( &logbrush );
} }
...@@ -200,7 +202,7 @@ HBRUSH32 WINAPI CreateDIBPatternBrushPt32( ...@@ -200,7 +202,7 @@ HBRUSH32 WINAPI CreateDIBPatternBrushPt32(
BITMAPINFO *newInfo; BITMAPINFO *newInfo;
INT32 size; INT32 size;
TRACE(gdi, "%04x\n", info ); TRACE(gdi, "%p\n", info );
/* Make a copy of the bitmap */ /* Make a copy of the bitmap */
...@@ -208,8 +210,9 @@ HBRUSH32 WINAPI CreateDIBPatternBrushPt32( ...@@ -208,8 +210,9 @@ HBRUSH32 WINAPI CreateDIBPatternBrushPt32(
if (info->bmiHeader.biCompression) if (info->bmiHeader.biCompression)
size = info->bmiHeader.biSizeImage; size = info->bmiHeader.biSizeImage;
else else
size = (info->bmiHeader.biWidth * info->bmiHeader.biBitCount + 31) / 32 size = DIB_GetDIBWidthBytes(info->bmiHeader.biWidth,
* 8 * info->bmiHeader.biHeight; info->bmiHeader.biBitCount) *
info->bmiHeader.biHeight;
size += DIB_BitmapInfoSize( info, coloruse ); size += DIB_BitmapInfoSize( info, coloruse );
if (!(logbrush.lbHatch = (INT32)GlobalAlloc16( GMEM_MOVEABLE, size ))) if (!(logbrush.lbHatch = (INT32)GlobalAlloc16( GMEM_MOVEABLE, size )))
......
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