[PATCH 4/4] user32: Don't bother drawing an item if it's outside the items_rect.

Huw Davies huw at codeweavers.com
Fri Mar 31 03:52:40 CDT 2017


Signed-off-by: Huw Davies <huw at codeweavers.com>
---
 dlls/user32/menu.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/dlls/user32/menu.c b/dlls/user32/menu.c
index 6c6888a0a5..a65f01eaa5 100644
--- a/dlls/user32/menu.c
+++ b/dlls/user32/menu.c
@@ -1417,6 +1417,12 @@ static void MENU_DrawMenuItem( HWND hwnd, POPUPMENU *menu, HWND hwndOwner, HDC h
 	return;
     }
 
+    TRACE( "rect=%s\n", wine_dbgstr_rect( &lpitem->rect ) );
+    rect = lpitem->rect;
+    MENU_AdjustMenuItemRect( menu, &rect );
+    if (!IntersectRect( &bmprc, &rect, &menu->items_rect )) /* bmprc is used as a dummy */
+        return;
+
     SystemParametersInfoW (SPI_GETFLATMENU, 0, &flat_menu, 0);
     bkgnd = (menuBar && flat_menu) ? COLOR_MENUBAR : COLOR_MENU;
   
@@ -1444,10 +1450,6 @@ static void MENU_DrawMenuItem( HWND hwnd, POPUPMENU *menu, HWND hwndOwner, HDC h
 	SetBkColor( hdc, GetSysColor( bkgnd ) );
     }
 
-    TRACE("rect=%s\n", wine_dbgstr_rect( &lpitem->rect));
-    rect = lpitem->rect;
-    MENU_AdjustMenuItemRect(menu, &rect);
-
     old_clip = CreateRectRgn( 0, 0, 0, 0 );
     if (GetClipRgn( hdc, old_clip ) <= 0)
     {
-- 
2.12.0




More information about the wine-patches mailing list