Author: tkreuzer
Date: Wed Jun 9 20:36:04 2010
New Revision: 47724
URL:
http://svn.reactos.org/svn/reactos?rev=47724&view=rev
Log:
[WIN32K]
- Improve readability in SetBMIColor
- Only when BitCount is <= 8, calculate the number of colors in the table
- Fixes a crash with VBox driver
Modified:
branches/reactos-yarotows/subsystems/win32/win32k/objects/dibobj.c
Modified: branches/reactos-yarotows/subsystems/win32/win32k/objects/dibobj.c
URL:
http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win…
==============================================================================
--- branches/reactos-yarotows/subsystems/win32/win32k/objects/dibobj.c [iso-8859-1]
(original)
+++ branches/reactos-yarotows/subsystems/win32/win32k/objects/dibobj.c [iso-8859-1] Wed
Jun 9 20:36:04 2010
@@ -1746,13 +1746,16 @@
VOID
SetBMIColor(CONST BITMAPINFO* pbmi, DWORD* color, INT i)
{
+ PVOID pvColors = ((PBYTE)pbmi + pbmi->bmiHeader.biSize);
if(pbmi->bmiHeader.biSize == sizeof(BITMAPCOREHEADER))
{
- *(RGBTRIPLE*)((PBYTE)pbmi + pbmi->bmiHeader.biSize + i*sizeof(RGBTRIPLE)) =
*(RGBTRIPLE*)color;
+ RGBTRIPLE *pColor = pvColors;
+ pColor[i] = *(RGBTRIPLE*)color;
}
else
{
- *(RGBQUAD*)((PBYTE)pbmi + pbmi->bmiHeader.biSize + i*sizeof(RGBQUAD)) =
*(RGBQUAD*)color;
+ RGBQUAD *pColor = pvColors;
+ pColor[i] = *(RGBQUAD*)color;
}
}
@@ -1954,7 +1957,7 @@
ULONG cColorsUsed;
cColorsUsed = pbmiSrc->bmiHeader.bV5ClrUsed;
- if (cColorsUsed == 0)
+ if (cColorsUsed == 0 && pbmiSrc->bmiHeader.bV5BitCount <= 8)
cColorsUsed = (1 << pbmiSrc->bmiHeader.bV5BitCount);
if(dwColorUse == DIB_PAL_COLORS)