diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2009-08-06 22:51:40 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2009-08-06 22:51:40 (GMT) |
commit | f6298bc37be25733571eb143a77953b749a664cb (patch) | |
tree | 7ae97ae5464f11bc7fc1583fd32412874dbf662f /src/declarative/extra | |
parent | 4efccb54b4fb1a8fd807977be29df2cce5d5d8bb (diff) | |
download | Qt-f6298bc37be25733571eb143a77953b749a664cb.zip Qt-f6298bc37be25733571eb143a77953b749a664cb.tar.gz Qt-f6298bc37be25733571eb143a77953b749a664cb.tar.bz2 |
Small optimizations for particles.
Diffstat (limited to 'src/declarative/extra')
-rw-r--r-- | src/declarative/extra/qfxparticles.cpp | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/declarative/extra/qfxparticles.cpp b/src/declarative/extra/qfxparticles.cpp index 6d41434..26c176b 100644 --- a/src/declarative/extra/qfxparticles.cpp +++ b/src/declarative/extra/qfxparticles.cpp @@ -680,17 +680,18 @@ int QFxParticles::count() const void QFxParticles::setCount(int cnt) { Q_D(QFxParticles); - if (cnt != d->count) { - int oldCount = d->count; - d->count = cnt; - d->addParticleTime = 0; - d->addParticleCount = d->particles.count(); - if (!oldCount && d->clock.state() != QAbstractAnimation::Running) { - d->clock.start(); - } - d->paintItem->updateSize(); - d->paintItem->update(); + if (cnt == d->count) + return; + + int oldCount = d->count; + d->count = cnt; + d->addParticleTime = 0; + d->addParticleCount = d->particles.count(); + if (!oldCount && d->clock.state() != QAbstractAnimation::Running && d->count) { + d->clock.start(); } + d->paintItem->updateSize(); + d->paintItem->update(); } /*! @@ -1043,6 +1044,9 @@ void QFxParticles::setMotion(QFxParticleMotion *motion) void QFxParticlesPainter::updateSize() { + if (!isComponentComplete()) + return; + const int parentX = parentItem()->x(); const int parentY = parentItem()->y(); for (int i = 0; i < d->particles.count(); ++i) { |