summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNorwegian Rock Cat <qt-info@nokia.com>2009-06-12 17:24:03 (GMT)
committerNorwegian Rock Cat <qt-info@nokia.com>2009-06-23 14:11:29 (GMT)
commit1b059b51b6d236ace4ec8c5203873caae250cf78 (patch)
treeab5e1904f277593ef801362a10c7b1ae4aa1fedc /src
parentda007be189dd59771bc63ab3b8f0cf71897ed300 (diff)
downloadQt-1b059b51b6d236ace4ec8c5203873caae250cf78.zip
Qt-1b059b51b6d236ace4ec8c5203873caae250cf78.tar.gz
Qt-1b059b51b6d236ace4ec8c5203873caae250cf78.tar.bz2
Scroll the dirty parts of the scroll area in scrollby for Cocoa.
Ah! One less ###! The scroll functions in Carbon and Cocoa don't scroll the regions that have been marked dirty. In the past, we killed performance by updating the whole view. We got a workaround for Carbon in the form of an SPI, but I wasn't aware of a corresponding item in the NSView API, but it is there publically and available in 10.5. Fast scrolling in Cocoa now for people who like to use the keyboard. Reviewed by: Morten Sørvig
Diffstat (limited to 'src')
-rw-r--r--src/gui/kernel/qwidget_mac.mm17
1 files changed, 3 insertions, 14 deletions
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm
index ad80f15..a75c2a3 100644
--- a/src/gui/kernel/qwidget_mac.mm
+++ b/src/gui/kernel/qwidget_mac.mm
@@ -4347,20 +4347,9 @@ void QWidgetPrivate::scroll_sys(int dx, int dy, const QRect &r)
}
}
- // ### Scroll the dirty regions as well, the following is not correct.
- QRegion displayRegion = r.isNull() ? dirtyOnWidget : (dirtyOnWidget & r);
- const QVector<QRect> &rects = dirtyOnWidget.rects();
- const QVector<QRect>::const_iterator end = rects.end();
- QVector<QRect>::const_iterator it = rects.begin();
- while (it != end) {
- const QRect rect = *it;
- const NSRect dirtyRect = NSMakeRect(rect.x() + dx, rect.y() + dy,
- rect.width(), rect.height());
- [view setNeedsDisplayInRect:dirtyRect];
- ++it;
- }
- [view scrollRect:scrollRect by:NSMakeSize(dx, dy)];
- // Yes, we potentially send a duplicate area, but I think Cocoa can handle it.
+ NSSize deltaSize = NSMakeSize(dx, dy);
+ [view translateRectsNeedingDisplayInRect:scrollRect by:deltaSize];
+ [view scrollRect:scrollRect by:deltaSize];
[view setNeedsDisplayInRect:deltaXRect];
[view setNeedsDisplayInRect:deltaYRect];
#endif // QT_MAC_USE_COCOA