From 06332c431c642202195856b7fc818acc3671b199 Mon Sep 17 00:00:00 2001 From: Gregor Schneider Date: Tue, 6 Jan 2009 17:12:07 +0000 Subject: [PATCH] - Fix a coordinate problem that occurred with alphablend in DrawIconEx (32bpp mode only) - Welcome back mixer icon in 32bpp mode! - Note for other invisible icons in that mode: 32bpp icon variants are most likely missing in the *.ico file; ReactOS image bpp conversion functions currently clear the alpha channel -> invisibility - Update function names in debug prints, remove duplicate code, slightly improve code readability svn path=/trunk/; revision=38607 --- .../win32/win32k/ntuser/cursoricon.c | 48 ++++++++++--------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/reactos/subsystems/win32/win32k/ntuser/cursoricon.c b/reactos/subsystems/win32/win32k/ntuser/cursoricon.c index 1662b594e3c..067abfc4191 100644 --- a/reactos/subsystems/win32/win32k/ntuser/cursoricon.c +++ b/reactos/subsystems/win32/win32k/ntuser/cursoricon.c @@ -1569,7 +1569,7 @@ UserDrawIconEx( BitmapObj = BITMAPOBJ_LockBitmap(hbmOff); if (BitmapObj == NULL) { - DPRINT1("GDIOBJ_LockObj() failed!\n"); + DPRINT1("BITMAPOBJ_LockBitmap() failed!\n"); goto cleanup; } BITMAP_GetObject(BitmapObj, sizeof(BITMAP), (PVOID)&bm); @@ -1591,7 +1591,7 @@ UserDrawIconEx( hOldOffBrush = NtGdiSelectBrush(hdcOff, hbrFlickerFreeDraw); if (!hOldOffBrush) { - DPRINT1("NtGdiSelectBitmap() failed!\n"); + DPRINT1("NtGdiSelectBrush() failed!\n"); goto cleanup; } @@ -1622,21 +1622,18 @@ UserDrawIconEx( goto cleanup; } - DoStretchBlt(hdcOff, (DoFlickerFree ? 0 : xLeft), - (DoFlickerFree ? 0 : yTop), cxWidth, cyHeight, hdcMem, - 0, 0, IconSize.cx, IconSize.cy, - ((diFlags & DI_IMAGE) ? SRCAND : SRCCOPY), FALSE); - - if (!hbmColor && (bmpMask.bmHeight == 2 * bmpMask.bmWidth) - && (diFlags & DI_IMAGE)) - { - DoStretchBlt(hdcOff, (DoFlickerFree ? 0 : xLeft), - (DoFlickerFree ? 0 : yTop), cxWidth, cyHeight, hdcMem, - 0, IconSize.cy, IconSize.cx, IconSize.cy, SRCINVERT, - FALSE); - - diFlags &= ~DI_IMAGE; - } + DoStretchBlt(hdcOff, + (DoFlickerFree || bAlpha ? 0 : xLeft), + (DoFlickerFree || bAlpha ? 0 : yTop), + cxWidth, + cyHeight, + hdcMem, + 0, + 0, + IconSize.cx, + IconSize.cy, + ((diFlags & DI_IMAGE) ? SRCAND : SRCCOPY), + FALSE); NtGdiSelectBitmap(hdcMem, hOldMem); } @@ -1645,9 +1642,16 @@ UserDrawIconEx( { hOldMem = NtGdiSelectBitmap(hdcMem, (hbmColor ? hbmColor : hbmMask)); - DoStretchBlt(hdcOff, (DoFlickerFree ? 0 : xLeft), - (DoFlickerFree ? 0 : yTop), cxWidth, cyHeight, hdcMem, - 0, (hbmColor ? 0 : IconSize.cy), IconSize.cx, IconSize.cy, + DoStretchBlt(hdcOff, + (DoFlickerFree || bAlpha ? 0 : xLeft), + (DoFlickerFree || bAlpha ? 0 : yTop), + cxWidth, + cyHeight, + hdcMem, + 0, + (hbmColor ? 0 : IconSize.cy), + IconSize.cx, + IconSize.cy, ((diFlags & DI_MASK) ? SRCINVERT : SRCCOPY), NULL != hbmColor); @@ -1659,7 +1663,7 @@ UserDrawIconEx( BITMAP bm; BITMAPOBJ *BitmapObj = NULL; PBYTE pBits = NULL; - BLENDFUNCTION BlendFunc; + BLENDFUNCTION BlendFunc; DWORD Pixel; BYTE Red, Green, Blue, Alpha; DWORD Count = 0; @@ -1668,7 +1672,7 @@ UserDrawIconEx( BitmapObj = BITMAPOBJ_LockBitmap(hbmOff); if (BitmapObj == NULL) { - DPRINT1("GDIOBJ_LockObj() failed!\n"); + DPRINT1("BITMAPOBJ_LockBitmap() failed!\n"); goto cleanup; } BITMAP_GetObject(BitmapObj, sizeof(BITMAP), (PVOID)&bm);