diff -r 7516d6d86cf5 -r ed14f46c0e55 src/hbcore/effects/hbeffectgroup.cpp --- a/src/hbcore/effects/hbeffectgroup.cpp Mon Oct 04 17:49:30 2010 +0300 +++ b/src/hbcore/effects/hbeffectgroup.cpp Mon Oct 18 18:23:13 2010 +0300 @@ -41,8 +41,11 @@ #ifdef HB_FILTER_EFFECTS #include "hbvgeffect_p.h" #include "hbvgchainedeffect_p.h" +#include "hbvgmaskeffect_p.h" #endif +static const char effect_fw_marker[] = "effw_chain"; + HbEffectGroup::HbEffectGroup( const QString &effectEventType, QGraphicsItem *registrationItem, @@ -165,6 +168,9 @@ } if (!gv) { mTargetItem->setTransform(transform); + if (mEffectFlags.testFlag(HbEffectInternal::UpdateAtEachStep)) { + mTargetItem->update(); + } } else { gv->setTransform(transform); } @@ -263,6 +269,7 @@ { if (!mVgEffect) { mVgEffect = new HbVgChainedEffect; + mVgEffect->setObjectName(effect_fw_marker); } return mVgEffect; } @@ -271,6 +278,32 @@ { if (!mVgEffectActivated) { mVgEffectGuard = QPointer(); + if (mTargetItem->graphicsEffect()) { + // Manually installed effects should not get lost. For example a + // pop-up may install a mask effect before or after this + // function. To support the 'before' case we have to add all + // existing effects to the chain. Supporting the 'after' case is up + // to the widget. However we can only support effects that are in a + // chain, keeping single effects is not possible due to ownership + // issues. + HbVgChainedEffect *c = qobject_cast(mTargetItem->graphicsEffect()); + if (c) { + QList effects = c->takeAll(); + HbVgChainedEffect *newChain = vgEffect(); + // Effects set by another HbEffectGroup instance must be ignored + // here, those should go away because they probably would not work + // well together anyway. + bool chainIsFromEffectFw = c->objectName().compare(QLatin1String(effect_fw_marker)) == 0; + foreach (HbVgEffect *effect, effects) { + // Special handling for mask effects: These must be preserved always. + if (!chainIsFromEffectFw || qobject_cast(effect) != 0) { + newChain->add(effect); + } else { + delete effect; + } + } + } + } vgEffect()->install(mTargetItem); mVgEffectActivated = true; }