Commit d69dd564 authored by Alexandre Julliard's avatar Alexandre Julliard

gdi32: BS_DIBPATTERN brushes use a 32-bit handle in 32-bit mode.

parent f3b9fb55
......@@ -53,10 +53,10 @@ static const struct gdi_obj_funcs brush_funcs =
BRUSH_DeleteObject /* pDeleteObject */
};
static HGLOBAL16 dib_copy(const BITMAPINFO *info, UINT coloruse)
static HGLOBAL dib_copy(const BITMAPINFO *info, UINT coloruse)
{
BITMAPINFO *newInfo;
HGLOBAL16 hmem;
HGLOBAL hmem;
INT size;
if (info->bmiHeader.biCompression != BI_RGB && info->bmiHeader.biCompression != BI_BITFIELDS)
......@@ -67,13 +67,13 @@ static HGLOBAL16 dib_copy(const BITMAPINFO *info, UINT coloruse)
info->bmiHeader.biBitCount);
size += bitmap_info_size( info, coloruse );
if (!(hmem = GlobalAlloc16( GMEM_MOVEABLE, size )))
if (!(hmem = GlobalAlloc( GMEM_MOVEABLE, size )))
{
return 0;
}
newInfo = GlobalLock16( hmem );
newInfo = GlobalLock( hmem );
memcpy( newInfo, info, size );
GlobalUnlock16( hmem );
GlobalUnlock( hmem );
return hmem;
}
......@@ -133,7 +133,7 @@ HBRUSH WINAPI CreateBrushIndirect( const LOGBRUSH * brush )
ptr->logbrush.lbStyle = BS_DIBPATTERN;
if (!(bmi = GlobalLock( h ))) goto error;
ptr->logbrush.lbHatch = dib_copy( bmi, ptr->logbrush.lbColor);
ptr->logbrush.lbHatch = (ULONG_PTR)dib_copy( bmi, ptr->logbrush.lbColor);
GlobalUnlock( h );
if (!ptr->logbrush.lbHatch) goto error;
break;
......@@ -156,7 +156,7 @@ HBRUSH WINAPI CreateBrushIndirect( const LOGBRUSH * brush )
if (ptr->logbrush.lbStyle == BS_PATTERN)
DeleteObject( (HGDIOBJ)ptr->logbrush.lbHatch );
else if (ptr->logbrush.lbStyle == BS_DIBPATTERN)
GlobalFree16( (HGLOBAL16)ptr->logbrush.lbHatch );
GlobalFree( (HGLOBAL)ptr->logbrush.lbHatch );
}
HeapFree( GetProcessHeap(), 0, ptr );
return 0;
......@@ -423,7 +423,7 @@ static BOOL BRUSH_DeleteObject( HGDIOBJ handle )
DeleteObject( (HGDIOBJ)brush->logbrush.lbHatch );
break;
case BS_DIBPATTERN:
GlobalFree16( (HGLOBAL16)brush->logbrush.lbHatch );
GlobalFree( (HGLOBAL)brush->logbrush.lbHatch );
break;
}
return HeapFree( GetProcessHeap(), 0, brush );
......
......@@ -166,7 +166,7 @@ DWORD EMFDRV_CreateBrushIndirect( PHYSDEV dev, HBRUSH hBrush )
{
EMRCREATEDIBPATTERNBRUSHPT *emr;
DWORD bmSize, biSize, size;
BITMAPINFO *info = GlobalLock16(logbrush.lbHatch);
BITMAPINFO *info = GlobalLock( (HGLOBAL)logbrush.lbHatch );
if (info->bmiHeader.biCompression)
bmSize = info->bmiHeader.biSizeImage;
......@@ -192,7 +192,7 @@ DWORD EMFDRV_CreateBrushIndirect( PHYSDEV dev, HBRUSH hBrush )
if(!EMFDRV_WriteRecord( dev, &emr->emr ))
index = 0;
HeapFree( GetProcessHeap(), 0, emr );
GlobalUnlock16(logbrush.lbHatch);
GlobalUnlock( (HGLOBAL)logbrush.lbHatch );
}
break;
......
......@@ -300,7 +300,7 @@ INT16 MFDRV_CreateBrushIndirect(PHYSDEV dev, HBRUSH hBrush )
BITMAPINFO *info;
DWORD bmSize, biSize;
info = GlobalLock16((HGLOBAL16)logbrush.lbHatch);
info = GlobalLock( (HGLOBAL)logbrush.lbHatch );
if (info->bmiHeader.biCompression)
bmSize = info->bmiHeader.biSizeImage;
else
......@@ -310,12 +310,17 @@ INT16 MFDRV_CreateBrushIndirect(PHYSDEV dev, HBRUSH hBrush )
biSize = bitmap_info_size(info, LOWORD(logbrush.lbColor));
size = sizeof(METARECORD) + biSize + bmSize + 2;
mr = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
if(!mr) goto done;
if (!mr)
{
GlobalUnlock( (HGLOBAL)logbrush.lbHatch );
goto done;
}
mr->rdFunction = META_DIBCREATEPATTERNBRUSH;
mr->rdSize = size / 2;
*(mr->rdParm) = logbrush.lbStyle;
*(mr->rdParm + 1) = LOWORD(logbrush.lbColor);
memcpy(mr->rdParm + 2, info, biSize + bmSize);
GlobalUnlock( (HGLOBAL)logbrush.lbHatch );
break;
}
default:
......
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