diff options
author | Volker Krause <volker.krause@kdab.com> | 2014-02-19 13:57:12 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-02-20 08:45:15 +0100 |
commit | b0f3fe3bbe387728d8e976b620cb4250e732488d (patch) | |
tree | 26b7d9041fb0230cbefa50867e1994355e5a29e6 /src/particles | |
parent | bd510dfa02f33fa497894fe8aa4236f7d8705482 (diff) |
Optimize QQuickItemParticle::prepareNextFrame().
This moves one hash lookup out of the inner loop, and most importantly
avoids detaching both the particle group hash and the particle data vector
on every iteration of the inner loop.
Change-Id: If9a127b347367ac9dc1e8ee738ff914784adb896
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Reviewed-by: Alan Alpert <aalpert@blackberry.com>
Diffstat (limited to 'src/particles')
-rw-r--r-- | src/particles/qquickitemparticle.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/particles/qquickitemparticle.cpp b/src/particles/qquickitemparticle.cpp index 728da57212..53aa9a9926 100644 --- a/src/particles/qquickitemparticle.cpp +++ b/src/particles/qquickitemparticle.cpp @@ -237,11 +237,12 @@ void QQuickItemParticle::prepareNextFrame() //TODO: Size, better fade? foreach (const QString &str, m_groups){ - int gIdx = m_system->groupIds[str]; - int count = m_system->groupData[gIdx]->size(); + const int gIdx = m_system->groupIds[str]; + const QVector<QQuickParticleData*> dataVector = m_system->groupData.value(gIdx)->data; + const int count = dataVector.size(); for (int i=0; i<count; i++){ - QQuickParticleData* data = m_system->groupData[gIdx]->data[i]; + QQuickParticleData* data = dataVector.at(i); QQuickItem* item = data->delegate; if (!item) continue; |