summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFabien Freling <fabien.freling@nokia.com>2010-03-15 12:31:13 (GMT)
committerFabien Freling <fabien.freling@nokia.com>2010-03-16 11:52:30 (GMT)
commitbcfc1ac6d87d68e7fecb88802b80cad1600c1e35 (patch)
treeeb336c823252138e4ffbe0057798169cc35f05f7 /src
parentf053c6f42da56588168ca99f3834daa19a561923 (diff)
downloadQt-bcfc1ac6d87d68e7fecb88802b80cad1600c1e35.zip
Qt-bcfc1ac6d87d68e7fecb88802b80cad1600c1e35.tar.gz
Qt-bcfc1ac6d87d68e7fecb88802b80cad1600c1e35.tar.bz2
Update only appropriate rectangles during update_sys().
Instead of updating the bounding box, we iterate over the rectangles of the region. We also keep early alien support.
Diffstat (limited to 'src')
-rw-r--r--src/gui/kernel/qwidget_mac.mm21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm
index a19c57b..b3a6aec 100644
--- a/src/gui/kernel/qwidget_mac.mm
+++ b/src/gui/kernel/qwidget_mac.mm
@@ -3332,21 +3332,24 @@ void QWidgetPrivate::update_sys(const QRegion &rgn)
HIViewSetNeedsDisplay(qt_mac_nativeview_for(q), true); // do a complete repaint on overflow.
}
#else
- // Cocoa doesn't do regions, it seems more efficient to just update the bounding rect instead of a potential number of message passes for each rect.
- const QRect & boundingRect = rgn.boundingRect();
-
// Alien support: get the first native ancestor widget (will be q itself in the non-alien case),
// map the coordinates from q space to NSView space and invalidate the rect.
QWidget *nativeParent = q->internalWinId() ? q : q->nativeParentWidget();
if (nativeParent == 0)
return;
- const QRect nativeBoundingRect = QRect(
- QPoint(q->mapTo(nativeParent, boundingRect.topLeft())),
- QSize(boundingRect.size()));
- [qt_mac_nativeview_for(nativeParent) setNeedsDisplayInRect:NSMakeRect(nativeBoundingRect.x(),
- nativeBoundingRect.y(), nativeBoundingRect.width(),
- nativeBoundingRect.height())];
+ QVector<QRect> rects = rgn.rects();
+ for (int i = 0; i < rects.count(); ++i) {
+ const QRect &rect = rects.at(i);
+
+ const QRect nativeBoundingRect = QRect(
+ QPoint(q->mapTo(nativeParent, rect.topLeft())),
+ QSize(rect.size()));
+
+ [qt_mac_nativeview_for(nativeParent) setNeedsDisplayInRect:NSMakeRect(nativeBoundingRect.x(),
+ nativeBoundingRect.y(), nativeBoundingRect.width(),
+ nativeBoundingRect.height())];
+ }
#endif
}