gdi32: Don't use the bitfields for the BI_RGB case and also cope with zero masks.

This commit is contained in:
Huw Davies 2011-04-12 12:49:08 +01:00 committed by Alexandre Julliard
parent 673dd73548
commit bb28917bc2
1 changed files with 14 additions and 3 deletions
dlls/gdi32/dibdrv

View File

@ -40,6 +40,12 @@ static void calc_shift_and_len(DWORD mask, int *shift, int *len)
{
int s, l;
if(!mask)
{
*shift = *len = 0;
return;
}
s = 0;
while ((mask & 1) == 0)
{
@ -90,11 +96,16 @@ static BOOL init_dib(dib_info *dib, const BITMAPINFOHEADER *bi, const DWORD *bit
switch(dib->bit_count)
{
case 32:
init_bit_fields(dib, bit_fields);
if(dib->red_mask == 0xff0000 && dib->green_mask == 0x00ff00 && dib->blue_mask == 0x0000ff)
if(bi->biCompression == BI_RGB)
dib->funcs = &funcs_8888;
else
dib->funcs = &funcs_32;
{
init_bit_fields(dib, bit_fields);
if(dib->red_mask == 0xff0000 && dib->green_mask == 0x00ff00 && dib->blue_mask == 0x0000ff)
dib->funcs = &funcs_8888;
else
dib->funcs = &funcs_32;
}
break;
default: