src/hbcore/effects/hbeffectgroup.cpp
changeset 30 80e4d18b72f5
parent 21 4633027730f5
--- a/src/hbcore/effects/hbeffectgroup.cpp	Fri Sep 17 08:32:10 2010 +0300
+++ b/src/hbcore/effects/hbeffectgroup.cpp	Mon Oct 04 00:38:12 2010 +0300
@@ -41,6 +41,7 @@
 #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";
@@ -286,14 +287,20 @@
             // chain, keeping single effects is not possible due to ownership
             // issues.
             HbVgChainedEffect *c = qobject_cast<HbVgChainedEffect *>(mTargetItem->graphicsEffect());
-            // Effects set by another HbEffectGroup instance must be ignored
-            // here, those should go away because they probably would not work
-            // well together anyway.
-            if (c && c->objectName().compare(QLatin1String(effect_fw_marker))) {
+            if (c) {
                 QList<HbVgEffect *> 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) {
-                    newChain->add(effect);
+                    // Special handling for mask effects: These must be preserved always.
+                    if (!chainIsFromEffectFw || qobject_cast<HbVgMaskEffect *>(effect) != 0) {
+                        newChain->add(effect);
+                    } else {
+                        delete effect;
+                    }
                 }
             }
         }