summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qcocoahelpers.mm
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2016-02-27 14:34:46 +0100
committerMarc Mutz <marc.mutz@kdab.com>2016-03-02 21:01:00 +0000
commit9c1d3bc253abd4418f3050d19ec5f05bef3ada97 (patch)
tree18dfa273d29c98936114a1ced9062d7174b121ba /src/plugins/platforms/cocoa/qcocoahelpers.mm
parent9d3a41556224bb116d51fd8ee25a28317af67b22 (diff)
QtOpenGL/plugins/platformsupport: use new QRegion::begin()/end() instead of rect()
Saves e.g. ~900b and ~2900b in text size in QtOpenGL and XcbQpa libs, resp., on optimized GCC 5.3 Linux AMD64 builds. Change-Id: Id904689164ca32df41118a23747c70048d8e6604 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoahelpers.mm')
-rw-r--r--src/plugins/platforms/cocoa/qcocoahelpers.mm12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.mm b/src/plugins/platforms/cocoa/qcocoahelpers.mm
index 25fc9f0d5e..b6b1862d80 100644
--- a/src/plugins/platforms/cocoa/qcocoahelpers.mm
+++ b/src/plugins/platforms/cocoa/qcocoahelpers.mm
@@ -200,15 +200,9 @@ NSImage *qt_mac_create_nsimage(const QIcon &icon)
HIMutableShapeRef qt_mac_QRegionToHIMutableShape(const QRegion &region)
{
HIMutableShapeRef shape = HIShapeCreateMutable();
- QVector<QRect> rects = region.rects();
- if (!rects.isEmpty()) {
- int n = rects.count();
- const QRect *qt_r = rects.constData();
- while (n--) {
- CGRect cgRect = CGRectMake(qt_r->x(), qt_r->y(), qt_r->width(), qt_r->height());
- HIShapeUnionWithRect(shape, &cgRect);
- ++qt_r;
- }
+ for (const QRect &rect : region) {
+ CGRect cgRect = CGRectMake(rect.x(), rect.y(), rect.width(), rect.height());
+ HIShapeUnionWithRect(shape, &cgRect);
}
return shape;
}