uiacceltk/hitchcock/coretoolkit/src/HuiFxEffect.cpp
branchRCL_3
changeset 9 3ac8bf5c5014
parent 8 46927d61fef3
child 12 f93c875b566e
--- a/uiacceltk/hitchcock/coretoolkit/src/HuiFxEffect.cpp	Wed Apr 14 16:53:50 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/src/HuiFxEffect.cpp	Tue Apr 27 17:34:42 2010 +0300
@@ -81,12 +81,12 @@
     ReleaseCachedRenderTarget();
     
     iEngine->RemoveEffect(this);
-    if (iEngine && iGroupId != KErrNotFound && !iNotifiedEffectReady)
+    if (iEngine && iGroupId != KErrNotFound && !(iFlags & KHuiReadyToDrawNotified))
         {
         // if effect was deleted before it was drawn, the group must be notified. If this was the last effect in the group
         // the group will be removed by the EffectReadyToStart
-        // effect group does not not know, which effects have notified about themselves. thus iNotifiedEffectReady flag is used.
-        iNotifiedEffectReady = ETrue;
+        // effect group does not not know, which effects have notified about themselves.
+        SetEffectFlag(KHuiReadyToDrawNotified);
         iEngine->NotifyEffectReady(iGroupId);
         }
     
@@ -95,12 +95,17 @@
 #endif
     }
 
-void CHuiFxEffect::NotifyEffectEndObserver()
+TBool CHuiFxEffect::NotifyEffectEndObserver()
     {
+    if (iFlags & KHuiEffectObserverNotified)
+        {
+        return ETrue;
+        }
+    SetEffectFlag(KHuiEffectObserverNotified); // prevent extra notifier calls calls
 	// fade effect should not have observers
     if (iFlags & KHuiFadeEffectFlag)
         {
-        return;
+        return ETrue; // fade effect does not have observer that would need notification
         }
     if (iEffectEndObserver)
         {
@@ -109,7 +114,14 @@
         iEffectEndObserver = NULL;
         // Note: The call below may synchronously delete me (CHuiFxEffect instance)
         effectEndObserver->AlfGfxEffectEndCallBack( iHandle );
-        }    
+        return ETrue; // end observer notified
+        }
+    else
+        {
+		// must be notified without destroying the effect first. gives alf apps chance
+		// to do their own cleanup
+        return EFalse; 
+        }
     }
 
 EXPORT_C void CHuiFxEffect::AddLayerL(const CHuiFxLayer* aLayer)
@@ -507,7 +519,6 @@
 #endif
     // KHuiFxDelayRunUntilFirstFrameHasBeenDrawn flag is for giving effect chance to run
     // its whole timeline by starting the time only when first frame has been drawn.
-    iElapsedTime += aElapsedTime;
     if (iFlags & KHuiFxDelayRunUntilFirstFrameHasBeenDrawn)
         {
         // Sometimes the effect does not get any frames. Force the time to start, because
@@ -536,7 +547,7 @@
 				// NotifyEffectReady will clear KHuiFxReadyAndWaitingGroupToStartSyncronized flag
 				// if all items in the group are ready.
                 iEngine->NotifyEffectReady(iGroupId);
-                iNotifiedEffectReady = ETrue;
+                SetEffectFlag(KHuiReadyToDrawNotified);
                 return;
                 }
 
@@ -552,6 +563,7 @@
         {
         iRoot->AdvanceTime(aElapsedTime);
         }
+    iElapsedTime += aElapsedTime;
     }
     
 EXPORT_C TBool CHuiFxEffect::IsAnimated() const
@@ -631,3 +643,8 @@
     {
     iRoot->FxmlVisualInputs(aArray);
     }
+
+TBool CHuiFxEffect::FxmlUsesOpaqueHint() const
+    {
+    return iRoot->FxmlUsesOpaqueHint();
+    }