From 6b75ed4ae343f58f766b3819df8625b3ec9576b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Gardou?= Date: Mon, 31 May 2010 14:19:37 +0000 Subject: [PATCH] [WIN32K] UserDrawIconEx - There is no need to recalculate size of the Icon, we already have this piece of information - Draw monochrome cursor/icons, not only their mask. svn path=/branches/reactos-yarotows/; revision=47495 --- subsystems/win32/win32k/ntuser/cursoricon.c | 47 ++++++++++++--------- 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/subsystems/win32/win32k/ntuser/cursoricon.c b/subsystems/win32/win32k/ntuser/cursoricon.c index 2e35f425ecd..b40acd50c5e 100644 --- a/subsystems/win32/win32k/ntuser/cursoricon.c +++ b/subsystems/win32/win32k/ntuser/cursoricon.c @@ -1326,7 +1326,6 @@ UserDrawIconEx( HBITMAP hbmMask, hbmColor; BITMAP bmpColor, bm; BOOL DoFlickerFree; - SIZE IconSize; INT iOldBkColor = 0, iOldTxtColor = 0; HDC hMemDC, hDestDC = hDc; @@ -1358,17 +1357,6 @@ UserDrawIconEx( return FALSE; } - if (hbmColor) - { - IconSize.cx = bmpColor.bmWidth; - IconSize.cy = bmpColor.bmHeight; - } - else /* take it from mask */ - { - IconSize.cx = bm.bmWidth; - IconSize.cy = bm.bmHeight/2; - } - /* NtGdiCreateCompatibleBitmap will create a monochrome bitmap when cxWidth or cyHeight is 0 */ if (hbmColor @@ -1407,11 +1395,11 @@ UserDrawIconEx( if (!cxWidth) cxWidth = ((diFlags & DI_DEFAULTSIZE) ? - UserGetSystemMetrics(SM_CXICON) : IconSize.cx); + UserGetSystemMetrics(SM_CXICON) : pIcon->Size.cx); if (!cyHeight) cyHeight = ((diFlags & DI_DEFAULTSIZE) ? - UserGetSystemMetrics(SM_CYICON) : IconSize.cy); + UserGetSystemMetrics(SM_CYICON) : pIcon->Size.cy); DoFlickerFree = (hbrFlickerFreeDraw && (GDI_HANDLE_GET_TYPE(hbrFlickerFreeDraw) == GDI_OBJECT_TYPE_BRUSH)); @@ -1453,8 +1441,8 @@ UserDrawIconEx( hMemDC, 0, 0, - IconSize.cx, - IconSize.cy, + pIcon->Size.cx, + pIcon->Size.cy, SRCAND, 0); NtGdiSelectBitmap(hMemDC, hTmpBmp); @@ -1535,8 +1523,8 @@ UserDrawIconEx( hMemDC, 0, 0, - IconSize.cx, - IconSize.cy, + pIcon->Size.cx, + pIcon->Size.cy, pixelblend, NULL); NtGdiSelectBitmap(hMemDC, hTmpBmp); @@ -1556,8 +1544,27 @@ UserDrawIconEx( hMemDC, 0, 0, - IconSize.cx, - IconSize.cy, + pIcon->Size.cx, + pIcon->Size.cy, + rop, + 0); + NtGdiSelectBitmap(hMemDC, hTmpBmp); + } + else + { + /* Mask bitmap holds the information in its second half */ + DWORD rop = (diFlags & DI_MASK) ? SRCINVERT : SRCCOPY ; + hTmpBmp = NtGdiSelectBitmap(hMemDC, hbmMask); + NtGdiStretchBlt(hDestDC, + x, + y, + cxWidth, + cyHeight, + hMemDC, + 0, + pIcon->Size.cy, + pIcon->Size.cx, + pIcon->Size.cy, rop, 0); NtGdiSelectBitmap(hMemDC, hTmpBmp);