summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@nokia.com>2009-12-07 14:02:01 (GMT)
committerRichard Moe Gustavsen <richard.gustavsen@nokia.com>2009-12-07 14:06:07 (GMT)
commit5cd4bad136878af59d368b1749a76b9cbbd246ec (patch)
tree17d3db0e9f3ad910407df103b2f93fdd92067a64
parent35a740fa663d4669a45ada9c37c46546e59bbb82 (diff)
downloadQt-5cd4bad136878af59d368b1749a76b9cbbd246ec.zip
Qt-5cd4bad136878af59d368b1749a76b9cbbd246ec.tar.gz
Qt-5cd4bad136878af59d368b1749a76b9cbbd246ec.tar.bz2
Fix performance issue with live resize
Calling [NSView addTrackingArea] is slow. So doing this for views that are not even visible on screen is unnecesary. This patch will greatly improve the speed for some (perhaps extreme) cases. Task-number: QT-1610 Reviewed-by: MortenS
-rw-r--r--src/gui/kernel/qcocoaview_mac.mm4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm
index 212684b..1039a75 100644
--- a/src/gui/kernel/qcocoaview_mac.mm
+++ b/src/gui/kernel/qcocoaview_mac.mm
@@ -555,6 +555,10 @@ extern "C" {
- (void)updateTrackingAreas
{
+ // [NSView addTrackingArea] is slow, so bail out early if we can:
+ if (NSIsEmptyRect([self visibleRect]))
+ return;
+
QMacCocoaAutoReleasePool pool;
if (NSArray *trackingArray = [self trackingAreas]) {
NSUInteger size = [trackingArray count];