Handle BITMAPV4HEADER and BITMAPV5HEADER, when creating a DIB palette. Detect PAL_RGB like done with PAL_BGR in PALETTE_AllocPalette (optimization).
Fixes pink icons.

svn path=/trunk/; revision=50676
This commit is contained in:
Timo Kreuzer 2011-02-12 20:30:09 +00:00
parent f0395ac74a
commit f1debffcda
2 changed files with 15 additions and 3 deletions

View file

@ -1750,9 +1750,19 @@ BuildDIBPalette(CONST BITMAPINFO *bmi)
else if (bmi->bmiHeader.biCompression == BI_BITFIELDS)
{
paletteType = PAL_BITFIELDS;
RedMask = pdwColors[0];
GreenMask = pdwColors[1];
BlueMask = pdwColors[2];
if (bmi->bmiHeader.biSize >= sizeof(BITMAPV4HEADER))
{
PBITMAPV4HEADER pV4Header = (PBITMAPV4HEADER)&bmi->bmiHeader;
RedMask = pV4Header->bV4RedMask;
GreenMask = pV4Header->bV4GreenMask;
BlueMask = pV4Header->bV4BlueMask;
}
else
{
RedMask = pdwColors[0];
GreenMask = pdwColors[1];
BlueMask = pdwColors[2];
}
}
else
{

View file

@ -197,6 +197,8 @@ PALETTE_AllocPalette(ULONG Mode,
PalGDI->flFlags |= PAL_RGB16_565;
else if (Red == 0xFF0000 && Green == 0xFF00 && Blue == 0xFF)
PalGDI->flFlags |= PAL_BGR;
else if (Red == 0xFF && Green == 0xFF00 && Blue == 0xFF0000)
PalGDI->flFlags |= PAL_RGB;
}
PALETTE_UnlockPalette(PalGDI);