Author: gschneider
Date: Sun Dec 27 16:08:41 2009
New Revision: 44769
URL:
http://svn.reactos.org/svn/reactos?rev=44769&view=rev
Log:
[win32k]
- Set the number of mapped colors depending on the usage parameter
- Use pure PALETTERGB color values when no palette is selected
- Fixes true color issue mentioned in r44712
Modified:
trunk/reactos/subsystems/win32/win32k/objects/bitmaps.c
trunk/reactos/subsystems/win32/win32k/objects/dibobj.c
Modified: trunk/reactos/subsystems/win32/win32k/objects/bitmaps.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/bitmaps.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/bitmaps.c [iso-8859-1] Sun Dec 27
16:08:41 2009
@@ -667,7 +667,7 @@
case 0x10: /* DIBINDEX */
if (IntGetDIBColorTable(hDC, LOWORD(*Color), 1, &quad) == 1)
{
- *Color = RGB(quad.rgbRed, quad.rgbGreen, quad.rgbBlue);
+ *Color = RGB(quad.rgbRed, quad.rgbGreen, quad.rgbBlue);
}
else
{
@@ -677,10 +677,16 @@
break;
case 0x02: /* PALETTERGB */
pdc = DC_LockDc(hDC);
- index = NtGdiGetNearestPaletteIndex(pdc->dclevel.hpal, *Color);
- if (IntGetPaletteEntries(pdc->dclevel.hpal, index, 1, &palEntry) ==
1)
- {
- *Color = RGB(palEntry.peRed, palEntry.peGreen, palEntry.peBlue);
+ if (pdc->dclevel.hpal != NtGdiGetStockObject(DEFAULT_PALETTE))
+ {
+ index = NtGdiGetNearestPaletteIndex(pdc->dclevel.hpal, *Color);
+ IntGetPaletteEntries(pdc->dclevel.hpal, index, 1, &palEntry);
+ *Color = RGB(palEntry.peRed, palEntry.peGreen, palEntry.peBlue);
+ }
+ else
+ {
+ /* Use the pure color */
+ *Color = *Color & 0x00FFFFFF;
}
DC_UnlockDc(pdc);
break;
@@ -688,7 +694,7 @@
pdc = DC_LockDc(hDC);
if (IntGetPaletteEntries(pdc->dclevel.hpal, LOWORD(*Color), 1,
&palEntry) == 1)
{
- *Color = RGB(palEntry.peRed, palEntry.peGreen, palEntry.peBlue);
+ *Color = RGB(palEntry.peRed, palEntry.peGreen, palEntry.peBlue);
}
DC_UnlockDc(pdc);
break;
Modified: trunk/reactos/subsystems/win32/win32k/objects/dibobj.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/dibobj.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/dibobj.c [iso-8859-1] Sun Dec 27
16:08:41 2009
@@ -1442,14 +1442,15 @@
if (usage == DIB_PAL_COLORS)
{
lpRGB = DIB_MapPaletteColors(dc, bmi);
+ ColorCount = bi->biClrUsed;
+ if (ColorCount == 0)
+ {
+ ColorCount = 1 << bi->biBitCount;
+ }
}
else
{
lpRGB = bmi->bmiColors;
- }
- ColorCount = bi->biClrUsed;
- if (ColorCount == 0)
- {
ColorCount = 1 << bi->biBitCount;
}