From 4453c2c0aea512f56da5a2ba0ac55b1bbd59cb35 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Mon, 25 Jul 2011 15:07:42 +1000 Subject: [PATCH] Only manage opacity when m_fade is true In all cases, visualize lifecycle with 'visible' property instead. Task-number: QTBUG-20438 Change-Id: Ib0b732708e14ad043c5b673205eaec0467e38174 Reviewed-on: http://codereview.qt.nokia.com/2071 Reviewed-by: Qt Sanity Bot Reviewed-by: Martin Jones --- src/declarative/particles/qsgitemparticle.cpp | 4 ++-- src/declarative/particles/qsgmodelparticle.cpp | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/declarative/particles/qsgitemparticle.cpp b/src/declarative/particles/qsgitemparticle.cpp index 1d2d166..878e04d 100644 --- a/src/declarative/particles/qsgitemparticle.cpp +++ b/src/declarative/particles/qsgitemparticle.cpp @@ -108,6 +108,7 @@ void QSGItemParticle::tick() foreach (QSGItem* item, m_deletables){ if (m_fade) item->setOpacity(0.); + item->setVisible(false); QSGItemParticleAttached* mpa; if ((mpa = qobject_cast(qmlAttachedPropertiesObject(item)))) mpa->detach();//reparent as well? @@ -203,6 +204,7 @@ void QSGItemParticle::prepareNextFrame() data->delegate = 0; m_activeCount--; }else{//Fade + data->delegate->setVisible(true); if (m_fade){ qreal o = 1.; if (t<0.2) @@ -210,8 +212,6 @@ void QSGItemParticle::prepareNextFrame() if (t>0.8) o = (1-t)*5; item->setOpacity(o); - }else{ - item->setOpacity(1.);//###Without fade, it's just a binary toggle - if we turn it off we have to turn it back on } } item->setX(data->curX() - item->width()/2 - m_systemOffset.x()); diff --git a/src/declarative/particles/qsgmodelparticle.cpp b/src/declarative/particles/qsgmodelparticle.cpp index 844b76d..cb295d6 100644 --- a/src/declarative/particles/qsgmodelparticle.cpp +++ b/src/declarative/particles/qsgmodelparticle.cpp @@ -171,7 +171,9 @@ void QSGModelParticle::initialize(int gIdx, int pIdx) void QSGModelParticle::processPending() {//can't create/delete arbitrary items in the render thread foreach (QSGItem* item, m_deletables){ - item->setOpacity(0.); + item->setVisible(false); + if (m_fade) + item->setOpacity(0.); m_model->release(item); } m_deletables.clear(); @@ -267,6 +269,7 @@ void QSGModelParticle::prepareNextFrame() m_activeCount--; continue; }else{//Fade + data->delegate->setVisible(true); if (m_fade){ qreal o = 1.; if (t<0.2) @@ -274,8 +277,6 @@ void QSGModelParticle::prepareNextFrame() if (t>0.8) o = (1-t)*5; data->delegate->setOpacity(o); - }else{ - data->delegate->setOpacity(1.);//###Without fade, it's just a binary toggle - if we turn it off we have to turn it back on } } data->delegate->setX(data->curX() - data->delegate->width()/2 - m_systemOffset.x()); -- 2.7.4