--- a/uiacceltk/hitchcock/coretoolkit/src/HuiFxEffect.cpp Mon Jun 21 16:41:52 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/src/HuiFxEffect.cpp Thu Jul 15 19:40:07 2010 +0300
@@ -66,6 +66,7 @@
}
EXPORT_C void CHuiFxEffect::SetVisual( MHuiEffectable *aEffectable )
{
+ iEffectable = aEffectable;
iRoot->SetVisual(aEffectable);
}
EXPORT_C void CHuiFxEffect::SetEngine( CHuiFxEngine *aEngine )
@@ -258,6 +259,56 @@
}
}
+TBool CHuiFxEffect::PrepareDrawL(CHuiGc& aGc, const TRect& aDisplayRect)
+ {
+ if(!iEffectable || iEffectable->EffectReadyToDrawNextFrame() )
+ {
+ iFramesDrawn++;
+ }
+
+ // Prepare all layers
+ TRect displayArea = aGc.DisplayArea();
+ TRect targetArea = aDisplayRect;
+ targetArea.Intersection(displayArea);
+
+ if (targetArea.Width() <= 0 || targetArea.Height() <= 0)
+ {
+ // Not visible
+ return ETrue;
+ }
+
+ if (!iEngine || !iRoot)
+ {
+ return EFalse;
+ }
+
+ if (iEngine->LowMemoryState())
+ {
+ // No memory, no effects.
+ return EFalse;
+ }
+
+ // Check if margins are allowed to be used for this effect
+ if (EffectFlags() & KHuiFxEffectDisableMarginsFlag)
+ {
+ iRoot->EnableMargin(EFalse);
+ }
+
+
+ iRoot->SetTargetRect(targetArea);
+ iRoot->SetSourceRect(targetArea);
+ iRoot->SetDisplayArea(displayArea);
+
+ TRAPD(err, iRoot->PrepareDrawL(*iEngine));
+
+ if (err != KErrNone)
+ {
+ return EFalse;
+ }
+
+ return ETrue;
+ }
+
TBool CHuiFxEffect::CachedDraw(CHuiGc& aGc, const TRect& aDisplayRect, TBool aRefreshCachedRenderTarget, TBool aOpaque)
{
RRegion dummy;
@@ -272,12 +323,11 @@
#ifdef HUIFX_TRACE
RDebug::Print(_L("CHuiFxEffect::CachedDraw - 0x%x"), this);
#endif
- iFramesDrawn++;
+
if (!CHuiStatic::Renderer().Allows(EHuiRenderPluginAllowVisualPBufferSurfaces))
{
return EFalse;
}
-
CHuiFxRenderbuffer* target = NULL;
@@ -303,29 +353,14 @@
return EFalse;
}
- // Check if margins are allowed to be used for this effect
- if (EffectFlags() & KHuiFxEffectDisableMarginsFlag)
- {
- iRoot->EnableMargin(EFalse);
- }
-
// Check if surface pixels are to be used for this effect in all layers.
if (EffectFlags() & KHuiFxEnableBackgroundInAllLayers)
{
iRoot->SetAlwaysReadSurfacePixels(ETrue);
- }
-
- iRoot->SetTargetRect(targetArea);
- iRoot->SetSourceRect(targetArea);
- iRoot->SetDisplayArea(displayArea);
+ }
+
+ iRoot->SetVisualContentState(aRefreshCachedRenderTarget, aOpaque);
- TRAPD(err, iRoot->PrepareDrawL(*iEngine));
-
- if (err != KErrNone)
- {
- return EFalse;
- }
-
if (IsCachedRenderTargetSupported() && IsCachedRenderTargetPreferred())
{
// Background needs to be captured from surface if effect uses background AND
@@ -422,7 +457,6 @@
// Normal drawing
iRoot->Draw(*iEngine, aGc, *target, *target, aHasSurface);
}
-
return ETrue;
}
@@ -432,7 +466,6 @@
#ifdef HUIFX_TRACE
RDebug::Print(_L("CHuiFxEffect::Draw - 0x%x"), this);
#endif
- iFramesDrawn++;
if (!CHuiStatic::Renderer().Allows(EHuiRenderPluginAllowVisualPBufferSurfaces))
{
return EFalse;
@@ -484,6 +517,8 @@
}
iRoot->Draw(*iEngine, aGc, *target, *target, aHasSurface);
+
+
return ETrue;
}
@@ -565,13 +600,13 @@
// its whole timeline by starting the time only when first frame has been drawn.
if (iFlags & KHuiFxDelayRunUntilFirstFrameHasBeenDrawn)
{
- // Sometimes the effect does not get any frames. Force the time to start, because
- // otherwise will jam itself and possible the group, where the effect is.
- if (iElapsedTime > 0.2 && iFramesDrawn == 0)
+ // This is a backup timer. If effect won't start before this 10sec wait there must be something wrong
+ // Force effect to start after 10seconds
+ if (iElapsedTime > 10.0 && iFramesDrawn == 0)
{
iFramesDrawn = 1;
#ifdef HUIFX_TRACE
- RDebug::Printf("CHuiFxEffect::AdvanceTime - Not drawn, but cannot wait. release 0x%x in time %f", this, iElapsedTime);
+ RDebug::Printf("CHuiFxEffect::AdvanceTime - Not drawn in 10sec, FORCE start. There was something wrong. release 0x%x in time %f", this, iElapsedTime);
#endif
}