uiacceltk/hitchcock/ServerCore/Src/alfeffectutils.cpp
changeset 19 f5bac0badc7e
parent 14 83d2d132aa58
child 21 6ce30188c5bf
equal deleted inserted replaced
14:83d2d132aa58 19:f5bac0badc7e
    19 #include "alfeffectutils.h"
    19 #include "alfeffectutils.h"
    20 #include <akntransitionutils.h>
    20 #include <akntransitionutils.h>
    21 #include <alflogger.h>
    21 #include <alflogger.h>
    22 
    22 
    23 const TInt KRosterFreezeEndTimeoutInMs = 100;
    23 const TInt KRosterFreezeEndTimeoutInMs = 100;
    24 const TInt KFirstTimeoutForApplicationEndFullScreenInMs = 20;
       
    25 const TReal KMinimumPaintedAreaBeforeForcedEffect = 0.75;
       
    26 
    24 
    27 // ---------------------------------------------------------
    25 // ---------------------------------------------------------
    28 // CAlfRosterFreezeEndTimer
    26 // CAlfRosterFreezeEndTimer
    29 // ---------------------------------------------------------
    27 // ---------------------------------------------------------
    30 //
    28 //
    58     {
    56     {
    59     iCallBack = aCallBack;
    57     iCallBack = aCallBack;
    60     __ALFLOGSTRING("CAlfRosterFreezeEndTimer::Start");
    58     __ALFLOGSTRING("CAlfRosterFreezeEndTimer::Start");
    61     if (!IsActive())
    59     if (!IsActive())
    62         {
    60         {
       
    61         iSafeCounter = 0;
    63         After( aPeriod );
    62         After( aPeriod );
    64         }
    63         }
    65     }
    64     }
    66 
    65 
    67 void CAlfRosterFreezeEndTimer::RunL()
    66 void CAlfRosterFreezeEndTimer::RunL()
   655 // Returns true if layout switch theme effect may be used
   654 // Returns true if layout switch theme effect may be used
   656 // ---------------------------------------------------------
   655 // ---------------------------------------------------------
   657 //
   656 //
   658 TBool CAlfLayoutSwitchEffectCoordinator::IsThemeEffectEnabled() const
   657 TBool CAlfLayoutSwitchEffectCoordinator::IsThemeEffectEnabled() const
   659     {
   658     {
   660     TBool memoryOk = !( iBridge.iHuiEnv->MemoryLevel() <= EHuiMemoryLevelLowest );
   659     TBool memoryOk = !( iBridge.iHuiEnv->MemoryLevel() <= EHuiMemoryLevelLow );
   661     TBool tfxOn = CAknTransitionUtils::TransitionsEnabled(AknTransEffect::ELayoutswitchTransitionsOff );
   660     TBool tfxOn = CAknTransitionUtils::TransitionsEnabled(AknTransEffect::ELayoutswitchTransitionsOff );
   662     TBool tfxExists = LayoutSwitchEffectsExist();
   661     TBool tfxExists = LayoutSwitchEffectsExist();
   663 
   662 
   664     return 
   663     return 
   665         memoryOk && tfxOn && tfxExists;
   664         memoryOk && tfxOn && tfxExists;
   843     iRect.iBr.iY = aStream.ReadInt32L();
   842     iRect.iBr.iY = aStream.ReadInt32L();
   844 
   843 
   845     ResolveFileNameL(aStream);
   844     ResolveFileNameL(aStream);
   846 
   845 
   847     iCompletionHandle = iHandle;
   846     iCompletionHandle = iHandle;
   848     }
       
   849 
       
   850 TInt doNotifyDrawingTimeout( TAny* aPtr )
       
   851     {
       
   852     ((CFullScreenEffectState*)aPtr)->NotifyDrawingTimeout();
       
   853     return 0; // must return something
       
   854     }
       
   855 
       
   856 TBool CFullScreenEffectState::InitDelayedEffectL(CAlfBridge* aBridge, TSize aDisplaySize)
       
   857     {
       
   858     iBridge = aBridge;
       
   859     iDisplaySize = aDisplaySize;
       
   860     if (!iDrawingCompleteTimer)
       
   861         {
       
   862         iDrawingCompleteTimer = CPeriodic::NewL( EPriorityNormal );
       
   863         iDrawingCompleteTimer->Start( 
       
   864                 KFirstTimeoutForApplicationEndFullScreenInMs * 1000 , 
       
   865                 KFirstTimeoutForApplicationEndFullScreenInMs * 1000 , TCallBack( doNotifyDrawingTimeout, this ));
       
   866         return ETrue;
       
   867         }
       
   868     return EFalse;
       
   869     }
       
   870 
       
   871 void CFullScreenEffectState::NotifyDrawingTimeout()
       
   872     {
       
   873     
       
   874     iPaintedRegion.ClipRect(TRect(0,0, iDisplaySize.iWidth, iDisplaySize.iHeight));
       
   875     iPaintedRegion.Tidy(); // remove overlapping regions
       
   876     TInt size(0);
       
   877     for(TInt i=0; i< iPaintedRegion.Count();i++ )
       
   878         {
       
   879         size += iPaintedRegion[i].Width()*iPaintedRegion[i].Height();
       
   880         }
       
   881     // lets continue, if the covered area is more than 75% of the screen. This is usually enough.
       
   882     if ( size > KMinimumPaintedAreaBeforeForcedEffect  * (iDisplaySize.iWidth * iDisplaySize.iHeight))
       
   883         {
       
   884         iBridge->HandleGfxEndFullScreenTimeout(this);
       
   885         delete iDrawingCompleteTimer;
       
   886         iDrawingCompleteTimer = NULL;
       
   887         }
       
   888     }
   847     }
   889 
   848 
   890 void CControlEffectState::ConstructL(TInt aAction,
   849 void CControlEffectState::ConstructL(TInt aAction,
   891         RMemReadStream& aStream)
   850         RMemReadStream& aStream)
   892     {
   851     {