diff options
author | Erik Verbruggen <erik.verbruggen@digia.com> | 2016-03-03 14:18:52 +0100 |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@theqtcompany.com> | 2016-03-04 10:43:03 +0000 |
commit | 62ecfe55f414d0d04a4344bc6934b4b01408190f (patch) | |
tree | b86869e2a938c4cacda2b627479479d319cd2873 /src/particles/qquickcustomaffector.cpp | |
parent | 13c8aecdfccc9d15c367a9d45ec575f1542a90fd (diff) |
Particles: code clean-up.
Replace QHash<int, QQuickParticleGroupData*> groupData with a
QVarLengthArray, and make sure that those integers (== indices) are
continuous, re-used, and start at zero. That way a whole bunch of qhash
calls, hash node creatrion/deletion, and other overhead is removed.
Change-Id: Ie74fab8a3e3c7b6efa15b7b9ceff1d1a3e9820e9
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
Diffstat (limited to 'src/particles/qquickcustomaffector.cpp')
-rw-r--r-- | src/particles/qquickcustomaffector.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/particles/qquickcustomaffector.cpp b/src/particles/qquickcustomaffector.cpp index 55310f92d5..6f50c17287 100644 --- a/src/particles/qquickcustomaffector.cpp +++ b/src/particles/qquickcustomaffector.cpp @@ -122,11 +122,15 @@ void QQuickCustomAffector::affectSystem(qreal dt) updateOffsets(); QList<QQuickParticleData*> toAffect; - foreach (QQuickParticleGroupData* gd, m_system->groupData) - if (activeGroup(m_system->groupData.key(gd))) - foreach (QQuickParticleData* d, gd->data) - if (shouldAffect(d)) + foreach (QQuickParticleGroupData* gd, m_system->groupData) { + if (activeGroup(gd->index)) { + foreach (QQuickParticleData* d, gd->data) { + if (shouldAffect(d)) { toAffect << d; + } + } + } + } if (toAffect.isEmpty()) return; |