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