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:
parent
eba9294d9e
commit
9d0338bc4f
|
@ -1051,8 +1051,7 @@ static void copy_color_info(BITMAPINFO *dst, const BITMAPINFO *src, UINT colorus
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dst->bmiHeader.biClrUsed = src->bmiHeader.biClrUsed;
|
dst->bmiHeader.biClrUsed = src->bmiHeader.biClrUsed;
|
||||||
dst->bmiHeader.biSizeImage = src->bmiHeader.biSizeImage;
|
|
||||||
|
|
||||||
if (src->bmiHeader.biCompression == BI_BITFIELDS)
|
if (src->bmiHeader.biCompression == BI_BITFIELDS)
|
||||||
/* bitfields are always at bmiColors even in larger structures */
|
/* bitfields are always at bmiColors even in larger structures */
|
||||||
|
@ -1388,7 +1387,6 @@ INT WINAPI GetDIBits(
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
src_info->bmiHeader.biSizeImage = get_dib_image_size( dst_info );
|
|
||||||
copy_color_info( dst_info, src_info, coloruse );
|
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 */
|
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;
|
dst_info->bmiHeader.biHeight = src.height;
|
||||||
else
|
else
|
||||||
dst_info->bmiHeader.biHeight = -src.height;
|
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 );
|
convert_bitmapinfo( src_info, src_bits.ptr, &src, dst_info, bits );
|
||||||
if (src_bits.free) src_bits.free( &src_bits );
|
if (src_bits.free) src_bits.free( &src_bits );
|
||||||
|
@ -1425,7 +1424,11 @@ INT WINAPI GetDIBits(
|
||||||
}
|
}
|
||||||
|
|
||||||
copy_color_info( info, dst_info, coloruse );
|
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:
|
done:
|
||||||
release_dc_ptr( dc );
|
release_dc_ptr( dc );
|
||||||
|
|
|
@ -4303,8 +4303,10 @@ static void test_GetDIBits_scanlines(void)
|
||||||
memset( data, 0xaa, sizeof(data) );
|
memset( data, 0xaa, sizeof(data) );
|
||||||
|
|
||||||
info->bmiHeader.biHeight = 16;
|
info->bmiHeader.biHeight = 16;
|
||||||
|
info->bmiHeader.biSizeImage = 0;
|
||||||
ret = GetDIBits( hdc, dib, 1, 12, data, info, DIB_RGB_COLORS );
|
ret = GetDIBits( hdc, dib, 1, 12, data, info, DIB_RGB_COLORS );
|
||||||
ok( ret == 5, "got %d\n", ret );
|
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] );
|
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");
|
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] );
|
for (i = 96; i < 128; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08x\n", i, data[i] );
|
||||||
|
|
Loading…
Reference in New Issue