From f63f322ecba08914a171fd20b0382837164963ea Mon Sep 17 00:00:00 2001 From: Christoph von Wittich Date: Mon, 26 Nov 2007 20:45:05 +0000 Subject: [PATCH] fix TAG_BITMAP redzone overwrite for colordepths != 32 bit svn path=/trunk/; revision=30790 --- .../win32/win32k/ntuser/cursoricon.c | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/reactos/subsystems/win32/win32k/ntuser/cursoricon.c b/reactos/subsystems/win32/win32k/ntuser/cursoricon.c index 1460c0d85b2..5a77bce453f 100644 --- a/reactos/subsystems/win32/win32k/ntuser/cursoricon.c +++ b/reactos/subsystems/win32/win32k/ntuser/cursoricon.c @@ -1401,8 +1401,7 @@ UserDrawIconEx( } /* NtGdiCreateCompatibleBitmap will create a monochrome bitmap - when cxWidth or cyHeight is 0 - */ + when cxWidth or cyHeight is 0 */ if ((bmpColor.bmBitsPixel == 32) && (cxWidth != 0) && (cyHeight != 0)) { bAlpha = TRUE; @@ -1425,6 +1424,9 @@ UserDrawIconEx( if (DoFlickerFree || bAlpha) { RECT r; + BITMAP bm; + BITMAPOBJ *BitmapObj = NULL; + r.right = cxWidth; r.bottom = cyHeight; @@ -1442,6 +1444,21 @@ UserDrawIconEx( goto cleanup; } + /* make sure we have a 32 bit offscreen bitmap + otherwise we can't do alpha blending */ + BitmapObj = BITMAPOBJ_LockBitmap(hbmOff); + if (BitmapObj == NULL) + { + DPRINT1("GDIOBJ_LockObj() failed!\n"); + goto cleanup; + } + BITMAP_GetObject(BitmapObj, sizeof(BITMAP), &bm); + + if (bm.bmBitsPixel != 32) + bAlpha = FALSE; + + BITMAPOBJ_UnlockBitmap(BitmapObj); + hOldOffBmp = NtGdiSelectObject(hdcOff, hbmOff); if (!hOldOffBmp) {