From d65a3b59a31cd0932e93e77926deb6f402ce46a5 Mon Sep 17 00:00:00 2001 From: Kamil Hornicek Date: Mon, 10 Nov 2014 14:00:02 +0000 Subject: [PATCH] [WIN32K] - fix up icon size before calculating the destination rectangle CORE-8782 svn path=/trunk/; revision=65356 --- reactos/win32ss/user/ntuser/cursoricon_new.c | 41 ++++++++++---------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/reactos/win32ss/user/ntuser/cursoricon_new.c b/reactos/win32ss/user/ntuser/cursoricon_new.c index 69a5011ebdb..bc454d01c91 100644 --- a/reactos/win32ss/user/ntuser/cursoricon_new.c +++ b/reactos/win32ss/user/ntuser/cursoricon_new.c @@ -1175,6 +1175,27 @@ UserDrawIconEx( if(psurfColor) SURFACE_ShareUnlockSurface(psurfColor); return FALSE; } + + /* Fix width parameter, if needed */ + if (!cxWidth) + { + if(diFlags & DI_DEFAULTSIZE) + cxWidth = is_icon(pIcon) ? + UserGetSystemMetrics(SM_CXICON) : UserGetSystemMetrics(SM_CXCURSOR); + else + cxWidth = pIcon->cx; + } + + /* Fix height parameter, if needed */ + if (!cyHeight) + { + if(diFlags & DI_DEFAULTSIZE) + cyHeight = is_icon(pIcon) ? + UserGetSystemMetrics(SM_CYICON) : UserGetSystemMetrics(SM_CYCURSOR); + else + cyHeight = pIcon->cy; + } + /* Calculate destination rectangle */ RECTL_vSetRect(&rcDest, xLeft, yTop, xLeft + cxWidth, yTop + cyHeight); IntLPtoDP(pdc, (LPPOINT)&rcDest, 2); @@ -1199,26 +1220,6 @@ UserDrawIconEx( /* Set source rect */ RECTL_vSetRect(&rcSrc, 0, 0, pIcon->cx, pIcon->cy); - /* Fix width parameter, if needed */ - if (!cxWidth) - { - if(diFlags & DI_DEFAULTSIZE) - cxWidth = is_icon(pIcon) ? - UserGetSystemMetrics(SM_CXICON) : UserGetSystemMetrics(SM_CXCURSOR); - else - cxWidth = pIcon->cx; - } - - /* Fix height parameter, if needed */ - if (!cyHeight) - { - if(diFlags & DI_DEFAULTSIZE) - cyHeight = is_icon(pIcon) ? - UserGetSystemMetrics(SM_CYICON) : UserGetSystemMetrics(SM_CYCURSOR); - else - cyHeight = pIcon->cy; - } - /* Should we render off-screen? */ bOffScreen = hbrFlickerFreeDraw && (GDI_HANDLE_GET_TYPE(hbrFlickerFreeDraw) == GDI_OBJECT_TYPE_BRUSH);