winex11: Fix GetDIBits of 1 bit DDBs.

1 bpp DDBs seem to always carry an implicit palette of black and white,
regardless of what the DC says. Based on a patch from Eric Pouech.
This commit is contained in:
Michael Karcher 2008-06-29 13:30:21 +02:00 committed by Alexandre Julliard
parent fd8746b43c
commit 8da833494d
2 changed files with 14 additions and 6 deletions

View File

@ -1190,10 +1190,7 @@ static void test_GetDIBits_selected_DIB(UINT bpp)
break;
}
}
if (bpp != 1)
ok(equalContents, "GetDIBits with %d bpp DIB selected in DC: Invalid DIB bits\n",bpp);
else
todo_wine ok(equalContents, "GetDIBits with %d bpp DIB selected in DC: Invalid DIB bits\n",bpp);
HeapFree(GetProcessHeap(), 0, bits2);
DeleteDC(dc);

View File

@ -4031,13 +4031,24 @@ INT X11DRV_GetDIBits( X11DRV_PDEVICE *physDev, HBITMAP hbitmap, UINT startscan,
int bitmap_type;
BOOL core_header;
void* colorPtr;
GetPaletteEntries( GetCurrentObject( physDev->hdc, OBJ_PAL ), 0, 256, palette );
const PALETTEENTRY peBlack = {0,0,0,0};
const PALETTEENTRY peWhite = {255,255,255,0};
if (!physBitmap) return 0;
if (!(obj_size = GetObjectW( hbitmap, sizeof(dib), &dib ))) return 0;
bitmap_type = DIB_GetBitmapInfo( (BITMAPINFOHEADER*)info, &width, &tempHeight, &descr.infoBpp, &descr.compression);
if (physDev->depth > 1)
{
GetPaletteEntries( GetCurrentObject( physDev->hdc, OBJ_PAL ), 0, 256, palette );
}
else
{
palette[0] = peBlack;
palette[1] = peWhite;
}
if (bitmap_type == -1)
{
ERR("Invalid bitmap\n");