Author: tkreuzer Date: Fri Apr 27 16:46:12 2012 New Revision: 56439
URL: http://svn.reactos.org/svn/reactos?rev=56439&view=rev Log: [WIN32K] - In NtGdiSetPixel, return the real RGB value, which is the target format color translated back to RGB, not the desired RGB value. Fixes a few bitmap winetest. - Handle a too large index in PALETTE_ulGetRGBColorFromIndex
Modified: trunk/reactos/win32ss/gdi/ntgdi/bitblt.c trunk/reactos/win32ss/gdi/ntgdi/palette.h
Modified: trunk/reactos/win32ss/gdi/ntgdi/bitblt.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/bitblt.c?... ============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/bitblt.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/bitblt.c [iso-8859-1] Fri Apr 27 16:46:12 2012 @@ -37,7 +37,6 @@
/* Get the RGB value */ crColor = PALETTE_ulGetRGBColorFromIndex(ppalDC, index); - *pcrColor = crColor; break;
case 0x02: /* PALETTERGB */ @@ -48,7 +47,6 @@
/* Get the RGB value */ crColor = PALETTE_ulGetRGBColorFromIndex(ppalDC, index); - *pcrColor = crColor; break;
case 0x10: /* DIBINDEX */ @@ -62,10 +60,7 @@
/* Translate the color to RGB for the caller */ ppalSurface = pdc->dclevel.pSurface->ppal; - if (index < ppalSurface->NumColors) - *pcrColor = PALETTE_ulGetRGBColorFromIndex(ppalSurface, index); - else - *pcrColor = 0; + *pcrColor = PALETTE_ulGetRGBColorFromIndex(ppalSurface, index); return index;
default: @@ -74,17 +69,27 @@ }
/* Initialize an XLATEOBJ from RGB to the target surface */ + ppalSurface = pdc->dclevel.pSurface->ppal; + EXLATEOBJ_vInitialize(&exlo, &gpalRGB, ppalSurface, 0xFFFFFF, 0, 0); + + /* Translate the color to the target format */ + ulColor = XLATEOBJ_iXlate(&exlo.xlo, crColor); + + /* Cleanup the XLATEOBJ */ + EXLATEOBJ_vCleanup(&exlo); + + /* Initialize an XLATEOBJ from the target surface to RGB */ EXLATEOBJ_vInitialize(&exlo, + ppalSurface, &gpalRGB, - pdc->dclevel.pSurface->ppal, 0, pdc->pdcattr->crBackgroundClr, pdc->pdcattr->crForegroundClr);
- /* Translate the color to the target format */ - ulColor = XLATEOBJ_iXlate(&exlo.xlo, crColor); - - /* Cleanup and return the RGB value */ + /* Translate the color back to RGB */ + *pcrColor = XLATEOBJ_iXlate(&exlo.xlo, ulColor); + + /* Cleanup and return the target format color */ EXLATEOBJ_vCleanup(&exlo); return ulColor; }
Modified: trunk/reactos/win32ss/gdi/ntgdi/palette.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/palette.h... ============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/palette.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/palette.h [iso-8859-1] Fri Apr 27 16:46:12 2012 @@ -100,6 +100,7 @@ ULONG PALETTE_ulGetRGBColorFromIndex(PPALETTE ppal, ULONG ulIndex) { + if (ulIndex >= ppal->NumColors) return 0; return RGB(ppal->IndexedColors[ulIndex].peRed, ppal->IndexedColors[ulIndex].peGreen, ppal->IndexedColors[ulIndex].peBlue);