gdi32: Allocate extra DWORD for EMR_CREATEDIBPATTERNBRUSHPT records.

Like for EMR_CREATEMONOBRUSH.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2021-09-07 14:09:53 +02:00 committed by Alexandre Julliard
parent 08d377c02f
commit d94d1a8b26
1 changed files with 8 additions and 6 deletions

View File

@ -197,9 +197,16 @@ static DWORD emfdc_create_brush( struct emf *emf, HBRUSH brush )
info_size = get_dib_info_size( info, usage );
emr = HeapAlloc( GetProcessHeap(), 0,
sizeof(EMRCREATEDIBPATTERNBRUSHPT)+info_size+info->bmiHeader.biSizeImage );
sizeof(EMRCREATEDIBPATTERNBRUSHPT) + sizeof(DWORD) +
info_size+info->bmiHeader.biSizeImage );
if(!emr) break;
/* FIXME: There is an extra DWORD written by native before the BMI.
* Not sure what it's meant to contain.
*/
emr->offBmi = sizeof( EMRCREATEDIBPATTERNBRUSHPT ) + sizeof(DWORD);
*(DWORD *)(emr + 1) = 0x20000000;
if (logbrush.lbStyle == BS_PATTERN && info->bmiHeader.biBitCount == 1)
{
/* Presumably to reduce the size of the written EMF, MS supports an
@ -211,16 +218,11 @@ static DWORD emfdc_create_brush( struct emf *emf, HBRUSH brush )
*/
emr->emr.iType = EMR_CREATEMONOBRUSH;
usage = DIB_PAL_MONO;
/* FIXME: There is an extra DWORD written by native before the BMI.
* Not sure what it's meant to contain.
*/
emr->offBmi = sizeof( EMRCREATEDIBPATTERNBRUSHPT ) + sizeof(DWORD);
emr->cbBmi = sizeof( BITMAPINFOHEADER );
}
else
{
emr->emr.iType = EMR_CREATEDIBPATTERNBRUSHPT;
emr->offBmi = sizeof( EMRCREATEDIBPATTERNBRUSHPT );
emr->cbBmi = info_size;
}
emr->ihBrush = index = emfdc_add_handle( emf, brush );