From 445f8bbd9709b712fa253fe1833bbf9416429603 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Wed, 9 Dec 2009 15:30:10 +0100 Subject: Cocoa: scrolling viewports containing many widgets is slow One of the reasons is that [NSView resetCursorRects] is called for each view, also the ones not actually visible. And the function is slow. This patch does an early check, and bails out if this is the case. Reviewed-by: Prasanth --- src/gui/kernel/qcocoaview_mac.mm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index 1039a75..311cf24 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -227,6 +227,10 @@ extern "C" { - (void)resetCursorRects { + // [NSView addCursorRect] is slow, so bail out early if we can: + if (NSIsEmptyRect([self visibleRect])) + return; + QWidget *cursorWidget = qwidget; if (cursorWidget->testAttribute(Qt::WA_TransparentForMouseEvents)) -- cgit v0.12