gdi32: Don't copy biSizeImage in copy_color_info().

It meant there was a hack which incorrectly changed the corresponding value in src_info.

Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Huw Davies 2017-02-13 14:07:58 +00:00 committed by Alexandre Julliard
parent eba9294d9e
commit 9d0338bc4f
2 changed files with 9 additions and 4 deletions

View File

@ -1051,8 +1051,7 @@ static void copy_color_info(BITMAPINFO *dst, const BITMAPINFO *src, UINT colorus
}
else
{
dst->bmiHeader.biClrUsed = src->bmiHeader.biClrUsed;
dst->bmiHeader.biSizeImage = src->bmiHeader.biSizeImage;
dst->bmiHeader.biClrUsed = src->bmiHeader.biClrUsed;
if (src->bmiHeader.biCompression == BI_BITFIELDS)
/* bitfields are always at bmiColors even in larger structures */
@ -1388,7 +1387,6 @@ INT WINAPI GetDIBits(
}
break;
}
src_info->bmiHeader.biSizeImage = get_dib_image_size( dst_info );
copy_color_info( dst_info, src_info, coloruse );
}
else if (dst_info->bmiHeader.biBitCount <= 8) /* otherwise construct a default colour table for the dst, if needed */
@ -1409,6 +1407,7 @@ INT WINAPI GetDIBits(
dst_info->bmiHeader.biHeight = src.height;
else
dst_info->bmiHeader.biHeight = -src.height;
dst_info->bmiHeader.biSizeImage = get_dib_image_size( dst_info );
convert_bitmapinfo( src_info, src_bits.ptr, &src, dst_info, bits );
if (src_bits.free) src_bits.free( &src_bits );
@ -1425,7 +1424,11 @@ INT WINAPI GetDIBits(
}
copy_color_info( info, dst_info, coloruse );
if (info->bmiHeader.biSize != sizeof(BITMAPCOREHEADER)) info->bmiHeader.biClrUsed = 0;
if (info->bmiHeader.biSize != sizeof(BITMAPCOREHEADER))
{
info->bmiHeader.biClrUsed = 0;
info->bmiHeader.biSizeImage = get_dib_image_size( info );
}
done:
release_dc_ptr( dc );

View File

@ -4303,8 +4303,10 @@ static void test_GetDIBits_scanlines(void)
memset( data, 0xaa, sizeof(data) );
info->bmiHeader.biHeight = 16;
info->bmiHeader.biSizeImage = 0;
ret = GetDIBits( hdc, dib, 1, 12, data, info, DIB_RGB_COLORS );
ok( ret == 5, "got %d\n", ret );
ok( info->bmiHeader.biSizeImage == 128 * 4, "got %d\n", info->bmiHeader.biSizeImage );
for (i = 0; i < 56; i++) ok( data[i] == 0, "%d: got %08x\n", i, data[i] );
ok( !memcmp( data + 56, dib_bits, 40 * 4 ), "bits differ\n");
for (i = 96; i < 128; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08x\n", i, data[i] );