aboutsummaryrefslogtreecommitdiffstats
path: root/src/particles/qquickparticleemitter.cpp
diff options
context:
space:
mode:
authorAlan Alpert <aalpert@blackberry.com>2013-04-29 13:21:10 -0700
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-05-04 06:26:22 +0200
commit6961ea8567f84acdc91007678746146b98e5d461 (patch)
tree148f0ec7e39119351a0e4ebccee80eb660fa19a6 /src/particles/qquickparticleemitter.cpp
parent209c87d2bc188ee0f5be6b9562593169740eaddb (diff)
Only use emitCap when we run into infinite particles
emitCap is intended to prevent issues with multiple emission of infinite life particles, but it can currently prevent emission of any particles when particleCount() changes after a reset. Tracking particleCount() on changes would be inefficient and be more work to integrate with the correct behavior of infinite particles, so this patch delays the impact of emitCap until an infinite particle is discovered. This will lead to a subtle behavior difference of limiting infinite particle counts based on the count at the first emission, not the first reset, which could be construed as a bug fix in some situations. This seems reasonable as a futher subtle behavior change will be needed in the future to properly support varying counts of infinite particles. Task-number: QTBUG-30915 Change-Id: I4172aee1d03f00cc63ce7c9d12ace052bc41436d Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
Diffstat (limited to 'src/particles/qquickparticleemitter.cpp')
-rw-r--r--src/particles/qquickparticleemitter.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/particles/qquickparticleemitter.cpp b/src/particles/qquickparticleemitter.cpp
index b4e3a82cb2..ec8b53ed06 100644
--- a/src/particles/qquickparticleemitter.cpp
+++ b/src/particles/qquickparticleemitter.cpp
@@ -357,7 +357,7 @@ void QQuickParticleEmitter::emitWindow(int timeStamp)
m_last_timestamp = timeStamp/1000.;
m_last_emission = m_last_timestamp;
m_reset_last = false;
- m_emitCap = particleCount();
+ m_emitCap = -1;
}
if (m_pulseLeft){
@@ -424,6 +424,8 @@ void QQuickParticleEmitter::emitWindow(int timeStamp)
if (datum->lifeSpan >= m_system->maxLife){
datum->lifeSpan = m_system->maxLife;
+ if (m_emitCap == -1)
+ m_emitCap = particleCount();
m_emitCap--;//emitCap keeps us from reemitting 'infinite' particles after their life. Unless you reset the emitter.
}