From c2e449ca08b98fc734d83a2c42cc8c1bc694c929 Mon Sep 17 00:00:00 2001 From: Christoph von Wittich Date: Wed, 28 Jan 2009 11:55:56 +0000 Subject: [PATCH] update bi->biBitCount before using it - fixes 5 gdi32 bitmap winetests svn path=/trunk/; revision=39172 --- .../subsystems/win32/win32k/objects/dibobj.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/reactos/subsystems/win32/win32k/objects/dibobj.c b/reactos/subsystems/win32/win32k/objects/dibobj.c index a24ef3ab665..de4b19385be 100644 --- a/reactos/subsystems/win32/win32k/objects/dibobj.c +++ b/reactos/subsystems/win32/win32k/objects/dibobj.c @@ -1476,15 +1476,6 @@ DIB_CreateDIBSection( NtGdiDeleteObject(bmp); return NULL; } - bmp->hDIBSection = section; - bmp->hSecure = hSecure; - bmp->dwOffset = offset; - bmp->flFlags = BITMAPOBJ_IS_APIBITMAP; - bmp->dsBitfields[0] = dsBitfields[0]; - bmp->dsBitfields[1] = dsBitfields[1]; - 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, @@ -1496,6 +1487,16 @@ DIB_CreateDIBSection( if(bi->biBitCount == 4) { bi->biClrUsed = 16; } else if(bi->biBitCount == 8) { bi->biClrUsed = 256; } + bmp->hDIBSection = section; + bmp->hSecure = hSecure; + bmp->dwOffset = offset; + bmp->flFlags = BITMAPOBJ_IS_APIBITMAP; + bmp->dsBitfields[0] = dsBitfields[0]; + bmp->dsBitfields[1] = dsBitfields[1]; + bmp->dsBitfields[2] = dsBitfields[2]; + bmp->biClrUsed = bi->biClrUsed; + bmp->biClrImportant = bi->biClrImportant; + if (bi->biClrUsed != 0) bmp->hDIBPalette = PALETTE_AllocPaletteIndexedRGB(bi->biClrUsed, lpRGB); else