- Fix creation of XLATE in IntEngCreateSrcMonoXlate. It was doing it wrong (colors swapped) and it only worked, because the caller of the function also passed the wrong arguments.

- Mono DIBs need a special handling when creating the XLATEOBJ. Handle this in IntCreateXlateForBlt. Fixes broken colors on google/Firefox page.

svn path=/trunk/; revision=38633
This commit is contained in:
Timo Kreuzer 2009-01-07 20:02:28 +00:00
parent c7aab5aafd
commit 474ed3e076

View file

@ -403,8 +403,9 @@ IntEngCreateSrcMonoXlate(HPALETTE PaletteDest,
XlateGDI->GreenShift = CalculateShift(RGB(0x00, 0xFF, 0x00)) - CalculateShift(XlateGDI->GreenMask); XlateGDI->GreenShift = CalculateShift(RGB(0x00, 0xFF, 0x00)) - CalculateShift(XlateGDI->GreenMask);
XlateGDI->BlueShift = CalculateShift(RGB(0x00, 0x00, 0xFF)) - CalculateShift(XlateGDI->BlueMask); XlateGDI->BlueShift = CalculateShift(RGB(0x00, 0x00, 0xFF)) - CalculateShift(XlateGDI->BlueMask);
XlateObj->pulXlate[0] = ShiftAndMask(XlateGDI, BackgroundColor); /* Yes, that's how Windows works, ... */
XlateObj->pulXlate[1] = ShiftAndMask(XlateGDI, ForegroundColor); XlateObj->pulXlate[1] = ShiftAndMask(XlateGDI, BackgroundColor);
XlateObj->pulXlate[0] = ShiftAndMask(XlateGDI, ForegroundColor);
if (XlateObj->iDstType == PAL_INDEXED) if (XlateObj->iDstType == PAL_INDEXED)
{ {
@ -484,9 +485,24 @@ IntCreateXlateForBlt(PDC pDCDest, PDC pDCSrc, BITMAPOBJ* pDestSurf, BITMAPOBJ* p
{ {
if (pSrcSurf->SurfObj.iBitmapFormat == BMF_1BPP) if (pSrcSurf->SurfObj.iBitmapFormat == BMF_1BPP)
{ {
pDc_Attr = pDCDest->pDc_Attr; /* DIB sections need special handling */
if (!pDc_Attr) pDc_Attr = &pDCDest->Dc_Attr; if (pSrcSurf->dib)
XlateObj = IntEngCreateSrcMonoXlate(DestPalette, pDc_Attr->crBackgroundClr, pDc_Attr->crForegroundClr); {
PPALGDI ppal = PALETTE_LockPalette(pSrcSurf->hDIBPalette);
if (ppal)
{
XlateObj = IntEngCreateSrcMonoXlate(DestPalette, ((ULONG*)ppal->IndexedColors)[0], ((ULONG*)ppal->IndexedColors)[1]);
PALETTE_UnlockPalette(ppal);
}
else
XlateObj = NULL;
}
else
{
pDc_Attr = pDCDest->pDc_Attr;
if (!pDc_Attr) pDc_Attr = &pDCDest->Dc_Attr;
XlateObj = IntEngCreateSrcMonoXlate(DestPalette, pDc_Attr->crForegroundClr, pDc_Attr->crBackgroundClr);
}
} }
else else
{ {
@ -563,7 +579,12 @@ XLATEOBJ_iXlate(XLATEOBJ *XlateObj, ULONG Color)
if (XlateObj->flXlate & XO_TABLE) if (XlateObj->flXlate & XO_TABLE)
{ {
if (Color >= XlateObj->cEntries) if (Color >= XlateObj->cEntries)
Color %= XlateObj->cEntries; {
DPRINT1("+++ Color = 0x%x, XlateObj->flXlate = 0x%x, XlateObj->cEntries = %ld\n",
Color, XlateObj->flXlate, XlateObj->cEntries);
XlateGDI = ObjToGDI(XlateObj, XLATE);
Color %= XlateObj->cEntries;
}
return XlateObj->pulXlate[Color]; return XlateObj->pulXlate[Color];
} }