diff options
author | Alan Alpert <alan.alpert@nokia.com> | 2011-09-15 14:04:36 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-09-16 03:48:32 +0200 |
commit | c38cb09593c93ff2ceae04a6c69706c7bd5c888d (patch) | |
tree | f4e74c036aa427152ac24fa7b4e3713f8a79ef40 | |
parent | 05665e5fc739b38a94d6fc1e37af8bc1631aa9c4 (diff) |
Update system offset every frame
May be expensive if large systems animate painters, but seems safer than
messing with the tranformation matrix.
Change-Id: Ie5b21e9f238b5305bef44c48027a3337c70b2aaa
Reviewed-on: http://codereview.qt-project.org/4933
Reviewed-by: Martin Jones <martin.jones@nokia.com>
-rw-r--r-- | src/declarative/particles/qsgparticlepainter.cpp | 12 | ||||
-rw-r--r-- | src/declarative/particles/qsgparticlepainter_p.h | 15 |
2 files changed, 8 insertions, 19 deletions
diff --git a/src/declarative/particles/qsgparticlepainter.cpp b/src/declarative/particles/qsgparticlepainter.cpp index aec8690b08..1b3453afe6 100644 --- a/src/declarative/particles/qsgparticlepainter.cpp +++ b/src/declarative/particles/qsgparticlepainter.cpp @@ -67,12 +67,6 @@ QSGParticlePainter::QSGParticlePainter(QSGItem *parent) : QSGItem(parent), m_system(0), m_count(0), m_sentinel(new QSGParticleData(0)) { - connect(this, SIGNAL(parentChanged(QSGItem*)), - this, SLOT(calcSystemOffset())); - connect(this, SIGNAL(xChanged()), - this, SLOT(calcSystemOffset())); - connect(this, SIGNAL(yChanged()), - this, SLOT(calcSystemOffset())); } void QSGParticlePainter::componentComplete() @@ -91,10 +85,6 @@ void QSGParticlePainter::setSystem(QSGParticleSystem *arg) m_system = arg; if (m_system){ m_system->registerParticlePainter(this); - connect(m_system, SIGNAL(xChanged()), - this, SLOT(calcSystemOffset())); - connect(m_system, SIGNAL(yChanged()), - this, SLOT(calcSystemOffset())); reset(); } emit systemChanged(arg); @@ -118,7 +108,6 @@ void QSGParticlePainter::reload(QSGParticleData* d) void QSGParticlePainter::reset() { - calcSystemOffset(true);//In case an ancestor changed in some way } void QSGParticlePainter::setCount(int c)//### TODO: some resizeing so that particles can reallocate on size change instead of recreate @@ -154,6 +143,7 @@ void QSGParticlePainter::calcSystemOffset(bool resetPending) typedef QPair<int,int> intPair; void QSGParticlePainter::performPendingCommits() { + calcSystemOffset(); foreach (intPair p, m_pendingCommits) commit(p.first, p.second); m_pendingCommits.clear(); diff --git a/src/declarative/particles/qsgparticlepainter_p.h b/src/declarative/particles/qsgparticlepainter_p.h index d469947453..4b627e9457 100644 --- a/src/declarative/particles/qsgparticlepainter_p.h +++ b/src/declarative/particles/qsgparticlepainter_p.h @@ -86,17 +86,16 @@ signals: void groupsChanged(QStringList arg); public slots: -void setSystem(QSGParticleSystem* arg); + void setSystem(QSGParticleSystem* arg); -void setGroups(QStringList arg) -{ - if (m_groups != arg) { - m_groups = arg; - emit groupsChanged(arg); + void setGroups(QStringList arg) + { + if (m_groups != arg) { + m_groups = arg; + emit groupsChanged(arg); + } } -} -private slots: void calcSystemOffset(bool resetPending = false); protected: |