uiacceltk/hitchcock/ServerCore/Src/alfbridge.cpp
branchRCL_3
changeset 50 1801340c26a2
parent 49 c9d868f1e20c
child 51 e5af45d51884
equal deleted inserted replaced
49:c9d868f1e20c 50:1801340c26a2
    82 
    82 
    83 #ifdef SYMBIAN_BUILD_GCE
    83 #ifdef SYMBIAN_BUILD_GCE
    84 #include <bautils.h>
    84 #include <bautils.h>
    85 #endif
    85 #endif
    86 
    86 
       
    87 #ifdef ALF_MEMORYLOGGING
       
    88 #include <hal.h>
       
    89 #endif
       
    90 
       
    91 #include <graphics/fbsrasterizer.h>
       
    92 #include <graphics/fbsrasterizerclearcache.h>
       
    93 
    87 const TInt KVisualTransformationStepRotate    = 0;
    94 const TInt KVisualTransformationStepRotate    = 0;
    88 
    95 
    89 const TReal32 KAlfVisualDefaultOpacity = 1.0f;
    96 const TReal32 KAlfVisualDefaultOpacity = 1.0f;
    90 //const TReal32 KAlfVisualDefaultOpacity = 0.5f;
    97 //const TReal32 KAlfVisualDefaultOpacity = 0.5f;
    91 const TInt KEffectCleanupDelayInMs = 10;
    98 const TInt KEffectCleanupDelayInMs = 10;
   130 // Duration to wait if coverage is modified by multiple control groups.
   137 // Duration to wait if coverage is modified by multiple control groups.
   131 // This may indicate that topmost application hasn't yet had time to update
   138 // This may indicate that topmost application hasn't yet had time to update
   132 // its layout properly.
   139 // its layout properly.
   133 const TInt KAlfCheckCoverageFromMultipleGroups = 20;
   140 const TInt KAlfCheckCoverageFromMultipleGroups = 20;
   134 
   141 
       
   142 // Duration to wait if visual is not ready for current orientation.
       
   143 // 1 unit = 50ms.
       
   144 const TInt KAlfCheckVisualIsNotReady = 15;
   135 
   145 
   136 NONSHARABLE_CLASS( TAlfBridgeDrawerWrapper ) : public MAlfDrawerScreenInterface
   146 NONSHARABLE_CLASS( TAlfBridgeDrawerWrapper ) : public MAlfDrawerScreenInterface
   137     {
   147     {
   138 public:
   148 public:
   139     TAlfBridgeDrawerWrapper(CAlfBridge& aBridge);
   149     TAlfBridgeDrawerWrapper(CAlfBridge& aBridge);
   905         TAlfControlGroupEntry entry;
   915         TAlfControlGroupEntry entry;
   906         entry.iControlGroup = group;
   916         entry.iControlGroup = group;
   907         entry.iWindowGroupNodeId = aWindowGroupNodeId;
   917         entry.iWindowGroupNodeId = aWindowGroupNodeId;
   908         entry.iClientWindowGroupId = aClientWindowGroupId;  
   918         entry.iClientWindowGroupId = aClientWindowGroupId;  
   909         entry.iSecureId = aSecureId;
   919         entry.iSecureId = aSecureId;
       
   920         // Add to the control group. HandleGfxEventL effect redirection will need this information
       
   921         entry.iScreenNumber = aScreenNumber;
       
   922         iAlfScreens[aScreenNumber]->iControlGroups.Append(entry);
       
   923         CleanupStack::Pop(group);                
       
   924 
   910         // we have received start effect for this group, but the group did not exist in alf universe at the time. hide the group.
   925         // we have received start effect for this group, but the group did not exist in alf universe at the time. hide the group.
   911         if (iFSFxData
   926         if (iFSFxData
   912                 && (iFSFxData->State() == EWaitingWindowGroup || iFSFxData->State() == EEndFullScreenReceivedWaitingWindowGroup)
   927                 && (iFSFxData->State() == EWaitingWindowGroup || iFSFxData->State() == EEndFullScreenReceivedWaitingWindowGroup)
   913                 && iFSFxData->iToSecureId == aSecureId)
   928                 && iFSFxData->iToSecureId == aSecureId)
   914             {
   929             {
   945                 // Effect failed, reset state
   960                 // Effect failed, reset state
   946                 __ALFFXLOGSTRING1("CAlfBridge::CreateControlGroupL - effect failed on layout 0x%x", layout);
   961                 __ALFFXLOGSTRING1("CAlfBridge::CreateControlGroupL - effect failed on layout 0x%x", layout);
   947                 HandleGfxStopEvent( EFalse ); // destroys iFSFxData and iFSFXDataPart2
   962                 HandleGfxStopEvent( EFalse ); // destroys iFSFxData and iFSFXDataPart2
   948                 }
   963                 }
   949             }     
   964             }     
   950         entry.iScreenNumber = aScreenNumber;
       
   951 //        entry.iRole = EHuiWindowGroupContainer;
       
   952 
       
   953         iAlfScreens[aScreenNumber]->iControlGroups.Append(entry);
       
   954         CleanupStack::Pop(group);                
       
   955 
   965 
   956         if (iAlfScreens[aScreenNumber]->iDisplay)
   966         if (iAlfScreens[aScreenNumber]->iDisplay)
   957             ShowControlGroupL(iAlfScreens[aScreenNumber]->iDisplay->Roster(), *group, KHuiRosterShowAtTop, aScreenNumber); 
   967             ShowControlGroupL(iAlfScreens[aScreenNumber]->iDisplay->Roster(), *group, KHuiRosterShowAtTop, aScreenNumber); 
   958         
   968         
   959         AMT_INC_COUNTER( iTotalControlGroupCount );
   969         AMT_INC_COUNTER( iTotalControlGroupCount );
  1641                             iTempRegion.AddRect(fullscreen);
  1651                             iTempRegion.AddRect(fullscreen);
  1642                             iTempRegion.Tidy();
  1652                             iTempRegion.Tidy();
  1643                             fullscreenCovered = ETrue;
  1653                             fullscreenCovered = ETrue;
  1644                             firstAlfControlGroupFound = ETrue;  // change flag so that we don't go in this branch again
  1654                             firstAlfControlGroupFound = ETrue;  // change flag so that we don't go in this branch again
  1645                             }
  1655                             }
       
  1656                         else
       
  1657                             {
       
  1658                             hostContainer->SetFlags(EHuiVisualFlagInactive);
       
  1659                             }
  1646                         }
  1660                         }
  1647                     }
  1661                     }
  1648                 else // else put as inactive
  1662                 else // else put as inactive
  1649                     {
  1663                     {
  1650                     hostContainer->SetFlags(EHuiVisualFlagInactive);
  1664                     hostContainer->SetFlags(EHuiVisualFlagInactive);
  2500             case EAlfDSIncludeToVisibilityCalculation:
  2514             case EAlfDSIncludeToVisibilityCalculation:
  2501                 {
  2515                 {
  2502                 HandleIncludeToVisibilityCalculationL( data );
  2516                 HandleIncludeToVisibilityCalculationL( data );
  2503                 break;
  2517                 break;
  2504                 }
  2518                 }
       
  2519             case EAlfDSSetScreenDeviceValid:
       
  2520                 {
       
  2521                 HandleSetScreenDeviceValidL( data );
       
  2522                 break;
       
  2523                 }
       
  2524                 
  2505             case EAlfDSSetWindowArea:
  2525             case EAlfDSSetWindowArea:
  2506                 {
  2526                 {
  2507                 HandleSetWindowAreaL( data );
  2527                 HandleSetWindowAreaL( data );
  2508                 break;
  2528                 break;
  2509                 }
  2529                 }
  2872 			{
  2892 			{
  2873 			__ALFLOGSTRING("CAlfBridge::HandleNewWindowL: Unknown window node type received !");
  2893 			__ALFLOGSTRING("CAlfBridge::HandleNewWindowL: Unknown window node type received !");
  2874 			}
  2894 			}
  2875 		}
  2895 		}
  2876 	iAlfScreens[0]->SetVisualTreeVisibilityChanged(ETrue);
  2896 	iAlfScreens[0]->SetVisualTreeVisibilityChanged(ETrue);
       
  2897 	
       
  2898 #ifdef ALF_MEMORYLOGGING
       
  2899     ReportMemory();
       
  2900 #endif
  2877 	}
  2901 	}
  2878 
  2902 
  2879 // ---------------------------------------------------------------------------
  2903 // ---------------------------------------------------------------------------
  2880 // HandleDestroyWindow
  2904 // HandleDestroyWindow
  2881 // ---------------------------------------------------------------------------
  2905 // ---------------------------------------------------------------------------
  3222         __ALFLOGSTRING("CAlfBridge::HandleIncludeToVisibilityCalculationL, EAlfDSIncludeToVisibilityCalculation: Visual not found!");                                                
  3246         __ALFLOGSTRING("CAlfBridge::HandleIncludeToVisibilityCalculationL, EAlfDSIncludeToVisibilityCalculation: Visual not found!");                                                
  3223         }              
  3247         }              
  3224     }
  3248     }
  3225 
  3249 
  3226 // ---------------------------------------------------------------------------
  3250 // ---------------------------------------------------------------------------
       
  3251 // HandleSetScreenDeviceValidL
       
  3252 // ---------------------------------------------------------------------------
       
  3253 // 
       
  3254 void CAlfBridge::HandleSetScreenDeviceValidL( TAlfBridgerData& aData )
       
  3255     {
       
  3256 	TInt windowNodeId = aData.iInt2;
       
  3257 	TAlfWindowAttributes* windowAttributes = (TAlfWindowAttributes*) (*iHost)->GetVarDataL( (TInt)aData.iPtr );
       
  3258 
       
  3259 	// fetch visual
       
  3260 	CHuiCanvasVisual* viz = (CHuiCanvasVisual*)FindVisual(windowNodeId);
       
  3261 	if (viz)
       
  3262 		{
       
  3263 #ifdef HUI_DEBUG_TRACK_DRAWING
       
  3264         if ( viz->Tracking() )
       
  3265             {
       
  3266             RDebug::Print(_L("CAlfBridge::HandleSetScreenDeviceValidL - Tracked visual"));
       
  3267             }
       
  3268 #endif
       
  3269 		if ( windowAttributes->iActive )
       
  3270 		    {
       
  3271 		    viz->ClearCanvasFlags( EHuiCanvasVisualFlagNotReady );
       
  3272 		    }
       
  3273 		else
       
  3274 		    {
       
  3275 		    viz->SetCanvasFlags( EHuiCanvasVisualFlagNotReady );
       
  3276 		    }
       
  3277 		
       
  3278 	    iAlfScreens[0]->SetVisualTreeVisibilityChanged(ETrue);
       
  3279 		}
       
  3280 	else
       
  3281 		{
       
  3282 		__ALFLOGSTRING("CAlfBridge::HandleSetScreenDeviceValidL, EAlfDSSetScreenDeviceValid: Visual not found!");                                                
       
  3283 		}          
       
  3284     }
       
  3285 
       
  3286 // ---------------------------------------------------------------------------
  3227 // HandleSetWindowAreaL
  3287 // HandleSetWindowAreaL
  3228 // ---------------------------------------------------------------------------
  3288 // ---------------------------------------------------------------------------
  3229 // 
  3289 // 
  3230 void CAlfBridge::HandleSetWindowAreaL( TAlfBridgerData& aData )
  3290 void CAlfBridge::HandleSetWindowAreaL( TAlfBridgerData& aData )
  3231 	{
  3291 	{
  3312 			else
  3372 			else
  3313 				{
  3373 				{
  3314 				__ALFLOGSTRING1("CAlfBridge::HandleReorderWindowL, EAlfDSReorder: WS window group going to: %d ",windowAttributes->iOrdinalPosition);                                        
  3374 				__ALFLOGSTRING1("CAlfBridge::HandleReorderWindowL, EAlfDSReorder: WS window group going to: %d ",windowAttributes->iOrdinalPosition);                                        
  3315 				}    
  3375 				}    
  3316 			#endif
  3376 			#endif
       
  3377 
       
  3378             TBool wasInvalidReachable = IsVisualNotReadyReachable();
  3317 
  3379 
  3318 			CHuiControlGroup* controlGroup = FindControlGroup(windowGroupNodeId);
  3380 			CHuiControlGroup* controlGroup = FindControlGroup(windowGroupNodeId);
  3319 			
  3381 			
  3320             if (!controlGroup)
  3382             if (!controlGroup)
  3321                 {
  3383                 {
  3353 				{
  3415 				{
  3354 				__ALFLOGSTRING1("CAlfBridge::HandleReorderWindowL, EAlfDSReorder: Control group not found! Id: %d ", windowNodeId );        
  3416 				__ALFLOGSTRING1("CAlfBridge::HandleReorderWindowL, EAlfDSReorder: Control group not found! Id: %d ", windowNodeId );        
  3355 				}
  3417 				}
  3356 			
  3418 			
  3357 			ReorderAlfControlGroupsL();                                        
  3419 			ReorderAlfControlGroupsL();                                        
       
  3420 
       
  3421             // Usually, layout switch is initiated by akncapserver before window group in new orientation 
       
  3422             // becomes visible. However, sometimes either akncapserver isn't fast enough or then applications 
       
  3423             // perform operations in wrong order. To reduce flickering, uiaccelerator provides implicit blanker.
       
  3424 
       
  3425             // We will check if there is a visual that is not ready for current orientation.
       
  3426             // If such visual is found before fullscreen is covered then we will enable
       
  3427             // implicit blanker. That gives akncapserver some time to start layout switch.
       
  3428 	
       
  3429             if (!wasInvalidReachable && IsVisualNotReadyReachable())
       
  3430                 {
       
  3431                 iLayoutSwitchEffectCoordinator->ImplicitBlank();
       
  3432                 }
       
  3433 
  3358 			break;    
  3434 			break;    
  3359 			}
  3435 			}
  3360 		case EAlfWinTreeNodeClient:
  3436 		case EAlfWinTreeNodeClient:
  3361 		case EAlfWinTreeNodeRoot:
  3437 		case EAlfWinTreeNodeRoot:
  3362 		case EAlfWinTreeNodeAnim:
  3438 		case EAlfWinTreeNodeAnim:
  3912 	TInt windowGroupNodeId = aData.iInt1;
  3988 	TInt windowGroupNodeId = aData.iInt1;
  3913 	TInt windowNodeId = aData.iInt2;
  3989 	TInt windowNodeId = aData.iInt2;
  3914 	TAlfWindowAttributes* windowAttributes = (TAlfWindowAttributes*)(*iHost)->GetVarDataL( (TInt)aData.iPtr );
  3990 	TAlfWindowAttributes* windowAttributes = (TAlfWindowAttributes*)(*iHost)->GetVarDataL( (TInt)aData.iPtr );
  3915 	// fetch visual
  3991 	// fetch visual
  3916 	CHuiCanvasVisual* viz = FindVisual(windowNodeId);
  3992 	CHuiCanvasVisual* viz = FindVisual(windowNodeId);
  3917 
  3993 	CHuiControlGroup* controlgroup = FindControlGroup(windowGroupNodeId, 0);
       
  3994 	
  3918     // We should not do this for alf window, but renderstage does not know if it is
  3995     // We should not do this for alf window, but renderstage does not know if it is
  3919     // handling alf window or other window, so we ignore the request here if needed.
  3996     // handling alf window or other window, so we ignore the request here if needed.
  3920     // TODO: When alf apps work in multiple display, check here for every displays alf groups...
  3997     // TODO: When alf apps work in multiple display, check here for every displays alf groups...
  3921 	if (viz && iAlfWindowGroupNodeId != windowGroupNodeId)
  3998 	if (viz && iAlfWindowGroupNodeId != windowGroupNodeId && controlgroup && controlgroup->SecureId() != iAlfSecureId )
  3922 		{
  3999 		{
  3923         viz->SetLayerExtent(windowAttributes->iSurfaceExtent);
  4000         viz->SetLayerExtent(windowAttributes->iSurfaceExtent);
  3924 		// Set surface extend area to be cleared with fully transparent color
  4001 		// Set surface extend area to be cleared with fully transparent color
  3925 		// Note: does not support extend that is bigger that the visual
  4002 		// Note: does not support extend that is bigger that the visual
  3926 		// if surface extent is (0,0,0,0) then the background item array is reseted 
  4003 		// if surface extent is (0,0,0,0) then the background item array is reseted 
  4391                     {
  4468                     {
  4392                     // All children in the tree are not faded, do not apply effect on children.
  4469                     // All children in the tree are not faded, do not apply effect on children.
  4393                     effectFlags |= KHuiFxEffectExcludeChildrenFlag;
  4470                     effectFlags |= KHuiFxEffectExcludeChildrenFlag;
  4394                     //RDebug::Print(_L("CAlfBridge::SetupFadeEffectL - no children faded by parent"));
  4471                     //RDebug::Print(_L("CAlfBridge::SetupFadeEffectL - no children faded by parent"));
  4395                     }
  4472                     }
  4396                 __ALFFXLOGSTRING1("CAlfBridge::SetupFadeEffectL - insert fade 0x%x", &aVisual);
  4473                 
  4397                 TRAP( err, engine->LoadEffectL(*iFadeEffectFile, effect, aVisual.Effectable(), NULL, NULL, 0, effectFlags ) );
  4474                 if (iHuiEnv->MemoryLevel() <= EHuiMemoryLevelLowest)
  4398                 didFadeEffectLoad = ETrue;
  4475                     {
       
  4476                     __ALFFXLOGSTRING("CAlfBridge::SetupFadeEffectL - Skipping because in SW rendering mode");
       
  4477                     didFadeEffectLoad = EFalse;
       
  4478                     }
       
  4479                 else
       
  4480                     {
       
  4481                     __ALFFXLOGSTRING1("CAlfBridge::SetupFadeEffectL - insert fade 0x%x", &aVisual);
       
  4482                     TRAP( err, engine->LoadEffectL(*iFadeEffectFile, effect, aVisual.Effectable(), NULL, NULL, 0, effectFlags ) );
       
  4483                     didFadeEffectLoad = ETrue;
       
  4484                     }
  4399         		}
  4485         		}
  4400         	}
  4486         	}
  4401         }
  4487         }
  4402     else
  4488     else
  4403         {
  4489         {
  4760 // NOTE! If embedded application effects are implemented, this will need revision
  4846 // NOTE! If embedded application effects are implemented, this will need revision
  4761 // ---------------------------------------------------------------------------
  4847 // ---------------------------------------------------------------------------
  4762     
  4848     
  4763 void CAlfBridge::HandleGfxRedirection(CFullScreenEffectState& aEvent, CHuiLayout*& aToLayout)
  4849 void CAlfBridge::HandleGfxRedirection(CFullScreenEffectState& aEvent, CHuiLayout*& aToLayout)
  4764     {
  4850     {
       
  4851     __ALFFXLOGSTRING2("CAlfBridge::HandleGfxRedirection - Redirection check for SecureId 0x%x. Effect setup result: %d.", aEvent.iToSecureId, aEvent.iSetupDone);
  4765     TInt windowGroupNodeId = FindWindowGroupNodeId(*((*aToLayout).Owner().ControlGroup()));
  4852     TInt windowGroupNodeId = FindWindowGroupNodeId(*((*aToLayout).Owner().ControlGroup()));
  4766     CHuiControlGroup* chainedGroup = NULL;
  4853     CHuiControlGroup* chainedGroup = NULL;
  4767     
  4854     
  4768     // check, if the effect is being asked for chained application. This propably indicates that there are two or more instances of it and 
  4855     // check, if the effect is being asked for chained application. This propably indicates that there are two or more instances of it and 
  4769     // effect was supposed to go to the single standalone instance
  4856     // effect was supposed to go to the single standalone instance
  4789                 {
  4876                 {
  4790                 __ALFFXLOGSTRING2("CAlfBridge::HandleGfxRedirection - Wg id: %d IS chained. Index: %d", windowGroupNodeId, i);
  4877                 __ALFFXLOGSTRING2("CAlfBridge::HandleGfxRedirection - Wg id: %d IS chained. Index: %d", windowGroupNodeId, i);
  4791                 }
  4878                 }
  4792             }
  4879             }
  4793         groupList.Close();
  4880         groupList.Close();
  4794         // If there are multiple standalone app groups (e.g. single application having multiple groups), effecting anything would be a guess.
  4881         // Skip effect redirection if the end result is uncertain. This is the case, if
       
  4882         // there are multiple standalone app groups (e.g. single application having multiple groups), 
  4795         if (standaloneGroups>1)
  4883         if (standaloneGroups>1)
  4796             {
  4884             {
  4797             chainedGroup = NULL;
  4885             chainedGroup = NULL;
  4798             aEvent.iIsRedirected = ETrue;
  4886             aEvent.iIsRedirected = ETrue;
  4799             if (iFSFXDataPart2)
  4887             if (iFSFXDataPart2)
  4807         // Which group is chained to this group?
  4895         // Which group is chained to this group?
  4808         TUint32 chainedId = FindChainedGroup(windowGroupNodeId); 
  4896         TUint32 chainedId = FindChainedGroup(windowGroupNodeId); 
  4809         chainedGroup = FindControlGroup(chainedId);
  4897         chainedGroup = FindControlGroup(chainedId);
  4810         }
  4898         }
  4811     
  4899     
  4812     if (chainedGroup)
  4900 	// Redirection is skipped if the host layout has been already prepared (in practice added 
  4813         {
  4901 	// to iEffectCleanupStack) for the effect.
  4814         __ALFFXLOGSTRING2("CAlfBridge::HandleGfxEffects - Chained app found for this application. Transferring effect from 0x%x to 0x%x.", aToLayout->Owner().ControlGroup()->SecureId(), chainedGroup->SecureId());
  4902     if (chainedGroup && !aEvent.iSetupDone)
       
  4903         {
       
  4904         __ALFFXLOGSTRING2("CAlfBridge::HandleGfxRedirection - Chained app found for this application. Transferring effect from 0x%x to 0x%x.", aToLayout->Owner().ControlGroup()->SecureId(), chainedGroup->SecureId());
  4815         aToLayout = (CHuiLayout*)&chainedGroup->Control(0).Visual(0);
  4905         aToLayout = (CHuiLayout*)&chainedGroup->Control(0).Visual(0);
  4816         // we'll change the original effect request to point to this new group. Thus, if effect is 
  4906         // we'll change the original effect request to point to this new group. Thus, if effect is 
  4817         // canceled, it will be removed from the right place.
  4907         // canceled, it will be removed from the right place.
  4818         aEvent.iIsRedirected = ETrue;
  4908         
  4819         aEvent.iToSecureId = chainedGroup->SecureId(); // Update the effect
  4909         aEvent.iToSecureId = chainedGroup->SecureId(); // Update the effect
  4820         aEvent.iToWg = FindClientWindowGroupId(*chainedGroup);
  4910         aEvent.iToWg = FindClientWindowGroupId(*chainedGroup);
  4821         
  4911         
  4822         if (iFSFXDataPart2)
  4912         if (iFSFXDataPart2)
  4823             {
  4913             {
  4824             iFSFXDataPart2->iIsRedirected = ETrue;
       
  4825             iFSFXDataPart2->iToSecureId = aEvent.iToSecureId;
  4914             iFSFXDataPart2->iToSecureId = aEvent.iToSecureId;
  4826             iFSFXDataPart2->iToWg = aEvent.iToWg;
  4915             iFSFXDataPart2->iToWg = aEvent.iToWg;
  4827             }
  4916             }
  4828         }
  4917         }
       
  4918     else
       
  4919         {
       
  4920         __ALFFXLOGSTRING2("CAlfBridge::HandleGfxRedirection - Skip redirection for SecureId 0x%x. Chained group: 0x%x", aEvent.iToSecureId, chainedGroup);
       
  4921         }
       
  4922     // Redirection attemp is allowed to happen only once, because this redirects effects for 
       
  4923 	// _running_ embedded applications that must exist at the time of the request. 
       
  4924 	// We are not interested in the embedded applications effects. Start effects for embedded applications
       
  4925 	// are not currently supported.
       
  4926     aEvent.iIsRedirected = ETrue;
       
  4927     if (iFSFXDataPart2)
       
  4928         {
       
  4929         iFSFXDataPart2->iIsRedirected = ETrue;
       
  4930         }
  4829     }
  4931     }
  4830 
  4932 
  4831 // ---------------------------------------------------------------------------
  4933 // ---------------------------------------------------------------------------
  4832 // HandleGfxEventL
  4934 // HandleGfxEventL
  4833 //
  4935 //
  4834 // ---------------------------------------------------------------------------
  4936 // ---------------------------------------------------------------------------
  4835 //
  4937 //
  4836 TBool CAlfBridge::HandleGfxEventL(CFullScreenEffectState& aEvent, CHuiLayout* aToLayout, CHuiLayout* /*aFromLayout */)
  4938 TBool CAlfBridge::HandleGfxEventL(CFullScreenEffectState& aEvent, CHuiLayout* aToLayout, CHuiLayout* /*aFromLayout */)
  4837     {
  4939     {
  4838     __ALFFXLOGSTRING3("CAlfBridge::HandleGfxEventL - To SecureUid: 0x%x, From SecureUid: 0x%x, effect %S", aEvent.iToSecureId, aEvent.iFromSecureId, aEvent.iEffectName);
  4940     __ALFFXLOGSTRING4("CAlfBridge::HandleGfxEventL - Operation: %d, To SecureUid: 0x%x, From SecureUid: 0x%x, effect %S", aEvent.iOperation, aEvent.iToSecureId, aEvent.iFromSecureId, aEvent.iEffectName);
  4839     __ALFFXLOGSTRING3("CAlfBridge::HandleGfxEventL - To layout: 0x%x Effect handle: %d, Action: %d", aToLayout, aEvent.iHandle, aEvent.iAction);
  4941     __ALFFXLOGSTRING3("CAlfBridge::HandleGfxEventL - To layout: 0x%x Effect handle: %d, Action: %d", aToLayout, aEvent.iHandle, aEvent.iAction);
  4840     
  4942     
  4841     if (!aEvent.iIsRedirected)
  4943     if (!aEvent.iIsRedirected)
  4842         {
  4944         {
  4843         HandleGfxRedirection(aEvent, aToLayout);
  4945         HandleGfxRedirection(aEvent, aToLayout);
  4974                         aToLayout->iOpacity.Set(1.0f);
  5076                         aToLayout->iOpacity.Set(1.0f);
  4975                         }
  5077                         }
  4976                         
  5078                         
  4977                     if (aToLayout)
  5079                     if (aToLayout)
  4978                         {
  5080                         {
  4979                          
  5081                         // 1. If this is timeout, then we should be update the 
  4980                         // However, if this is timeout, then we should be having update to date screenshot for the long app start effect usage
  5082 						//    screenshot for the long app start effect usage. 
  4981                         // For the second part of the effect, screenshot must be update. Thus the transition may continue smoothly, where app_start_long.fxml finished.
  5083                         // 2. For the second part of the effect, screenshot must be 
  4982                         if ((aEvent.iLongAppStartTimeout && !aToLayout->StoredRenderBuffer()) 
  5084 						//    update. Thus the transition may continue smoothly, where app_start_long.fxml finished.
  4983                                 || aEvent.iTwoPhaseEffect == CFullScreenEffectState::ESecondPartActive // update the screenshot, that the app_start effect can use the end result of app_start_long.fxml as input
  5085 						// 3. Sometimes BeginFullScreen has not run for the effect. For instance 
  4984 								)
  5086 						//    when window group is created after EndFullScreen was received. 
       
  5087                         TBool requiresScreenshot = NeedsStoredBuffers(iHuiEnv->EffectsEngine(), *aEvent.iEffectName);
       
  5088                         TBool hasScreenshot = TBool(aToLayout->StoredRenderBuffer());
       
  5089                         if ((aEvent.iLongAppStartTimeout && !hasScreenshot)  // (1)
       
  5090                                 || aEvent.iTwoPhaseEffect == CFullScreenEffectState::ESecondPartActive // (2) 
       
  5091 								|| (requiresScreenshot && !hasScreenshot) // (3)
       
  5092                                 )
  4985                             {
  5093                             {
  4986                             __ALFFXLOGSTRING1("CAlfBridge::HandleGfxEventL  - taking screenshot for the timeout appstart effect. Handle: %d",  aEvent.iHandle );
  5094                             __ALFFXLOGSTRING1("CAlfBridge::HandleGfxEventL  - taking screenshot for the timeout appstart effect. Handle: %d",  aEvent.iHandle );
  4987                             aToLayout->SetStoredRenderBufferModificationsEnabled(ETrue);
  5095                             aToLayout->SetStoredRenderBufferModificationsEnabled(ETrue);
  4988                             TBool neededStoredBuffers(EFalse); // dummy 
  5096                             TBool neededStoredBuffers(EFalse); // dummy 
  4989                             StoreLayoutIfRequiredByEffectL(aToLayout, aEvent, neededStoredBuffers);
  5097                             StoreLayoutIfRequiredByEffectL(aToLayout, aEvent, neededStoredBuffers);
  5020                                 // Only changing the effect is required.
  5128                                 // Only changing the effect is required.
  5021                                 layoutEffectable = ETrue; 
  5129                                 layoutEffectable = ETrue; 
  5022                                 }
  5130                                 }
  5023                             else
  5131                             else
  5024                                 {
  5132                                 {
       
  5133 								// SetupEffectLayoutContainerL always returns ETrue. Code cleanup needed.
  5025                                 layoutEffectable = SetupEffectLayoutContainerL(aEvent.iHandle,aToLayout, ETrue, EFalse, aEvent.iCanDestroyOrHideImmediately);
  5134                                 layoutEffectable = SetupEffectLayoutContainerL(aEvent.iHandle,aToLayout, ETrue, EFalse, aEvent.iCanDestroyOrHideImmediately);
  5026                                 }
  5135                                 }
  5027                             aEvent.iSetupDone = layoutEffectable; 
  5136                             aEvent.iSetupDone = ETrue;
       
  5137                             if (iFSFXDataPart2)
       
  5138                                 {
       
  5139                                 iFSFXDataPart2->iSetupDone = aEvent.iSetupDone;
       
  5140                                 }
  5028                             aToLayout->SetStoredRenderBufferModificationsEnabled(ETrue);
  5141                             aToLayout->SetStoredRenderBufferModificationsEnabled(ETrue);
  5029                             }
  5142                             }
  5030 
  5143 
  5031                         if (layoutEffectable)
  5144                         if (layoutEffectable) // Note, this is always ETrue
  5032                             {
  5145                             {
  5033                             TInt effectFlags = 0;
  5146                             TInt effectFlags = 0;
  5034                             TInt activeEffectGroup = engine->ActiveGroupEffect();
  5147                             TInt activeEffectGroup = engine->ActiveGroupEffect();
  5035                             if (activeEffectGroup != KErrNotFound)
  5148                             if (activeEffectGroup != KErrNotFound)
  5036                                 {
  5149                                 {
  5875         }
  5988         }
  5876     
  5989     
  5877     CControlEffectState* fxData = new (ELeave) CControlEffectState;
  5990     CControlEffectState* fxData = new (ELeave) CControlEffectState;
  5878     CleanupStack::PushL(fxData);
  5991     CleanupStack::PushL(fxData);
  5879     fxData->ConstructL(action, stream);
  5992     fxData->ConstructL(action, stream);
  5880     iControlEffectData = fxData;
  5993     
  5881     CleanupStack::Pop(fxData);
       
  5882 
       
  5883     // We now have all the data sent to us.
  5994     // We now have all the data sent to us.
  5884     stream.Release();
  5995     stream.Release();
  5885 
  5996 
  5886     // We need to pass the filename from the transeffect plugin that handles the controls
  5997     // We need to pass the filename from the transeffect plugin that handles the controls
  5887     // that define which effect is used for the selected skin or the selected application
  5998     // that define which effect is used for the selected skin or the selected application
  5890 
  6001 
  5891     CHuiCanvasVisual* visual = FindVisualByClientSideIds(fxData->iClientHandle, fxData->iClientGroupHandle);
  6002     CHuiCanvasVisual* visual = FindVisualByClientSideIds(fxData->iClientHandle, fxData->iClientGroupHandle);
  5892 
  6003 
  5893     if (visual)
  6004     if (visual)
  5894         {
  6005         {
  5895         HandleGfxControlEventL(*iControlEffectData, visual);
  6006         HandleGfxControlEventL(*fxData, visual);
       
  6007         CleanupStack::PopAndDestroy(fxData);
  5896         }
  6008         }
  5897     else
  6009     else
  5898         {
  6010         {
       
  6011        iControlEffectData = fxData; // move ownership
       
  6012         // Control was not found. Apply effect later when control appears in HandleNewWindow
  5899         __ALFFXLOGSTRING2("CAlfBridge::HandleGfxControlEffectsL - Control not found. iClientHandle %d, iClientGroupHandle %d", 
  6013         __ALFFXLOGSTRING2("CAlfBridge::HandleGfxControlEffectsL - Control not found. iClientHandle %d, iClientGroupHandle %d", 
  5900                 iControlEffectData->iClientHandle, 
  6014                 iControlEffectData->iClientHandle, 
  5901                 iControlEffectData->iClientGroupHandle);
  6015                 iControlEffectData->iClientGroupHandle);
       
  6016        CleanupStack::Pop(fxData);
  5902         return;
  6017         return;
  5903         }
  6018         }
  5904     iAlfScreens[0]->iDisplay->SetDirty();
  6019     iAlfScreens[0]->iDisplay->SetDirty();
  5905     iHuiEnv->ContinueRefresh();
  6020     iHuiEnv->ContinueRefresh();
  5906 
       
  5907     delete iControlEffectData;
       
  5908     iControlEffectData = NULL;
       
  5909 
  6021 
  5910     __ALFFXLOGSTRING("HandleGfxControlEffectsL - end");
  6022     __ALFFXLOGSTRING("HandleGfxControlEffectsL - end");
  5911     }
  6023     }
  5912 
  6024 
  5913 void CAlfBridge::HandleGfxControlEventL(CControlEffectState& aEvent,
  6025 void CAlfBridge::HandleGfxControlEventL(CControlEffectState& aEvent,
  6153                 sourceViz->Layout()->Remove(sourceViz);
  6265                 sourceViz->Layout()->Remove(sourceViz);
  6154                 }
  6266                 }
  6155             sourceViz->Owner().Remove(sourceViz);
  6267             sourceViz->Owner().Remove(sourceViz);
  6156              
  6268              
  6157             delete sourceViz;
  6269             delete sourceViz;
  6158             __ALFFXLOGSTRING1("CAlfBridge::RemoveTemporaryPresenterItem - Destroying sourceViz: 0x%x", sourceViz);
  6270             __ALFFXLOGSTRING1("CAlfBridge::CleanFxItem - Destroying sourceViz: 0x%x", sourceViz);
  6159             aEffectItem.iEffectedVisual = NULL;
  6271             aEffectItem.iEffectedVisual = NULL;
  6160             }
  6272             }
  6161         else
  6273         else
  6162             {
  6274             {
  6163             DestroyWindow(sourceViz, ETrue);
  6275             DestroyWindow(sourceViz, ETrue);
  6168 
  6280 
  6169 // CleanFxVisual removes the temporary presenter visual, and unbinds it from the source. 
  6281 // CleanFxVisual removes the temporary presenter visual, and unbinds it from the source. 
  6170 TBool CAlfBridge::CleanFxVisual(CHuiVisual* aVisual,
  6282 TBool CAlfBridge::CleanFxVisual(CHuiVisual* aVisual,
  6171         TInt aHandle)
  6283         TInt aHandle)
  6172     {
  6284     {
  6173     __ALFFXLOGSTRING2("CAlfBridge::RemoveTemporaryPresenterVisual - cleaning handle: %d, 0x%x", aHandle, aVisual);
  6285     __ALFFXLOGSTRING2("CAlfBridge::CleanFxVisual - cleaning handle: %d, 0x%x", aHandle, aVisual);
  6174     TInt visualsRemoved = 0;
  6286     TInt visualsRemoved = 0;
  6175     for (TInt i = 0; i < iEffectCleanupStack.Count(); i++)
  6287     for (TInt i = 0; i < iEffectCleanupStack.Count(); i++)
  6176         {
  6288         {
  6177         TEffectCleanupStruct& effectItem = iEffectCleanupStack[i];
  6289         TEffectCleanupStruct& effectItem = iEffectCleanupStack[i];
  6178         if (aVisual == effectItem.iEffectedVisual || 
  6290         if (aVisual == effectItem.iEffectedVisual || 
  6778 
  6890 
  6779     if (!iSwRenderingEnabled && iManualRefreshTimer)
  6891     if (!iSwRenderingEnabled && iManualRefreshTimer)
  6780         {
  6892         {
  6781         iManualRefreshTimer->Cancel();
  6893         iManualRefreshTimer->Cancel();
  6782         }
  6894         }
       
  6895     if (!aEnable)
       
  6896         {
       
  6897         ClearRasterizerCache();
       
  6898         }
       
  6899 
       
  6900 #ifdef ALF_MEMORYLOGGING
       
  6901     ReportMemory();
       
  6902 #endif
  6783     }
  6903     }
  6784 
  6904 
  6785 // ---------------------------------------------------------------------------
  6905 // ---------------------------------------------------------------------------
  6786 // ---------------------------------------------------------------------------
  6906 // ---------------------------------------------------------------------------
  6787 // 
  6907 // 
  7387         if ( visualIsActive )
  7507         if ( visualIsActive )
  7388             {
  7508             {
  7389             TRect displayRect = visualDisplayRect;
  7509             TRect displayRect = visualDisplayRect;
  7390             visualDisplayRect = canvasVisual->CommandBufferCoverage(aOrientation);
  7510             visualDisplayRect = canvasVisual->CommandBufferCoverage(aOrientation);
  7391 
  7511 
       
  7512             if (aDuration <= KAlfCheckVisualIsNotReady && !visualRectIsCovered && visualIsVisible && 
       
  7513                 !displayRect.IsEmpty() && (canvasVisual->CanvasFlags() & EHuiCanvasVisualFlagNotReady))
       
  7514                 {
       
  7515                 __ALFLOGSTRING("CAlfBridge::IsLayoutSwitchReady not ready - invalid screen device reachable");                 
       
  7516                 visualTreeReady = EFalse;
       
  7517                 break;
       
  7518                 }
       
  7519 
  7392             // Heuristic: Check that visual drawing isn't completely empty.
  7520             // Heuristic: Check that visual drawing isn't completely empty.
  7393             if ( aDuration <= KAlfCheckVisualDrawingNotEmpty && !visualRectIsCovered &&
  7521             if ( aDuration <= KAlfCheckVisualDrawingNotEmpty && !visualRectIsCovered &&
  7394                  visualIsVisible && visualDisplayRect.IsEmpty() )
  7522                  visualIsVisible && visualDisplayRect.IsEmpty() )
  7395                 {
  7523                 {
  7396                 __ALFLOGSTRING("CAlfBridge::IsLayoutSwitchReady not ready - no drawing");
  7524                 __ALFLOGSTRING("CAlfBridge::IsLayoutSwitchReady not ready - no drawing");
  7467         } // for loop end : children checking loop
  7595         } // for loop end : children checking loop
  7468      
  7596      
  7469     return visualTreeReady;
  7597     return visualTreeReady;
  7470     }
  7598     }
  7471 
  7599 
       
  7600 // ---------------------------------------------------------------------------
       
  7601 // ---------------------------------------------------------------------------
       
  7602 // 
       
  7603 TBool CAlfBridge::IsVisualNotReadyReachable()
       
  7604     {
       
  7605     TBool invalidReachable = ETrue;
       
  7606 
       
  7607     if (!iAlfScreens.Count())
       
  7608         {
       
  7609         return EFalse;
       
  7610         }
       
  7611    
       
  7612     iTempRegion.Clear();
       
  7613     iTempRegion2.Clear();
       
  7614     
       
  7615     CAlfScreen* screen = iAlfScreens[0];
       
  7616     TRect fullscreen = TRect(TPoint(0,0), screen->Size());
       
  7617     TInt orientation = screen->iDisplay->Orientation();
       
  7618     
       
  7619     TBool fullscreenCovered = EFalse;
       
  7620 	TBool alfClientWindowGroupVisible = EFalse;
       
  7621 		
       
  7622     // Skip the topmost (effect) layer, start from floating sprite group
       
  7623     for (TInt j=screen->iDisplay->Roster().Count() - screen->FixedControlGroupCount(); j>=0; j--)
       
  7624         {                
       
  7625         CHuiControlGroup& controlgroup = screen->iDisplay->Roster().ControlGroup(j);
       
  7626         CHuiControl& control = controlgroup.Control(0);
       
  7627 
       
  7628         if (control.Role() == EHuiFpsIndicatorContainer)
       
  7629             {
       
  7630             // FPS container doesn't contain canvas visuals
       
  7631             continue;
       
  7632             }
       
  7633 
       
  7634         CHuiCanvasVisual* layout = (CHuiCanvasVisual*)&control.Visual(0);
       
  7635         
       
  7636         // For optimization reasons, check if all visuals below in Z-order are covered    
       
  7637         if (!fullscreenCovered)
       
  7638             {
       
  7639             fullscreenCovered = IsRectCoveredByRegion(fullscreen, iTempRegion);            
       
  7640             }    
       
  7641     
       
  7642         if (fullscreenCovered)
       
  7643             {
       
  7644             break;
       
  7645             }    
       
  7646         
       
  7647         // ALF applications are handled by checking if their visuals cover the whole screen.
       
  7648         if (control.Role() == EHuiSessionContainer)
       
  7649             {
       
  7650             CHuiLayout* hostContainer = control.ContainerLayout( NULL );
       
  7651             TInt flags = hostContainer->Flags();            
       
  7652             if (alfClientWindowGroupVisible)
       
  7653                 {
       
  7654                 // check visual sizes if client has not made this control group hidden
       
  7655                 if(!(flags&EHuiVisualFlagUnderOpaqueHint))
       
  7656                     {
       
  7657                     if(iAppUi)
       
  7658                         {
       
  7659                         CAlfAppSrvSessionBase* alfSrvSession = iAppUi->SrvSessionForControlGroup(controlgroup);
       
  7660                         
       
  7661                         TInt clientWindowGroupId = alfSrvSession->ClientWindowGroup();
       
  7662                         // checking the case if there are multiple alf application openend.
       
  7663                         if (clientWindowGroupId == iAppUi->GetLastActiveClient())
       
  7664                             {
       
  7665                             return EFalse;
       
  7666                             }
       
  7667                         }
       
  7668                     }
       
  7669                 }
       
  7670             continue;
       
  7671             }
       
  7672         
       
  7673         TBool hasActiveVisualsInVisualTree(EFalse);
       
  7674         
       
  7675         if (alfClientWindowGroupVisible && (controlgroup.ResourceId() == iAlfWindowGroupNodeId))
       
  7676             {
       
  7677             invalidReachable =
       
  7678                IsVisualNotReadyReachableRecursive( layout, controlgroup, control, 
       
  7679                    hasActiveVisualsInVisualTree, fullscreen, screen, 
       
  7680                    IsVisualOpaque(*layout), alfClientWindowGroupVisible);            
       
  7681             }
       
  7682         else
       
  7683             {
       
  7684             invalidReachable =
       
  7685                IsVisualNotReadyReachableRecursive( layout, controlgroup, control, 
       
  7686                    fullscreenCovered, fullscreen, screen, 
       
  7687                    IsVisualOpaque(*layout), EFalse);      
       
  7688             }
       
  7689 
       
  7690         if (invalidReachable)
       
  7691             {
       
  7692             // Problem found in IsInvalidScreenDeviceVisualReachableRecursive
       
  7693             break;
       
  7694             }
       
  7695 
       
  7696         if ( controlgroup.iAlfApp && layout->iOpacity.Now() > 0.0f )
       
  7697             {
       
  7698             alfClientWindowGroupVisible = ETrue;
       
  7699             }
       
  7700         }
       
  7701 
       
  7702     iTempRegion2.Clear();
       
  7703     
       
  7704     return invalidReachable;
       
  7705     }
       
  7706 
       
  7707 // ---------------------------------------------------------------------------
       
  7708 // ---------------------------------------------------------------------------
       
  7709 // 
       
  7710 TBool CAlfBridge::IsVisualNotReadyReachableRecursive(
       
  7711         CHuiLayout* aLayout,
       
  7712         CHuiControlGroup& aControlGroup,
       
  7713         CHuiControl& aControl,
       
  7714         TBool& aFullscreenCovered, 
       
  7715         const TRect& aFullscreen,
       
  7716         CAlfScreen* aScreen,
       
  7717         TBool aChildCanBeOpaque, 
       
  7718         TBool aOnlyForEmbeddedAlfApp)
       
  7719     {
       
  7720     TBool invalidReachable = EFalse;
       
  7721     TRect visualDisplayRect;
       
  7722     TBool visualRectIsCovered = EFalse;
       
  7723     TBool visualIsOpaque = EFalse;
       
  7724     TBool visualIsActive = EFalse;
       
  7725     CHuiCanvasVisual* canvasVisual = NULL;
       
  7726 
       
  7727     for (TInt i = aLayout->Count() - 1; i >= 0; i--)
       
  7728         {
       
  7729         visualDisplayRect = TRect(0,0,0,0);
       
  7730         visualRectIsCovered = EFalse;
       
  7731         visualIsOpaque = EFalse;
       
  7732         visualIsActive = EFalse;
       
  7733         
       
  7734         canvasVisual = (CHuiCanvasVisual*)(&aLayout->Visual(i));
       
  7735 
       
  7736         // Distraction windows are completely ignored.
       
  7737         TBool distractionWindow = (canvasVisual->CanvasFlags() & EHuiCanvasFlagDistractionWindow);
       
  7738         if ( distractionWindow )
       
  7739             {
       
  7740             continue;
       
  7741             }
       
  7742 
       
  7743         visualIsOpaque = aChildCanBeOpaque && IsVisualOpaque(*canvasVisual);
       
  7744         TBool visualIsVisible = (canvasVisual->iOpacity.Now() > 0.01f);       
       
  7745         
       
  7746         if (canvasVisual->Count() && visualIsVisible)
       
  7747             {
       
  7748             invalidReachable = IsVisualNotReadyReachableRecursive( canvasVisual, aControlGroup, aControl, 
       
  7749                 aFullscreenCovered, aFullscreen, aScreen, 
       
  7750                 visualIsOpaque, EFalse);
       
  7751                 
       
  7752             if (invalidReachable)
       
  7753                 {
       
  7754                 break;
       
  7755                 }
       
  7756             }
       
  7757 
       
  7758         // Calculate visual display rect
       
  7759         visualDisplayRect = canvasVisual->DisplayRect();
       
  7760     
       
  7761         ClipVisualRect(visualDisplayRect, aLayout->DisplayRect());
       
  7762         ClipVisualRect(visualDisplayRect, aFullscreen);
       
  7763         
       
  7764         // Check if covered.
       
  7765         if (aFullscreenCovered)
       
  7766             {
       
  7767             visualRectIsCovered = ETrue;    
       
  7768             }
       
  7769         else
       
  7770             {            
       
  7771             // Check if this visual is covered by other opaque visuals which rects are in "covered" region
       
  7772             // it should not check for alf event window group, when we have embedded alf application,
       
  7773             // because we have assumed that alf app will have full screen covered
       
  7774             if(!aOnlyForEmbeddedAlfApp)
       
  7775                 {
       
  7776                 visualRectIsCovered = IsRectCoveredByRegion(visualDisplayRect, iTempRegion);
       
  7777                 }                                
       
  7778             }
       
  7779     
       
  7780 	    // Determine if visual is active from coverage point of view.
       
  7781         visualIsActive = EFalse;
       
  7782         if (visualRectIsCovered)
       
  7783             {                                        
       
  7784             if (!(canvasVisual->Flags() & EHuiVisualFlagAlwaysDraw)) 
       
  7785                 {
       
  7786                 visualIsActive = EFalse;                
       
  7787                 }
       
  7788             else
       
  7789                 { 
       
  7790                 visualIsActive = ETrue;
       
  7791                 }                
       
  7792             }
       
  7793         else
       
  7794             {
       
  7795 			visualIsActive = ETrue;
       
  7796             }
       
  7797         
       
  7798         // Sprites and effects as we consider them always as transparent and also
       
  7799         // if controlgroup is transformed somehow    
       
  7800         if (aControl.Role() == EHuiFullScreenEffectContainer || 
       
  7801             aControl.Role() == EHuiWindowFloatingSpriteContainer ||
       
  7802             aControlGroup.IsTransformed())
       
  7803             {
       
  7804             visualIsOpaque = EFalse;    
       
  7805             }
       
  7806            
       
  7807         // Check that command buffers are ok.
       
  7808         if ( visualIsActive )
       
  7809             {
       
  7810             if (!visualRectIsCovered && visualIsVisible && !visualDisplayRect.IsEmpty() && 
       
  7811                 (canvasVisual->CanvasFlags() & EHuiCanvasVisualFlagNotReady))
       
  7812                 {
       
  7813                 __ALFLOGSTRING("CAlfBridge::IsLayoutSwitchReady not ready reachable");                   
       
  7814                 invalidReachable = ETrue;
       
  7815                 break;
       
  7816                 }
       
  7817             }
       
  7818 			
       
  7819         if (visualIsActive && visualIsOpaque && !visualRectIsCovered)
       
  7820             { 
       
  7821             // New visibility system takes only window shape into account.
       
  7822             if ( canvasVisual->CanvasFlags() & EHuiCanvasFlagIncludeToVisibilityCalculation )
       
  7823                 {
       
  7824                 if ( !canvasVisual->HasCustomShape() )
       
  7825                     {                    
       
  7826                     TRect displayRect(canvasVisual->DisplayRect());
       
  7827                     ClipVisualRect(displayRect, aLayout->DisplayRect());
       
  7828                     ClipVisualRect(displayRect, aFullscreen);
       
  7829 
       
  7830                     iTempRegion.AddRect(displayRect);
       
  7831                     iTempRegion.Tidy();
       
  7832                     }
       
  7833                 else
       
  7834                     {
       
  7835                     TRect displayRect = canvasVisual->DisplayRect();
       
  7836                     const TRegion& region = canvasVisual->ShapeRegion();
       
  7837                     TPoint delta = -canvasVisual->ShapeOrigin() + displayRect.iTl;
       
  7838                 
       
  7839                     for (TInt i = 0; i < region.Count(); ++i)
       
  7840                         {
       
  7841                         TRect coveredRect(region[i]);
       
  7842                         coveredRect.Move(delta);
       
  7843                         ClipVisualRect(coveredRect, aFullscreen);
       
  7844 
       
  7845                         iTempRegion.AddRect(coveredRect);
       
  7846                         }
       
  7847                     iTempRegion.Tidy();
       
  7848                     }
       
  7849                 }
       
  7850             }        
       
  7851         } // for loop end : children checking loop
       
  7852      
       
  7853     return invalidReachable;
       
  7854     }
       
  7855 
  7472 TBool CAlfBridge::IsFullScreenDrawnRecursiveAlfContent(CHuiVisual* aVisual, TRect& aFullScreen)
  7856 TBool CAlfBridge::IsFullScreenDrawnRecursiveAlfContent(CHuiVisual* aVisual, TRect& aFullScreen)
  7473     {
  7857     {
  7474     if(aVisual)
  7858     if(aVisual)
  7475         {
  7859         {
  7476         TInt flags = aVisual->Flags();
  7860         TInt flags = aVisual->Flags();
  7755             }
  8139             }
  7756         }
  8140         }
  7757     return hasAlfContent;
  8141     return hasAlfContent;
  7758     }
  8142     }
  7759 
  8143 
       
  8144 void CAlfBridge::ReportMemory()
       
  8145     {
       
  8146 #ifdef ALF_MEMORYLOGGING
       
  8147     TInt totalSpaceAllocated = 0;
       
  8148     TInt cellsAllocatedInHeap = User::AllocSize(totalSpaceAllocated);
       
  8149     TInt largestFreeBlock = 0;
       
  8150     TInt totalFreeSpaceInHeap = User::Available(largestFreeBlock);
       
  8151     TInt freeRAM = 0;
       
  8152     if ( HAL::Get( HALData::EMemoryRAMFree, freeRAM ) != KErrNone )
       
  8153         {
       
  8154         freeRAM = -1;
       
  8155         }
       
  8156     TInt timestamp = User::NTickCount();
       
  8157         
       
  8158     RDebug::Printf("%x CAlfBridge::ReportMemory - Allocated space: %d, Amount of allocated cells: %d, Largest free block: %d, Free space in heap: %d",
       
  8159             timestamp,
       
  8160             totalSpaceAllocated,
       
  8161             cellsAllocatedInHeap,
       
  8162             largestFreeBlock,
       
  8163             totalFreeSpaceInHeap);
       
  8164     RDebug::Printf("%x CAlfBridge::ReportMemory - Free RAM in system: %d", timestamp, freeRAM);
       
  8165 #endif    
       
  8166     }
       
  8167 
       
  8168 void CAlfBridge::ClearRasterizerCache()
       
  8169     {
       
  8170     CFbsRasterizer* rasterizer = CFbsBitmap::Rasterizer();
       
  8171     MFbsRasterizerClearCache* cacheInterfacePtr = NULL;
       
  8172     rasterizer->GetInterface(TUid::Uid(KUidFbsRasterizerClearCache), (TAny*&)cacheInterfacePtr);
       
  8173     if (cacheInterfacePtr)
       
  8174         {
       
  8175         cacheInterfacePtr->ClearCache();
       
  8176         }
       
  8177     }
       
  8178 
  7760 // end of file
  8179 // end of file