From 09a8680165af150b5175c8d970b1d53c929cd35a Mon Sep 17 00:00:00 2001 From: Magnus Olsen Date: Sun, 3 Sep 2006 22:54:22 +0000 Subject: [PATCH] Adding small hack to getting SetPixel color right when it is more that 3 bytes long. This hack allown us pass one more test. (Debuging in progress) svn path=/trunk/; revision=23904 --- .../subsystems/win32/win32k/objects/bitmaps.c | 30 +++++++++++++++---- 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/reactos/subsystems/win32/win32k/objects/bitmaps.c b/reactos/subsystems/win32/win32k/objects/bitmaps.c index 678400b88b9..016271a02f3 100644 --- a/reactos/subsystems/win32/win32k/objects/bitmaps.c +++ b/reactos/subsystems/win32/win32k/objects/bitmaps.c @@ -485,14 +485,16 @@ BITMAP_Cleanup(PVOID ObjectBody) { if (pBmp->dib == NULL) { - ExFreePool(pBmp->SurfObj.pvBits); + if (pBmp->SurfObj.pvBits != NULL) + ExFreePool(pBmp->SurfObj.pvBits); } else { - EngFreeUserMem(pBmp->SurfObj.pvBits); + if (pBmp->SurfObj.pvBits != NULL) + EngFreeUserMem(pBmp->SurfObj.pvBits); } - if (pBmp->hDIBPalette) - { + if (pBmp->hDIBPalette != NULL) + { NtGdiDeleteObject(pBmp->hDIBPalette); } } @@ -1066,11 +1068,27 @@ NtGdiSetPixel( INT Y, COLORREF Color) { + + DPRINT1("0 NtGdiSetPixel X %ld Y %ld C %ld\n",X,Y,Color); + + if (((Color>>24) & 0xff)<0x10) + { + Color = ((Color>>16) & 0x0000ff) | ((Color<<16) & 0xff0000) | (Color & 0x00ff00); + } + + DPRINT1("0 NtGdiSetPixel X %ld Y %ld C %ld\n",X,Y,Color); + if (NtGdiSetPixelV(hDC,X,Y,Color)) { - return NtGdiGetPixel(hDC,X,Y); + Color = NtGdiGetPixel(hDC,X,Y); + DPRINT1("1 NtGdiSetPixel X %ld Y %ld C %ld\n",X,Y,Color); + return Color; + } - return ((COLORREF) -1); + + Color = ((COLORREF) -1); + DPRINT1("2 NtGdiSetPixel X %ld Y %ld C %ld\n",X,Y,Color); + return Color; } BOOL STDCALL