Commit c2784e08 authored by Alexandre Julliard's avatar Alexandre Julliard

gdi32: Improve support of bitmaps without a color table in PutImage.

parent 50d53928
...@@ -871,16 +871,25 @@ done: ...@@ -871,16 +871,25 @@ done:
static BOOL matching_color_info( const dib_info *dib, const BITMAPINFO *info ) static BOOL matching_color_info( const dib_info *dib, const BITMAPINFO *info )
{ {
const RGBQUAD *color_table = info->bmiColors;
switch (info->bmiHeader.biBitCount) switch (info->bmiHeader.biBitCount)
{ {
case 1: case 1:
if (dib->color_table_size != info->bmiHeader.biClrUsed) return FALSE;
return !memcmp( color_table, dib->color_table, dib->color_table_size * sizeof(RGBQUAD) );
case 4: case 4:
case 8: case 8:
{ if (!info->bmiHeader.biClrUsed)
RGBQUAD *color_table = (RGBQUAD *)((char *)info + info->bmiHeader.biSize); {
if (dib->color_table_size != info->bmiHeader.biClrUsed) return FALSE; if (!dib->color_table_size) return TRUE;
if (dib->color_table_size != 1 << info->bmiHeader.biBitCount) return FALSE;
color_table = get_default_color_table( info->bmiHeader.biBitCount );
}
else if (dib->color_table_size != info->bmiHeader.biClrUsed) return FALSE;
return !memcmp( color_table, dib->color_table, dib->color_table_size * sizeof(RGBQUAD) ); return !memcmp( color_table, dib->color_table, dib->color_table_size * sizeof(RGBQUAD) );
}
case 16: case 16:
{ {
......
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