summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel/qwidgetbackingstore.cpp
diff options
context:
space:
mode:
authorSérgio Martins <sergio.martins@kdab.com>2016-01-16 00:24:54 +0000
committerSérgio Martins <iamsergio@gmail.com>2016-02-07 16:50:26 +0000
commit01859cc12126b7205f5b54d383a9aa88db756f21 (patch)
tree89ea0594e2d6e86bc1e0e271d9bf4215a387b28e /src/widgets/kernel/qwidgetbackingstore.cpp
parentaf499fd7eb4026088ea1ed83a976866ab930dd79 (diff)
Reduce allocations by using reserve()
Change-Id: If34fa53402985f6b3c5e7217bce4a1177af835b6 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'src/widgets/kernel/qwidgetbackingstore.cpp')
-rw-r--r--src/widgets/kernel/qwidgetbackingstore.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/widgets/kernel/qwidgetbackingstore.cpp b/src/widgets/kernel/qwidgetbackingstore.cpp
index d9d1c887c1..5e6563b0be 100644
--- a/src/widgets/kernel/qwidgetbackingstore.cpp
+++ b/src/widgets/kernel/qwidgetbackingstore.cpp
@@ -1242,13 +1242,15 @@ void QWidgetBackingStore::doSync()
// OpenGL content changes. Check if we have such widgets in the special
// dirty list.
QVarLengthArray<QWidget *, 16> paintPending;
- for (int i = 0; i < dirtyRenderToTextureWidgets.count(); ++i) {
+ const int numPaintPending = dirtyRenderToTextureWidgets.count();
+ paintPending.reserve(numPaintPending);
+ for (int i = 0; i < numPaintPending; ++i) {
QWidget *w = dirtyRenderToTextureWidgets.at(i);
paintPending << w;
resetWidget(w);
}
dirtyRenderToTextureWidgets.clear();
- for (int i = 0; i < paintPending.count(); ++i) {
+ for (int i = 0; i < numPaintPending; ++i) {
QWidget *w = paintPending[i];
w->d_func()->sendPaintEvent(w->rect());
if (w != tlw) {