summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/xcb/qxcbbackingstore.cpp
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/xcb/qxcbbackingstore.cpp
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/xcb/qxcbbackingstore.cpp')
-rw-r--r--src/plugins/platforms/xcb/qxcbbackingstore.cpp23
1 files changed, 10 insertions, 13 deletions
diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.cpp b/src/plugins/platforms/xcb/qxcbbackingstore.cpp
index e57b089878..3d22c9f4dd 100644
--- a/src/plugins/platforms/xcb/qxcbbackingstore.cpp
+++ b/src/plugins/platforms/xcb/qxcbbackingstore.cpp
@@ -335,11 +335,9 @@ void QXcbBackingStore::beginPaint(const QRegion &region)
if (m_image->hasAlpha()) {
QPainter p(paintDevice());
p.setCompositionMode(QPainter::CompositionMode_Source);
- const QVector<QRect> rects = m_paintRegion.rects();
const QColor blank = Qt::transparent;
- for (QVector<QRect>::const_iterator it = rects.begin(); it != rects.end(); ++it) {
- p.fillRect(*it, blank);
- }
+ for (const QRect &rect : m_paintRegion)
+ p.fillRect(rect, blank);
}
}
@@ -351,11 +349,12 @@ void QXcbBackingStore::endPaint()
// Slow path: the paint device was m_rgbImage. Now copy with swapping red
// and blue into m_image.
- const QVector<QRect> rects = m_paintRegion.rects();
- if (rects.isEmpty())
+ auto it = m_paintRegion.begin();
+ const auto end = m_paintRegion.end();
+ if (it == end)
return;
QPainter p(m_image->image());
- for (QVector<QRect>::const_iterator it = rects.begin(); it != rects.end(); ++it) {
+ while (it != end) {
const QRect rect = *it;
p.drawImage(rect.topLeft(), m_rgbImage.copy(rect).rgbSwapped());
}
@@ -397,9 +396,8 @@ void QXcbBackingStore::flush(QWindow *window, const QRegion &region, const QPoin
return;
}
- QVector<QRect> rects = clipped.rects();
- for (int i = 0; i < rects.size(); ++i) {
- QRect rect = QRect(rects.at(i).topLeft(), rects.at(i).size());
+ for (const QRect &r : clipped) {
+ QRect rect = QRect(r.topLeft(), r.size());
m_image->put(platformWindow->xcb_window(), rect.topLeft(), rect.translated(offset));
}
@@ -463,9 +461,8 @@ bool QXcbBackingStore::scroll(const QRegion &area, int dx, int dy)
m_image->preparePaint(area);
QPoint delta(dx, dy);
- const QVector<QRect> rects = area.rects();
- for (int i = 0; i < rects.size(); ++i)
- qt_scrollRectInImage(*m_image->image(), rects.at(i), delta);
+ for (const QRect &rect : area)
+ qt_scrollRectInImage(*m_image->image(), rect, delta);
return true;
}