From: Alan Alpert Date: Mon, 29 Apr 2013 20:21:10 +0000 (-0700) Subject: Only use emitCap when we run into infinite particles X-Git-Tag: upstream/5.2.1~798^2~84 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6961ea8567f84acdc91007678746146b98e5d461;p=platform%2Fupstream%2Fqtdeclarative.git 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 --- diff --git a/src/particles/qquickparticleemitter.cpp b/src/particles/qquickparticleemitter.cpp index b4e3a82..ec8b53e 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. }