diff options
author | Alan Alpert <alan.alpert@nokia.com> | 2011-07-25 15:12:17 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-07-28 08:39:33 +0200 |
commit | 02bf8f421d32ef7449b0fe2fe1ad62fea33bcc61 (patch) | |
tree | fc89fff09bb3a10d9b5f0e385144c67d876f09e2 /src | |
parent | d197b2d2cdb8787456cc9b7da27b7400e3b7a159 (diff) |
Manage m_activeCount centrally
Fixes issue where it wasn't being managed right and kept going negative.
This commit also adds setVisible in a few places missed by the last
change.
Task-number: QTBUG-20437
Change-Id: I4efaab7b34784dfbc42dd1acd0a5be3b38a8605a
Reviewed-on: http://codereview.qt.nokia.com/2074
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Alan Alpert <alan.alpert@nokia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/declarative/particles/qsgitemparticle.cpp | 6 | ||||
-rw-r--r-- | src/declarative/particles/qsgmodelparticle.cpp | 9 |
2 files changed, 7 insertions, 8 deletions
diff --git a/src/declarative/particles/qsgitemparticle.cpp b/src/declarative/particles/qsgitemparticle.cpp index 878e04d453..19d921a10d 100644 --- a/src/declarative/particles/qsgitemparticle.cpp +++ b/src/declarative/particles/qsgitemparticle.cpp @@ -121,10 +121,8 @@ void QSGItemParticle::tick() if (m_stasis.contains(d->delegate)) qWarning() << "Current model particles prefers overwrite:false"; //remove old item from the particle that is dying to make room for this one - if (d->delegate){ + if (d->delegate) m_deletables << d->delegate; - m_activeCount--; - } d->delegate = 0; if (!m_pendingItems.isEmpty()){ d->delegate = m_pendingItems.front(); @@ -143,6 +141,7 @@ void QSGItemParticle::tick() d->delegate->setParentItem(this); if (m_fade) d->delegate->setOpacity(0.); + d->delegate->setVisible(false);//Will be set to true when we prepare the next frame m_activeCount++; } } @@ -202,7 +201,6 @@ void QSGItemParticle::prepareNextFrame() if (t >= 1.0){//Usually happens from load m_deletables << item; data->delegate = 0; - m_activeCount--; }else{//Fade data->delegate->setVisible(true); if (m_fade){ diff --git a/src/declarative/particles/qsgmodelparticle.cpp b/src/declarative/particles/qsgmodelparticle.cpp index 08646e32ae..19815aa8f4 100644 --- a/src/declarative/particles/qsgmodelparticle.cpp +++ b/src/declarative/particles/qsgmodelparticle.cpp @@ -171,7 +171,6 @@ void QSGModelParticle::initialize(int gIdx, int pIdx) if (m_available.isEmpty()) return; m_requests << m_system->m_groupData[gIdx]->data[pIdx]; - m_activeCount++; } void QSGModelParticle::processPending() @@ -181,6 +180,7 @@ void QSGModelParticle::processPending() if (m_fade) item->setOpacity(0.); m_model->release(item); + m_activeCount--; } m_deletables.clear(); @@ -193,7 +193,6 @@ void QSGModelParticle::processPending() m_available << datum->modelIndex; datum->modelIndex = -1; datum->delegate = 0; - m_activeCount--; } if (!m_available.isEmpty()){ @@ -206,7 +205,10 @@ void QSGModelParticle::processPending() mpa->attach(); } datum->delegate->setParentItem(this); - datum->delegate->setOpacity(0.0); + if (m_fade) + datum->delegate->setOpacity(0.0); + datum->delegate->setVisible(false);//Will be set to true when we prepare the next frame + m_activeCount++; } } m_requests.clear(); @@ -271,7 +273,6 @@ void QSGModelParticle::prepareNextFrame() m_deletables << data->delegate; data->modelIndex = -1; data->delegate = 0; - m_activeCount--; continue; }else{//Fade data->delegate->setVisible(true); |