Author: cwittich Date: Wed Jan 28 05:55:56 2009 New Revision: 39172
URL: http://svn.reactos.org/svn/reactos?rev=39172&view=rev Log: update bi->biBitCount before using it - fixes 5 gdi32 bitmap winetests
Modified: trunk/reactos/subsystems/win32/win32k/objects/dibobj.c
Modified: trunk/reactos/subsystems/win32/win32k/objects/dibobj.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/obj... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/dibobj.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/dibobj.c [iso-8859-1] Wed Jan 28 05:55:56 2009 @@ -1476,6 +1476,17 @@ NtGdiDeleteObject(bmp); return NULL; } + + /* WINE NOTE: WINE makes use of a colormap, which is a color translation + table between the DIB and the X physical device. Obviously, + this is left out of the ReactOS implementation. Instead, + we call NtGdiSetDIBColorTable. */ + bi->biClrUsed = 0; + /* set number of entries in bmi.bmiColors table */ + if(bi->biBitCount == 1) { bi->biClrUsed = 2; } else + if(bi->biBitCount == 4) { bi->biClrUsed = 16; } else + if(bi->biBitCount == 8) { bi->biClrUsed = 256; } + bmp->hDIBSection = section; bmp->hSecure = hSecure; bmp->dwOffset = offset; @@ -1485,16 +1496,6 @@ bmp->dsBitfields[2] = dsBitfields[2]; bmp->biClrUsed = bi->biClrUsed; bmp->biClrImportant = bi->biClrImportant; - - /* WINE NOTE: WINE makes use of a colormap, which is a color translation - table between the DIB and the X physical device. Obviously, - this is left out of the ReactOS implementation. Instead, - we call NtGdiSetDIBColorTable. */ - bi->biClrUsed = 0; - /* set number of entries in bmi.bmiColors table */ - if(bi->biBitCount == 1) { bi->biClrUsed = 2; } else - if(bi->biBitCount == 4) { bi->biClrUsed = 16; } else - if(bi->biBitCount == 8) { bi->biClrUsed = 256; }
if (bi->biClrUsed != 0) bmp->hDIBPalette = PALETTE_AllocPaletteIndexedRGB(bi->biClrUsed, lpRGB);