From c38cb09593c93ff2ceae04a6c69706c7bd5c888d Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Thu, 15 Sep 2011 14:04:36 +1000 Subject: 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 --- src/declarative/particles/qsgparticlepainter.cpp | 12 +----------- 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 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: -- cgit v1.2.3