uiacceltk/hitchcock/ServerCore/Src/alfbridge.cpp
branchRCL_3
changeset 3 d8a3531bc6b8
parent 0 15bf7259bb7c
child 5 433cbbb6a04b
equal deleted inserted replaced
0:15bf7259bb7c 3:d8a3531bc6b8
    68 #include <akntranseffect.h>
    68 #include <akntranseffect.h>
    69 #include "HuiRenderPlugin.h"
    69 #include "HuiRenderPlugin.h"
    70 #include "huicanvasgc.h"
    70 #include "huicanvasgc.h"
    71 #include "huicanvasrenderbuffer.h"
    71 #include "huicanvasrenderbuffer.h"
    72 
    72 
       
    73 #include "alfrenderstageutils.h" // for KAlfPSUidSynchronizer & KAlfPSKeySynchronizer
       
    74 
    73 #ifdef HUI_DEBUG_TRACK_DRAWING
    75 #ifdef HUI_DEBUG_TRACK_DRAWING
    74 #include <alfcommanddebug.h>
    76 #include <alfcommanddebug.h>
    75 #endif
    77 #endif
    76 
    78 
    77 #ifdef _ALF_FXLOGGING
    79 #ifdef _ALF_FXLOGGING
    86 
    88 
    87 const TReal32 KAlfVisualDefaultOpacity = 1.0f;
    89 const TReal32 KAlfVisualDefaultOpacity = 1.0f;
    88 //const TReal32 KAlfVisualDefaultOpacity = 0.5f;
    90 //const TReal32 KAlfVisualDefaultOpacity = 0.5f;
    89 
    91 
    90 _LIT8(KAlfWindowGroupContainerControlTag, "WGROUP");
    92 _LIT8(KAlfWindowGroupContainerControlTag, "WGROUP");
    91 const TInt KAlfNumberOfFixedControlGroups = 2;
       
    92 
    93 
    93 // This debug option prints window group order with __ALFLOGSTRING
    94 // This debug option prints window group order with __ALFLOGSTRING
    94 //#define ALF_DEBUG_PRINT_WINDOWGROUP_ORDER
    95 //#define ALF_DEBUG_PRINT_WINDOWGROUP_ORDER
    95 
    96 
    96 // This debug option shows window groups in a grid
    97 // This debug option shows window groups in a grid
   596 	for( TInt i = 0; i< iAlfRegisteredEffects.Count(); i++ )
   597 	for( TInt i = 0; i< iAlfRegisteredEffects.Count(); i++ )
   597 	    {
   598 	    {
   598 	    delete iAlfRegisteredEffects[i].iEffectFile;
   599 	    delete iAlfRegisteredEffects[i].iEffectFile;
   599 	    }
   600 	    }
   600 	iAlfRegisteredEffects.Close();
   601 	iAlfRegisteredEffects.Close();
   601     iFinishedEffects.Close();
       
   602     delete iEffectEndTimer;
   602     delete iEffectEndTimer;
   603     iDeadControlGroups.Close();
   603     iDeadControlGroups.Close();
   604     iEffectWindowGroups.Close();
   604     iEffectWindowGroups.Close();
   605     delete iFullScreenEffectData;
   605     delete iFullScreenEffectData;
   606 
   606 
   737     CleanupStack::Pop(screen);
   737     CleanupStack::Pop(screen);
   738 
   738 
   739 	ShowControlGroupL(screen->iDisplay->Roster(), *(screen->iFloatingSpriteControlGroup), KHuiRosterShowAtTop, screenNumber); 
   739 	ShowControlGroupL(screen->iDisplay->Roster(), *(screen->iFloatingSpriteControlGroup), KHuiRosterShowAtTop, screenNumber); 
   740 	ShowControlGroupL(screen->iDisplay->Roster(), *(screen->iFullscreenEffectControlGroup), KHuiRosterShowAtTop, screenNumber); 
   740 	ShowControlGroupL(screen->iDisplay->Roster(), *(screen->iFullscreenEffectControlGroup), KHuiRosterShowAtTop, screenNumber); 
   741     
   741     
   742 	
       
   743 	screen->iFloatingSpriteControlGroup->SetAcceptInput(EFalse);
   742 	screen->iFloatingSpriteControlGroup->SetAcceptInput(EFalse);
   744 	screen->iFullscreenEffectControlGroup->SetAcceptInput(EFalse);
   743 	screen->iFullscreenEffectControlGroup->SetAcceptInput(EFalse);
       
   744 	
       
   745 	if ( screen->iFpsControlGroup )
       
   746 	    {
       
   747 	    ShowControlGroupL(screen->iDisplay->Roster(), *(screen->iFpsControlGroup), KHuiRosterShowAtTop, screenNumber); 
       
   748 	    screen->iFpsControlGroup->SetAcceptInput(EFalse);
       
   749 	    }
   745     }
   750     }
   746 
   751 
   747 //------------------------------------------------------------------------------
   752 //------------------------------------------------------------------------------
   748 // Dumdidumdidum..
   753 // Dumdidumdidum..
   749 //------------------------------------------------------------------------------
   754 //------------------------------------------------------------------------------
   760 	ShowControlGroupL(screen->iDisplay->Roster(), *(screen->iFloatingSpriteControlGroup), KHuiRosterShowAtTop, screenNumber); 
   765 	ShowControlGroupL(screen->iDisplay->Roster(), *(screen->iFloatingSpriteControlGroup), KHuiRosterShowAtTop, screenNumber); 
   761 	ShowControlGroupL(screen->iDisplay->Roster(), *(screen->iFullscreenEffectControlGroup), KHuiRosterShowAtTop, screenNumber); 
   766 	ShowControlGroupL(screen->iDisplay->Roster(), *(screen->iFullscreenEffectControlGroup), KHuiRosterShowAtTop, screenNumber); 
   762     
   767     
   763     screen->iFloatingSpriteControlGroup->SetAcceptInput(EFalse);
   768     screen->iFloatingSpriteControlGroup->SetAcceptInput(EFalse);
   764     screen->iFullscreenEffectControlGroup->SetAcceptInput(EFalse);
   769     screen->iFullscreenEffectControlGroup->SetAcceptInput(EFalse);
       
   770     
       
   771     if ( screen->iFpsControlGroup )
       
   772 	    {
       
   773 	    ShowControlGroupL(screen->iDisplay->Roster(), *(screen->iFpsControlGroup), KHuiRosterShowAtTop, screenNumber); 
       
   774 	    screen->iFpsControlGroup->SetAcceptInput(EFalse);
       
   775 	    }
   765     }
   776     }
   766 
   777 
   767 
   778 
   768 
   779 
   769 // ---------------------------------------------------------------------------
   780 // ---------------------------------------------------------------------------
   955                 // have effect on the layout itself or layout is being drawn as external content. This indicates that
   966                 // have effect on the layout itself or layout is being drawn as external content. This indicates that
   956                 // we should not delete the control group at this point, but add it to iDeadControlGroup list, which 
   967                 // we should not delete the control group at this point, but add it to iDeadControlGroup list, which 
   957                 // is cleared when effect has finished.
   968                 // is cleared when effect has finished.
   958                 RPointerArray<CHuiLayout> familyTree;
   969                 RPointerArray<CHuiLayout> familyTree;
   959                 ListFamilyTreeL(familyTree, layout); // recursively dig the family tree
   970                 ListFamilyTreeL(familyTree, layout); // recursively dig the family tree
       
   971                 TBool anyVisualHasEffect(EFalse);
       
   972                 TInt familyIndex(0);
       
   973                 TInt familySize = familyTree.Count();
       
   974                 while(familyIndex < familySize && !anyVisualHasEffect)
       
   975                     {
       
   976                     anyVisualHasEffect = HasActiveEffect(familyTree[familyIndex++]);
       
   977                     }
   960                 
   978                 
   961                 if (HasActiveEffect(layout))
   979                 if (anyVisualHasEffect)
   962                     {
   980                     {
   963                     __ALFFXLOGSTRING1("Layout 0x%x has external content", layout);
   981                     __ALFFXLOGSTRING1("Layout 0x%x has external content", layout);
   964                     // EHuiVisualFlagShouldDestroy destroy flag should have come for the windows in this layout already
   982                     // EHuiVisualFlagShouldDestroy destroy flag should have come for the windows in this layout already
   965                     layout->SetFlags(EHuiVisualFlagShouldDestroy);
   983                     layout->SetFlags(EHuiVisualFlagShouldDestroy);
   966                     // move this layout to effect control group, where it can still be shown. this control group may be deleted.
   984                     // move this layout to effect control group, where it can still be shown. this control group may be deleted.
  1118             {
  1136             {
  1119             // The case where the application control group is deleted by window server
  1137             // The case where the application control group is deleted by window server
  1120             // has been solved by deleting the tag when window server wants to delete
  1138             // has been solved by deleting the tag when window server wants to delete
  1121             // the group. Window server no longer has it, but we keep it alive for a while
  1139             // the group. Window server no longer has it, but we keep it alive for a while
  1122             // to show the effect. The group will be deleted when the effect ends.
  1140             // to show the effect. The group will be deleted when the effect ends.
  1123             aWhere = aRoster.Count() - KAlfNumberOfFixedControlGroups;
  1141             aWhere = aRoster.Count() - screen->FixedControlGroupCount();
  1124             }
  1142             }
  1125         }
  1143         }
  1126 
  1144 
  1127     if (aGroup.Control(0).Role() == EAlfWindowGroupContainer)      
  1145     if (aGroup.Control(0).Role() == EAlfWindowGroupContainer)      
  1128         {
  1146         {
  1144 #ifdef ALF_DEBUG_PRINT_WINDOWGROUP_ORDER        
  1162 #ifdef ALF_DEBUG_PRINT_WINDOWGROUP_ORDER        
  1145         DebugPrintControlGroupOrder(*screen, aRoster, aGroup);
  1163         DebugPrintControlGroupOrder(*screen, aRoster, aGroup);
  1146 #endif
  1164 #endif
  1147 
  1165 
  1148 #ifdef ALF_DEBUG_VISUALIZE_WINDOWGROUP_ORDER
  1166 #ifdef ALF_DEBUG_VISUALIZE_WINDOWGROUP_ORDER
  1149         VisualizeControlGroupOrderL(aRoster, aGroup);
  1167         VisualizeControlGroupOrderL(*screen, aRoster, aGroup);
  1150 #endif
  1168 #endif
  1151     
  1169     
  1152     }
  1170     }
  1153 
  1171 
  1154 // ---------------------------------------------------------------------------
  1172 // ---------------------------------------------------------------------------
  1238         aRoster.ShowL(aGroup, KHuiRosterShowAtBottom);    
  1256         aRoster.ShowL(aGroup, KHuiRosterShowAtBottom);    
  1239         }
  1257         }
  1240     else if (aWhere == KHuiRosterShowAtTop)
  1258     else if (aWhere == KHuiRosterShowAtTop)
  1241         {
  1259         {
  1242         // Topmost
  1260         // Topmost
  1243         aRoster.ShowL(aGroup, aRoster.Count() - KAlfNumberOfFixedControlGroups);
  1261         aRoster.ShowL(aGroup, aRoster.Count() - screen->FixedControlGroupCount());
  1244         }
  1262         }
  1245     else
  1263     else
  1246         {
  1264         {
  1247         TInt index = 0; // Index for Window group control groups
  1265         TInt index = 0; // Index for Window group control groups
  1248         TBool added = EFalse;
  1266         TBool added = EFalse;
  1249         for (TInt i=0; i<aRoster.Count() - KAlfNumberOfFixedControlGroups; i++)
  1267         for (TInt i=0; i<aRoster.Count() - screen->FixedControlGroupCount(); i++)
  1250             {
  1268             {
  1251             if (index == aWhere)
  1269             if (index == aWhere)
  1252                 {
  1270                 {
  1253                 aRoster.ShowL(aGroup, i);        
  1271                 aRoster.ShowL(aGroup, i);        
  1254                 added = ETrue;
  1272                 added = ETrue;
  1264         
  1282         
  1265         // Too large index was given, just add it to topmost    
  1283         // Too large index was given, just add it to topmost    
  1266         if (!added)
  1284         if (!added)
  1267             {
  1285             {
  1268             // Topmost
  1286             // Topmost
  1269             for (TInt i=aRoster.Count()-KAlfNumberOfFixedControlGroups; i >= 0; i--)
  1287             for (TInt i=aRoster.Count() - screen->FixedControlGroupCount(); i >= 0; i--)
  1270                 {
  1288                 {
  1271                 if (aRoster.ControlGroup(i).Control(0).Role() == EAlfWindowGroupContainer)
  1289                 if (aRoster.ControlGroup(i).Control(0).Role() == EAlfWindowGroupContainer)
  1272                     {
  1290                     {
  1273                     aRoster.ShowL(aGroup, i); 
  1291                     aRoster.ShowL(aGroup, i); 
  1274                     break;
  1292                     break;
  1453     {
  1471     {
  1454     return aEffect && !(aEffect->EffectFlags() & KHuiFadeEffectFlag);
  1472     return aEffect && !(aEffect->EffectFlags() & KHuiFadeEffectFlag);
  1455     }
  1473     }
  1456 
  1474 
  1457 // ---------------------------------------------------------------------------
  1475 // ---------------------------------------------------------------------------
       
  1476 // Check if effect has been flagged as opaque
       
  1477 // ---------------------------------------------------------------------------
       
  1478 // 
       
  1479 static TBool IsOpaqueEffect(CHuiFxEffect* aEffect)
       
  1480     {
       
  1481     return aEffect && (aEffect->EffectFlags() & KHuiFxOpaqueHint);
       
  1482     }
       
  1483 
       
  1484 // ---------------------------------------------------------------------------
  1458 // ---------------------------------------------------------------------------
  1485 // ---------------------------------------------------------------------------
  1459 // 
  1486 // 
  1460 TBool CAlfBridge::IsVisualOpaque(CHuiVisual& aVisual)
  1487 TBool CAlfBridge::IsVisualOpaque(CHuiVisual& aVisual)
  1461     {
  1488     {
       
  1489     // Effect with opaque hint overrides everything else.
       
  1490     if (IsOpaqueEffect( aVisual.Effect() ))
       
  1491         {
       
  1492         return ETrue; // Opaque
       
  1493         }    
       
  1494 
  1462     TBool transparent = EFalse;
  1495     TBool transparent = EFalse;
  1463     
  1496     
  1464     // TODO: We should check transformation too and perhaps parent transformations as well ?
  1497     // TODO: We should check transformation too and perhaps parent transformations as well ?
  1465     //transparent |= aVisual.IsTransformed(); 
  1498     //transparent |= aVisual.IsTransformed(); 
  1466 
  1499 
  1590     
  1623     
  1591     TBool fullscreenCovered = EFalse;
  1624     TBool fullscreenCovered = EFalse;
  1592     //iActiveVisualCount = 0;
  1625     //iActiveVisualCount = 0;
  1593     iBgSurfaceFound = EFalse;
  1626     iBgSurfaceFound = EFalse;
  1594     //iPaintedArea = 0;  
  1627     //iPaintedArea = 0;  
       
  1628     
       
  1629     // Check if effect group has an effect with opaque hint.
       
  1630     CHuiControlGroup& fxcontrolgroup = *(iAlfScreens[aScreenNumber]->iFullscreenEffectControlGroup);
       
  1631     CHuiControl& fxcontrol = fxcontrolgroup.Control(0);
       
  1632     CHuiCanvasVisual* fxlayout = (CHuiCanvasVisual*)&fxcontrol.Visual(0);
       
  1633     CHuiVisual* fxExternalContent = fxlayout->ExternalContent();
       
  1634     
       
  1635     if (fxlayout && IsOpaqueEffect(fxlayout->Effect()))
       
  1636         {
       
  1637         fullscreenCovered = ETrue;    
       
  1638         }
       
  1639     else if (fxExternalContent && IsOpaqueEffect(fxExternalContent->Effect()))
       
  1640         {
       
  1641         fullscreenCovered = ETrue;
       
  1642         }    
       
  1643     
       
  1644     #ifdef USE_MODULE_TEST_HOOKS_FOR_ALF
       
  1645     iTempTotalActiveVisualCount = 0;
       
  1646     iTempTotalPassiveVisualCount = 0;
       
  1647     #endif
       
  1648 	
  1595     // skip the topmost (effect) layer, start from floating sprite group
  1649     // skip the topmost (effect) layer, start from floating sprite group
  1596     for (TInt j=screen->iDisplay->Roster().Count() - 2; j>=0; j--)
  1650     for (TInt j=screen->iDisplay->Roster().Count() - screen->FixedControlGroupCount(); j>=0; j--)
  1597         {                
  1651         {                
  1598 #ifdef ALF_DEBUG_PRINT_WINDOWGROUP_ORDER
  1652 #ifdef ALF_DEBUG_PRINT_WINDOWGROUP_ORDER
  1599         TInt activevisualcount = 0;
  1653         TInt activevisualcount = 0;
  1600         TInt passivevisualcount = 0;
  1654         TInt passivevisualcount = 0;
  1601 #endif
  1655 #endif
  1602 
  1656 
  1603         CHuiControlGroup& controlgroup = iAlfScreens[aScreenNumber]->iDisplay->Roster().ControlGroup(j);
  1657         CHuiControlGroup& controlgroup = iAlfScreens[aScreenNumber]->iDisplay->Roster().ControlGroup(j);
  1604         CHuiControl& control = controlgroup.Control(0);
  1658         CHuiControl& control = controlgroup.Control(0);
       
  1659 
       
  1660         if (control.Role() == EAlfFpsIndicatorContainer)
       
  1661             {
       
  1662             // FPS container doesn't contain canvas visuals
       
  1663             continue;
       
  1664             }
       
  1665 
  1605         CHuiCanvasVisual* layout = (CHuiCanvasVisual*)&control.Visual(0);
  1666         CHuiCanvasVisual* layout = (CHuiCanvasVisual*)&control.Visual(0);
  1606 #ifdef HUI_DEBUG_TRACK_DRAWING	
  1667 #ifdef HUI_DEBUG_TRACK_DRAWING	
  1607         if ( layout->Tracking() )
  1668         if ( layout->Tracking() )
  1608             {
  1669             {
  1609             RDebug::Print(_L("CAlfBridge::HandleVisualVisibility: tracked visual 0x%x"), canvasVisual);
  1670             RDebug::Print(_L("CAlfBridge::HandleVisualVisibility: tracked visual 0x%x"), canvasVisual);
  1610             }
  1671             }
  1611 #endif            
  1672 #endif            
  1612 
  1673             
  1613         // Dont mess with alf control group visuals, alf session handling does it for us
  1674         // Dont mess with alf control group visuals, alf session handling does it for us
  1614         // just add the rect to covered region because alf draws solid background.
  1675         // just add the rect to covered region because alf draws solid background.
  1615         if (control.Role() == EAlfSessionContainer)
  1676         if (control.Role() == EAlfSessionContainer)
  1616             {
  1677             {
  1617             iTempRegion.AddRect(fullscreen);
  1678             iTempRegion.AddRect(fullscreen);
  1639             }
  1700             }
  1640         
  1701         
  1641         TBool subTreeCovered = EFalse;
  1702         TBool subTreeCovered = EFalse;
  1642         TBool hasActiveVisualsInVisualTree = HandleLayoutVisualVisibility( layout, controlgroup, control, fullscreenCovered, fullscreen, screen, subTreeCovered, IsVisualOpaque(*layout)  );    
  1703         TBool hasActiveVisualsInVisualTree = HandleLayoutVisualVisibility( layout, controlgroup, control, fullscreenCovered, fullscreen, screen, subTreeCovered, IsVisualOpaque(*layout)  );    
  1643         TBool hasFadeEffectsInVisualTree = (layout->CanvasFlags() & EHuiCanvasFlagExternalFadeExistsInsideVisualTree);        
  1704         TBool hasFadeEffectsInVisualTree = (layout->CanvasFlags() & EHuiCanvasFlagExternalFadeExistsInsideVisualTree);        
       
  1705 
       
  1706         // If root visuals effect is marked as opaque, then add whole screen area as covered.
       
  1707         if (!fullscreenCovered)
       
  1708             {
       
  1709             fullscreenCovered = IsOpaqueEffect(layout->Effect());
       
  1710             }                    
  1644         
  1711         
  1645 		// If we layout is active setup the fade effects. Also if it is inactive, but has been
  1712 		// If we layout is active setup the fade effects. Also if it is inactive, but has been
  1646 		// flagged as containing fade effect, then run the setup as well so that effects which
  1713 		// flagged as containing fade effect, then run the setup as well so that effects which
  1647 		// are no more needed get removed.
  1714 		// are no more needed get removed.
  1648         if (hasActiveVisualsInVisualTree || (!hasActiveVisualsInVisualTree && hasFadeEffectsInVisualTree))
  1715         if (hasActiveVisualsInVisualTree || (!hasActiveVisualsInVisualTree && hasFadeEffectsInVisualTree))
  1706     // blend itself, but other windowgroups do blend. Otherwise windowgrouops above others
  1773     // blend itself, but other windowgroups do blend. Otherwise windowgrouops above others
  1707     // would clear the screen areas where they do not really draw.
  1774     // would clear the screen areas where they do not really draw.
  1708     if (fadeEffectInScreen)
  1775     if (fadeEffectInScreen)
  1709         {
  1776         {
  1710         TBool firstFadedWindowGroupFound = EFalse;
  1777         TBool firstFadedWindowGroupFound = EFalse;
  1711         for (TInt j=0; j<screen->iDisplay->Roster().Count() - 2; j++) // skip the topmost (effect) layer 
  1778         for (TInt j=0; j<screen->iDisplay->Roster().Count() - screen->FixedControlGroupCount(); j++) // skip the topmost (effect) layer 
  1712             {                
  1779             {                
  1713             CHuiControlGroup& controlgroup = iAlfScreens[aScreenNumber]->iDisplay->Roster().ControlGroup(j);
  1780             CHuiControlGroup& controlgroup = iAlfScreens[aScreenNumber]->iDisplay->Roster().ControlGroup(j);
  1714             CHuiControl& control = controlgroup.Control(0);
  1781             CHuiControl& control = controlgroup.Control(0);
  1715             CHuiCanvasVisual* layout = (CHuiCanvasVisual*)&control.Visual(0);
  1782             CHuiVisual* layout = &control.Visual(0);
  1716             if (layout->Effect() && (layout->Effect()->EffectFlags() & KHuiFadeEffectFlag))
  1783             if (layout->Effect() && (layout->Effect()->EffectFlags() & KHuiFadeEffectFlag))
  1717                 {
  1784                 {
  1718                 if (firstFadedWindowGroupFound)
  1785                 if (firstFadedWindowGroupFound)
  1719                     {
  1786                     {
  1720                     TInt flags = layout->Effect()->EffectFlags();
  1787                     TInt flags = layout->Effect()->EffectFlags();
  1723                     }
  1790                     }
  1724                 firstFadedWindowGroupFound = ETrue;
  1791                 firstFadedWindowGroupFound = ETrue;
  1725                 }
  1792                 }
  1726             }
  1793             }
  1727         }
  1794         }
       
  1795 
       
  1796     AMT_FUNC_EXC(AMT_DATA()->iActiveVisualCount = iTempTotalActiveVisualCount;
       
  1797                  AMT_DATA()->iPassiveVisualCount = iTempTotalPassiveVisualCount;
       
  1798                  AMT_DATA()->PrintState()
       
  1799                  );
  1728     }
  1800     }
  1729 
  1801 
  1730 TBool CAlfBridge::HandleLayoutVisualVisibility(
  1802 TBool CAlfBridge::HandleLayoutVisualVisibility(
  1731         CHuiLayout* aLayout, 
  1803         CHuiLayout* aLayout, 
  1732         CHuiControlGroup& aControlGroup,
  1804         CHuiControlGroup& aControlGroup,
  1848                 
  1920                 
  1849             if (!wasInactive)
  1921             if (!wasInactive)
  1850                 {
  1922                 {
  1851                 aScreen->iDisplay->SetDirty();
  1923                 aScreen->iDisplay->SetDirty();
  1852                 }                
  1924                 }                
       
  1925             
       
  1926             #ifdef USE_MODULE_TEST_HOOKS_FOR_ALF
       
  1927             iTempTotalPassiveVisualCount++;
       
  1928             #endif
  1853             
  1929             
  1854     #ifdef ALF_DEBUG_PRINT_WINDOWGROUP_ORDER
  1930     #ifdef ALF_DEBUG_PRINT_WINDOWGROUP_ORDER
  1855             passivevisualcount++;
  1931             passivevisualcount++;
  1856     #endif
  1932     #endif
  1857             }
  1933             }
  1944     #endif
  2020     #endif
  1945                     iTempRegion.AddRect(coveredRect);
  2021                     iTempRegion.AddRect(coveredRect);
  1946                     iTempRegion.Tidy();                                    
  2022                     iTempRegion.Tidy();                                    
  1947                     }
  2023                     }
  1948                 }
  2024                 }
       
  2025             
       
  2026             // If effect is marked as opaque, then add whole visual area as covered.
       
  2027             if (IsOpaqueEffect(canvasVisual->Effect()))
       
  2028                 {
       
  2029                 iTempRegion.AddRect(visualDisplayRect);
       
  2030                 iTempRegion.Tidy();
       
  2031                 }            
  1949             }                                        
  2032             }                                        
  1950         }
  2033         visualTreeActive |= visualIsActive;
  1951     
  2034         } // for loop end : children checking loop
  1952     visualTreeActive |= visualIsActive; 
  2035      
  1953     return visualTreeActive;
  2036     return visualTreeActive;
  1954     }
  2037     }
  1955 
  2038 
  1956 
  2039 
  1957 // ---------------------------------------------------------------------------
  2040 // ---------------------------------------------------------------------------
  1961     {
  2044     {
  1962     if (!iAlfScreens.Count())
  2045     if (!iAlfScreens.Count())
  1963         return;
  2046         return;
  1964             
  2047             
  1965     CAlfScreen* screen = iAlfScreens[0]; // TODO  
  2048     CAlfScreen* screen = iAlfScreens[0]; // TODO  
  1966     for (TInt j=screen->iDisplay->Roster().Count() - 2; j>=0; j--) // skip the topmost (effect) layer 
  2049     for (TInt j=screen->iDisplay->Roster().Count() - screen->FixedControlGroupCount(); j>=0; j--) // skip the topmost (effect) layer 
  1967         {                
  2050         {                
  1968         CHuiControlGroup& controlgroup = iAlfScreens[0]->iDisplay->Roster().ControlGroup(j);
  2051         CHuiControlGroup& controlgroup = iAlfScreens[0]->iDisplay->Roster().ControlGroup(j);
  1969         CHuiControl& control = controlgroup.Control(0);
  2052         CHuiControl& control = controlgroup.Control(0);
  1970 
  2053 
  1971         if ( control.Role() == EAlfSessionContainer )
  2054         if ( control.Role() == EAlfSessionContainer ||
       
  2055              control.Role() == EAlfFpsIndicatorContainer )
  1972             {
  2056             {
  1973             continue;
  2057             continue;
  1974             }
  2058             }
  1975         
  2059         
  1976         CHuiLayout* layout = (CHuiLayout*)&control.Visual(0);
  2060         CHuiVisual* layout = &control.Visual(0);
  1977         for (TInt i=layout->Count()-1; i >= 0; i--)
  2061         for (TInt i=layout->Count()-1; i >= 0; i--)
  1978             {
  2062             {
  1979             CHuiCanvasVisual* canvasVisual = (CHuiCanvasVisual*)(&layout->Visual(i));
  2063             CHuiCanvasVisual* canvasVisual = (CHuiCanvasVisual*)(&layout->Visual(i));
  1980             if (!aInactiveOnly)
  2064             if (!aInactiveOnly)
  1981                 {
  2065                 {
  2044         // dispatch
  2128         // dispatch
  2045         __ALFLOGSTRING1( "CAlfBridge::DoDispatchL: %d",data.iOp );
  2129         __ALFLOGSTRING1( "CAlfBridge::DoDispatchL: %d",data.iOp );
  2046 
  2130 
  2047         switch (data.iOp)
  2131         switch (data.iOp)
  2048             {
  2132             {
       
  2133             case EAlfDSSynchronize:
       
  2134                 {
       
  2135                 TInt id = data.iInt1;
       
  2136                 if ( iHuiEnv )
       
  2137                     {
       
  2138                     iHuiEnv->Synchronize( id, this );
       
  2139                     }
       
  2140                 }
       
  2141                 break;
       
  2142                 
  2049             case EAlfDSCreateNewDisplay:
  2143             case EAlfDSCreateNewDisplay:
  2050                 {
  2144                 {
  2051                 AddNewScreenL(NULL);
  2145                 AddNewScreenL(NULL);
  2052                 break;
  2146                 break;
  2053                 }
  2147                 }
  2328     // TODO: Following delete iAlfScreens[aScreenNumber] crashes when display is trying to delete roster. 
  2422     // TODO: Following delete iAlfScreens[aScreenNumber] crashes when display is trying to delete roster. 
  2329     // RosterEntry is trying to refer to display, which is appareantly alrady destroyed. The roster should have no iRootVisual when display is removed. 
  2423     // RosterEntry is trying to refer to display, which is appareantly alrady destroyed. The roster should have no iRootVisual when display is removed. 
  2330     
  2424     
  2331     iAlfScreens[aScreenNumber]->iDisplay->Roster().Hide(*(iAlfScreens[aScreenNumber]->iFloatingSpriteControlGroup)); 
  2425     iAlfScreens[aScreenNumber]->iDisplay->Roster().Hide(*(iAlfScreens[aScreenNumber]->iFloatingSpriteControlGroup)); 
  2332     iAlfScreens[aScreenNumber]->iDisplay->Roster().Hide(*(iAlfScreens[aScreenNumber]->iFullscreenEffectControlGroup));
  2426     iAlfScreens[aScreenNumber]->iDisplay->Roster().Hide(*(iAlfScreens[aScreenNumber]->iFullscreenEffectControlGroup));
       
  2427     if ( iAlfScreens[aScreenNumber]->iFpsControlGroup )
       
  2428         {
       
  2429         iAlfScreens[aScreenNumber]->iDisplay->Roster().Hide(*(iAlfScreens[aScreenNumber]->iFpsControlGroup));
       
  2430         }
  2333     delete iAlfScreens[aScreenNumber];
  2431     delete iAlfScreens[aScreenNumber];
  2334     iAlfScreens.Remove( aScreenNumber );
  2432     iAlfScreens.Remove( aScreenNumber );
  2335     }
  2433     }
  2336 
  2434 
  2337 // ---------------------------------------------------------------------------
  2435 // ---------------------------------------------------------------------------
  2462 // HandleDestroyWindow
  2560 // HandleDestroyWindow
  2463 // ---------------------------------------------------------------------------
  2561 // ---------------------------------------------------------------------------
  2464 // 
  2562 // 
  2465 void CAlfBridge::DestroyWindow(CHuiVisual* aVisual, TBool aUseForce)
  2563 void CAlfBridge::DestroyWindow(CHuiVisual* aVisual, TBool aUseForce)
  2466     {
  2564     {
  2467     if ( !aUseForce && HasActiveEffect(aVisual) )
  2565     TInt index;
       
  2566     TBool visualParticipatingInEffect = HasActiveEffect(aVisual, index);
       
  2567     
       
  2568     TBool effectIsExitEffect(ETrue);
       
  2569     if (index != KErrNotFound)
       
  2570         {
       
  2571         effectIsExitEffect = iEffectCleanupStack[index].iHideWhenFinished;
       
  2572         }
       
  2573     // effects inside application may need to destroy window to get the new content visible. 
       
  2574     // Even when there is effect on the layout, destruction of a child window must be allowed.
       
  2575     if ( !aUseForce && visualParticipatingInEffect && effectIsExitEffect )
  2468         {
  2576         {
  2469         // this visual will be destroyed on the effect call back.
  2577         // this visual will be destroyed on the effect call back.
  2470         __ALFFXLOGSTRING1("CAlfBridge::DestroyWindow - not destroying 0x%x", aVisual);
  2578         __ALFFXLOGSTRING1("CAlfBridge::DestroyWindow - not destroying 0x%x", aVisual);
  2471         aVisual->SetFlag(EHuiVisualFlagShouldDestroy);
  2579         aVisual->SetFlag(EHuiVisualFlagShouldDestroy);
  2472         // TODO: Revise
  2580         // TODO: Revise
  2486     aVisual->Owner().Remove(aVisual);
  2594     aVisual->Owner().Remove(aVisual);
  2487     __ALFLOGSTRING1("CAlfBridge::HandleDestroyWindow - destroying visual 0x%x", aVisual);
  2595     __ALFLOGSTRING1("CAlfBridge::HandleDestroyWindow - destroying visual 0x%x", aVisual);
  2488     // check if visual is having an effect at the moment. This could occur, if options menu is exited (with effect) and then 
  2596     // check if visual is having an effect at the moment. This could occur, if options menu is exited (with effect) and then 
  2489     // application is exited. EHuiVisualFlagDrawOnlyAsExternalContent is indication that
  2597     // application is exited. EHuiVisualFlagDrawOnlyAsExternalContent is indication that
  2490     // there might be effect on this visual. It is not guaranteen.
  2598     // there might be effect on this visual. It is not guaranteen.
  2491 
  2599     
       
  2600     if (!aUseForce)
       
  2601         {
       
  2602         // we can remove from iEffectCleanupStack only when this method was called from HandleDestroyWindow. Otherwise
       
  2603         // messing iEffectCleanupStack is likely to cause forever loop in some RemoveTemporaryPresenterVisuals method
       
  2604         for (TInt i = 0; i < iEffectCleanupStack.Count(); i++)
       
  2605             {
       
  2606             TEffectCleanupStruct& effectItem = iEffectCleanupStack[i];
       
  2607             if (aVisual == effectItem.iEffectedVisual)
       
  2608                 {
       
  2609                 iEffectCleanupStack.Remove(i);
       
  2610                 AMT_DEC_COUNTER(iAlfBridgeEffectCleanupStackCount);
       
  2611                 break;
       
  2612                 }
       
  2613             }
       
  2614         }
  2492     delete aVisual;
  2615     delete aVisual;
  2493     }
  2616     }
  2494 // ---------------------------------------------------------------------------
  2617 // ---------------------------------------------------------------------------
  2495 // HandleDestroyWindowL
  2618 // HandleDestroyWindowL
  2496 // ---------------------------------------------------------------------------
  2619 // ---------------------------------------------------------------------------
  2892 // SetWindowActiveL
  3015 // SetWindowActiveL
  2893 // ---------------------------------------------------------------------------
  3016 // ---------------------------------------------------------------------------
  2894 // 
  3017 // 
  2895 void CAlfBridge::SetWindowActiveL(CHuiVisual* aVisual, TBool aActive)
  3018 void CAlfBridge::SetWindowActiveL(CHuiVisual* aVisual, TBool aActive)
  2896     {
  3019     {
  2897     if (!HasActiveEffect(aVisual))
  3020     TInt effectIndex;
       
  3021     if (!HasActiveEffect(aVisual, effectIndex))
  2898         {
  3022         {
  2899         // Does not have effect
  3023         // Does not have effect
  2900         if (aActive)
  3024         if (aActive)
  2901             {
  3025             {
  2902             aVisual->ClearFlags(EHuiVisualFlagShouldBeHidden | EHuiVisualFlagShouldBeShown);
  3026             aVisual->ClearFlags(EHuiVisualFlagShouldBeHidden | EHuiVisualFlagShouldBeShown);
  2913         // Has effect
  3037         // Has effect
  2914 		// these flags are put to action in RemoveTemporaryPresenterItem
  3038 		// these flags are put to action in RemoveTemporaryPresenterItem
  2915         if (aActive)
  3039         if (aActive)
  2916             {
  3040             {
  2917 			// this prevents windows appearing before their "effected" time
  3041 			// this prevents windows appearing before their "effected" time
  2918             aVisual->SetFlag(EHuiVisualFlagShouldBeShown);
  3042             if (!iEffectCleanupStack[effectIndex].iHideWhenFinished)
       
  3043                 {
       
  3044                 // this is appear effect. Lets show it
       
  3045                 aVisual->iOpacity.Set(KAlfVisualDefaultOpacity);
       
  3046                 }
       
  3047             else
       
  3048                 {
       
  3049                 aVisual->SetFlag(EHuiVisualFlagShouldBeShown);
       
  3050                 }
  2919             aVisual->ClearFlag(EHuiVisualFlagShouldBeHidden);
  3051             aVisual->ClearFlag(EHuiVisualFlagShouldBeHidden);
  2920             }
  3052             }
  2921         else
  3053         else
  2922             {
  3054             {
  2923 			// this prevents windows disappearing before their effect has finished
  3055 			// this prevents windows disappearing before their effect has finished
  3659 // 
  3791 // 
  3660 void CAlfBridge::HandleSetFadeEffectL( TAlfBridgerData& aData )
  3792 void CAlfBridge::HandleSetFadeEffectL( TAlfBridgerData& aData )
  3661     {
  3793     {
  3662     TInt windowNodeId = aData.iInt1;  
  3794     TInt windowNodeId = aData.iInt1;  
  3663     TBool faded = aData.iInt2;
  3795     TBool faded = aData.iInt2;
  3664 
  3796     MWsWindowTreeNode::TType type = (MWsWindowTreeNode::TType)(TInt)aData.iPtr;
  3665     CHuiVisual* viz = (CHuiVisual*)FindVisual(windowNodeId);    
  3797     CHuiVisual* viz = NULL;
  3666     if (!viz)
  3798     if (type != MWsWindowTreeNode::EWinTreeNodeGroup)
  3667         {
  3799         {
  3668         // Visual not found, it could be window group. It must be searched with other method.
  3800         viz = (CHuiVisual*)FindVisual(windowNodeId);
       
  3801         }
       
  3802     else
       
  3803         {
  3669         CHuiControlGroup* cg = FindControlGroup(windowNodeId, 0); // TODO: Screen            
  3804         CHuiControlGroup* cg = FindControlGroup(windowNodeId, 0); // TODO: Screen            
  3670         if (cg) 
  3805         if (cg) 
  3671             {
  3806             {
  3672             CHuiControl& control = cg->Control(0);
  3807             CHuiControl& control = cg->Control(0);
  3673             viz = &control.Visual(0);
  3808             viz = &control.Visual(0);
  3911                 if (aEvent.iAction != 5000)
  4046                 if (aEvent.iAction != 5000)
  3912                     {
  4047                     {
  3913                     if ( aEvent.iAction != AknTransEffect::EApplicationExit && aToLayout->Flags() & EHuiVisualFlagInactive)
  4048                     if ( aEvent.iAction != AknTransEffect::EApplicationExit && aToLayout->Flags() & EHuiVisualFlagInactive)
  3914                         {
  4049                         {
  3915                         aToLayout->iOpacity.Set(1.0f);
  4050                         aToLayout->iOpacity.Set(1.0f);
  3916                         failed = ETrue;
       
  3917                         return failed;
       
  3918                         }
  4051                         }
  3919                         
  4052                         
  3920                     if (aToLayout)
  4053                     if (aToLayout)
  3921                         {
  4054                         {
  3922                         aToLayout->iOpacity.Set(1.0f);
  4055                         aToLayout->iOpacity.Set(1.0f);
  3937 
  4070 
  3938                         if (layoutEffectable)
  4071                         if (layoutEffectable)
  3939                             {
  4072                             {
  3940                             if (aEvent.iRect != TRect())
  4073                             if (aEvent.iRect != TRect())
  3941                                 {
  4074                                 {
  3942                                 TRAP( err, engine->LoadGroupEffectL( *aEvent.iEffectName, effect, aToLayout->Effectable(), engine->ActiveGroupEffect(), &aEvent.iRect, this, aEvent.iHandle ) );
  4075                                 TRAP( err, engine->LoadGroupEffectL( *aEvent.iEffectName, effect, aToLayout->Effectable(), engine->ActiveGroupEffect(), &aEvent.iRect, this, aEvent.iHandle, KHuiFxDelayRunUntilFirstFrameHasBeenDrawn ));
  3943                                 }
  4076                                 }
  3944                             else
  4077                             else
  3945                                 {
  4078                                 {
  3946                                 TRAP( err, engine->LoadGroupEffectL( *aEvent.iEffectName, effect, aToLayout->Effectable(), engine->ActiveGroupEffect(), NULL, this, aEvent.iHandle ) );
  4079                                 TRAP( err, engine->LoadGroupEffectL( *aEvent.iEffectName, effect, aToLayout->Effectable(), engine->ActiveGroupEffect(), NULL, this, aEvent.iHandle, KHuiFxDelayRunUntilFirstFrameHasBeenDrawn ) );
  3947                                 }
  4080                                 }
  3948                             effect = NULL;
  4081                             effect = NULL;
  3949                             // only use the effect if the effect file was correctly parsed
  4082                             // only use the effect if the effect file was correctly parsed
  3950                             if (err != KErrNone)
  4083                             if (err != KErrNone)
  3951                                 {
  4084                                 {
  4422         TBool aIsExitEffect)
  4555         TBool aIsExitEffect)
  4423     {
  4556     {
  4424     CHuiCanvasVisual* temporaryPresenterVisual = NULL;
  4557     CHuiCanvasVisual* temporaryPresenterVisual = NULL;
  4425     TInt enableEffect = ETrue;
  4558     TInt enableEffect = ETrue;
  4426     
  4559     
       
  4560     if (aSourceVisual->iOpacity.Now() >= 0.01)
       
  4561         {
       
  4562         aSourceVisual->SetFlag(EHuiVisualFlagShouldBeShown);
       
  4563         }
       
  4564     
  4427     aSourceVisual->ClearFlags(EHuiVisualFlagShouldBeInactive | EHuiVisualFlagShouldBeUnderOpaqueHint);
  4565     aSourceVisual->ClearFlags(EHuiVisualFlagShouldBeInactive | EHuiVisualFlagShouldBeUnderOpaqueHint);
  4428     if (aIsExitEffect) 
  4566     if (aIsExitEffect) 
  4429         {
  4567         {
  4430         aSourceVisual->SetFlag(EHuiVisualFlagAlwaysDraw);   // forces drawing during exit effect. handlevisualvisibility will set the EShouldbeInactive flag, if visual is determined inactive while this flag is set 
  4568         aSourceVisual->SetFlag(EHuiVisualFlagAlwaysDraw);   // forces drawing during exit effect. handlevisualvisibility will set the EShouldbeInactive flag, if visual is determined inactive while this flag is set 
  4431         }
  4569         }
  4461             TEffectCleanupStruct item = TEffectCleanupStruct(
  4599             TEffectCleanupStruct item = TEffectCleanupStruct(
  4462                     aEffectHandle,
  4600                     aEffectHandle,
  4463                     aSourceVisual, 
  4601                     aSourceVisual, 
  4464                     temporaryPresenterVisual,
  4602                     temporaryPresenterVisual,
  4465                     ETrue,
  4603                     ETrue,
  4466                     EFalse);
  4604                     aIsExitEffect);
  4467             iEffectCleanupStack.AppendL(item);
  4605             iEffectCleanupStack.AppendL(item);
  4468             }
  4606             }
  4469         else
  4607         else
  4470             {
  4608             {
  4471             // this will be a child of another visual, and draw by its parent external content visual
  4609             // this will be a child of another visual, and draw by its parent external content visual
  4472             // aSourceVisual->SetFlag(EHuiVisualFlagDrawOnlyAsExternalContent);
  4610             // aSourceVisual->SetFlag(EHuiVisualFlagDrawOnlyAsExternalContent);
  4473             TEffectCleanupStruct item = TEffectCleanupStruct(aEffectHandle,
  4611             TEffectCleanupStruct item = TEffectCleanupStruct(aEffectHandle,
  4474                         aSourceVisual, NULL, EFalse,
  4612                         aSourceVisual, NULL, EFalse,
  4475                         EFalse);
  4613                         aIsExitEffect);
  4476             iEffectCleanupStack.AppendL(item);
  4614             iEffectCleanupStack.AppendL(item);
  4477             }
  4615             }
  4478      }
  4616      }
  4479     return temporaryPresenterVisual;
  4617     return temporaryPresenterVisual;
  4480     }
  4618     }
  4531         aSourceLayout->SetFlag(EHuiVisualFlagDrawOnlyAsExternalContent);
  4669         aSourceLayout->SetFlag(EHuiVisualFlagDrawOnlyAsExternalContent);
  4532         __ALFFXLOGSTRING3("CAlfBridge::SetupEffectLayoutContainerL - adding handle: %d, 0x%x (source layout)-> 0x%x (presenter layout) to iEffectCleanupStack", aHandle, aSourceLayout, temporaryPresenterVisual);
  4670         __ALFFXLOGSTRING3("CAlfBridge::SetupEffectLayoutContainerL - adding handle: %d, 0x%x (source layout)-> 0x%x (presenter layout) to iEffectCleanupStack", aHandle, aSourceLayout, temporaryPresenterVisual);
  4533         }
  4671         }
  4534     else
  4672     else
  4535         {
  4673         {
  4536         AddEffectItemL(aHandle, aSourceLayout, NULL, &effectControlGroup, ETrue, itemsDestroyed, EFalse);
  4674         AddEffectItemL(aHandle, aSourceLayout, NULL, &effectControlGroup, EFalse, itemsDestroyed, EFalse);
  4537         __ALFFXLOGSTRING2("CAlfBridge::SetupEffectLayoutContainerL - adding handle: %d, 0x%x (source layout), NO presenter layout) to iEffectCleanupStack", aHandle, aSourceLayout);
  4675         __ALFFXLOGSTRING2("CAlfBridge::SetupEffectLayoutContainerL - adding handle: %d, 0x%x (source layout), NO presenter layout) to iEffectCleanupStack", aHandle, aSourceLayout);
  4538         }
  4676         }
  4539     iAlfScreens[0]->iVisualTreeVisibilityChanged = ETrue;
  4677     iAlfScreens[0]->iVisualTreeVisibilityChanged = ETrue;
  4540     iAlfScreens[0]->iDisplay->SetDirty();
  4678     iAlfScreens[0]->iDisplay->SetDirty();
  4541     if (itemsDestroyed)
  4679     if (itemsDestroyed)
  4571     __ALFFXLOGSTRING3("CAlfBridge::SetupEffectContainerL - adding handle: %d, 0x%x (source visual)-> 0x%x (presenter visual)", aHandle, aSourceVisual, temporaryPresenterVisual);
  4709     __ALFFXLOGSTRING3("CAlfBridge::SetupEffectContainerL - adding handle: %d, 0x%x (source visual)-> 0x%x (presenter visual)", aHandle, aSourceVisual, temporaryPresenterVisual);
  4572     }
  4710     }
  4573 
  4711 
  4574 void CAlfBridge::HandleGfxControlEffectsL( TAlfBridgerData data )
  4712 void CAlfBridge::HandleGfxControlEffectsL( TAlfBridgerData data )
  4575     {
  4713     {
  4576     TInt err = KErrNone;
       
  4577     TInt action = data.iInt1;
  4714     TInt action = data.iInt1;
  4578     TInt length = data.iInt2;
  4715     TInt length = data.iInt2;
  4579     __ALFFXLOGSTRING1("HandleGfxControlEffectsL - Reading bridge data %d", (TInt)data.iPtr);
  4716     __ALFFXLOGSTRING1("HandleGfxControlEffectsL - Reading bridge data %d", (TInt)data.iPtr);
  4580     void* bridgeBuffer = (void*) (*iHost)->GetEffectsDataL((TInt) data.iPtr);
  4717     void* bridgeBuffer = (void*) (*iHost)->GetEffectsDataL((TInt) data.iPtr);
  4581     RMemReadStream stream(bridgeBuffer, length);
  4718     RMemReadStream stream(bridgeBuffer, length);
  4610                 iControlEffectData->iClientHandle, 
  4747                 iControlEffectData->iClientHandle, 
  4611                 iControlEffectData->iClientGroupHandle);
  4748                 iControlEffectData->iClientGroupHandle);
  4612         return;
  4749         return;
  4613         }
  4750         }
  4614     iAlfScreens[0]->iDisplay->SetDirty();
  4751     iAlfScreens[0]->iDisplay->SetDirty();
  4615 
       
  4616     iHuiEnv->ContinueRefresh();
  4752     iHuiEnv->ContinueRefresh();
  4617 
       
  4618     if (visual && err != KErrNone)
       
  4619         {
       
  4620         // if the effect loading failed too soon, we must call our callback ourselves
       
  4621         //        RDebug::Print(_L("HandleGfxControlEffectsL - effect not set - going directly to callback"));
       
  4622         AlfGfxEffectEndCallBack(fxData->iHandle);
       
  4623         }
       
  4624 
  4753 
  4625     delete iControlEffectData;
  4754     delete iControlEffectData;
  4626     iControlEffectData = NULL;
  4755     iControlEffectData = NULL;
  4627 
  4756 
  4628     __ALFFXLOGSTRING("HandleGfxControlEffectsL - end");
  4757     __ALFFXLOGSTRING("HandleGfxControlEffectsL - end");
  4673             {
  4802             {
  4674             layoutEffectable = SetupEffectLayoutContainerL(aEvent.iHandle, aCanvasVisual, EFalse);
  4803             layoutEffectable = SetupEffectLayoutContainerL(aEvent.iHandle, aCanvasVisual, EFalse);
  4675             }
  4804             }
  4676         if (layoutEffectable)
  4805         if (layoutEffectable)
  4677             {
  4806             {
  4678             TRAP( err, engine->LoadGroupEffectL(*aEvent.iEffectName, effect, aCanvasVisual->Effectable(), engine->ActiveGroupEffect(), NULL, this, aEvent.iHandle ) );
  4807             TRAP( err, engine->LoadGroupEffectL(*aEvent.iEffectName, effect, aCanvasVisual->Effectable(), engine->ActiveGroupEffect(), NULL, this, aEvent.iHandle, KHuiFxDelayRunUntilFirstFrameHasBeenDrawn ) );
  4679             }
  4808             }
  4680         else
  4809         else
  4681             {
  4810             {
  4682             err = KErrNotFound;
  4811             err = KErrNotFound;
  4683             }
  4812             }
  4729         {
  4858         {
  4730         // this was exit effect, and window was not really destroyed.
  4859         // this was exit effect, and window was not really destroyed.
  4731         sourceViz->iOpacity.Set(0.0f);
  4860         sourceViz->iOpacity.Set(0.0f);
  4732         sourceViz->ClearFlag(EHuiVisualFlagShouldBeHidden); // it is now hidden
  4861         sourceViz->ClearFlag(EHuiVisualFlagShouldBeHidden); // it is now hidden
  4733         }
  4862         }
  4734 	else
  4863 	
  4735 		{
       
  4736         // visual may be transparent after manipulation of the effect
       
  4737 	   	sourceViz->iOpacity.Set(KAlfVisualDefaultOpacity); 
       
  4738 		}
       
  4739     if (showVisual)
  4864     if (showVisual)
  4740         {
  4865         {
  4741         sourceViz->iOpacity.Set(KAlfVisualDefaultOpacity);
  4866         sourceViz->iOpacity.Set(KAlfVisualDefaultOpacity);
  4742         sourceViz->ClearFlag(EHuiVisualFlagShouldBeShown); // it is now hidden
  4867         sourceViz->ClearFlag(EHuiVisualFlagShouldBeShown); // it is now hidden
  4743         }
  4868         }
  4873     return NULL;
  4998     return NULL;
  4874     }
  4999     }
  4875 
  5000 
  4876 TBool CAlfBridge::HasActiveEffect(CHuiVisual* aVisual)
  5001 TBool CAlfBridge::HasActiveEffect(CHuiVisual* aVisual)
  4877     {
  5002     {
       
  5003     TInt dummy;
       
  5004     return HasActiveEffect(aVisual, dummy);
       
  5005     }
       
  5006 
       
  5007 TBool CAlfBridge::HasActiveEffect(CHuiVisual* aVisual, TInt& aIndex)
       
  5008     {
       
  5009     aIndex = KErrNotFound;
  4878     for (TInt i = 0; i < iEffectCleanupStack.Count(); i++)
  5010     for (TInt i = 0; i < iEffectCleanupStack.Count(); i++)
  4879         {
  5011         {
  4880         if (aVisual == iEffectCleanupStack[i].iEffectedVisual)
  5012         if (aVisual == iEffectCleanupStack[i].iEffectedVisual)
  4881             {
  5013             {
       
  5014             aIndex = i;
  4882             return ETrue;
  5015             return ETrue;
  4883             }
  5016             }
  4884         }
  5017         }
  4885     return EFalse;
  5018     return EFalse;
  4886     }
  5019     }
  4933                 {
  5066                 {
  4934                 if (RemoveTemporaryPresenterItem(effectItem))
  5067                 if (RemoveTemporaryPresenterItem(effectItem))
  4935                     {
  5068                     {
  4936                     itemsRemoved++;
  5069                     itemsRemoved++;
  4937                     }
  5070                     }
  4938                 iEffectCleanupStack.Remove(i);
  5071                 if (iEffectCleanupStack.Count() > i)
       
  5072                     {
       
  5073                     iEffectCleanupStack.Remove(i);
       
  5074                     }
  4939                 iFinishedCleanupStackEffects.Remove(0);
  5075                 iFinishedCleanupStackEffects.Remove(0);
  4940                 i--;
  5076                 i--;
  4941                 }
  5077                 }
  4942             }
  5078             }
  4943         }
  5079         }
  4968 
  5104 
  4969 void CAlfBridge::AlfGfxEffectEndCallBack(TInt aHandle)
  5105 void CAlfBridge::AlfGfxEffectEndCallBack(TInt aHandle)
  4970     {
  5106     {
  4971     // We need a delay to prevent the refresh from being messed up
  5107     // We need a delay to prevent the refresh from being messed up
  4972     // We try a short delay before clearing everything up.
  5108     // We try a short delay before clearing everything up.
  4973     __ALFFXLOGSTRING1("AlfGfxEffectEndCallBack, append handle %d", aHandle );
  5109     __ALFFXLOGSTRING1("AlfGfxEffectEndCallBack, handle %d", aHandle );
  4974     //    RDebug::Print(_L("AlfGfxEffectEndCallBack, append handle %d"), aHandle );
  5110     //    RDebug::Print(_L("AlfGfxEffectEndCallBack, append handle %d"), aHandle );
  4975     // If the handle cannot be appended, the function returns an error.
  5111     // If the handle cannot be appended, the function returns an error.
  4976     // However, if the memory is low, there is nothing we can do about it.
  5112     // However, if the memory is low, there is nothing we can do about it.
  4977     // We try to handle the transition finish anyway.
  5113     // We try to handle the transition finish anyway.
  4978     // If there are already other handles in the queue, the handler will not
  5114     // If there are already other handles in the queue, the handler will not
  4979     // be called for this handle, but all handles that have been left hanging
  5115     // be called for this handle, but all handles that have been left hanging
  4980     // around will be cleared when HandleGfxStopEffectsL is called
  5116     // around will be cleared when HandleGfxStopEffectsL is called
  4981   
  5117 
  4982     
       
  4983     iFinishedEffects.Append(aHandle);
       
  4984     	
       
  4985     // iFinishedCleanupStackEffects.Append(aHandle);
  5118     // iFinishedCleanupStackEffects.Append(aHandle);
  4986     if (!iEffectEndTimer->IsActive())
  5119     if (!iEffectEndTimer->IsActive())
  4987         {
  5120         {
  4988         iEffectEndTimer->Start( 10000, aHandle );
  5121         iEffectEndTimer->Start( 10000, aHandle );
  4989         }
  5122         }
  5103             __ALFLOGSTRING3(">> %d EFFECT GROUP %S, %d", i, &processName, clientWindowGroupId );                                                                
  5236             __ALFLOGSTRING3(">> %d EFFECT GROUP %S, %d", i, &processName, clientWindowGroupId );                                                                
  5104 #else
  5237 #else
  5105             __ALFLOGSTRING1(">> %d EFFECT GROUP", i);                                                                
  5238             __ALFLOGSTRING1(">> %d EFFECT GROUP", i);                                                                
  5106 #endif
  5239 #endif
  5107             }
  5240             }
       
  5241         else if (indexedGroup.Control(0).Role() == EAlfFpsIndicatorContainer)
       
  5242             {
       
  5243 #ifdef  HUI_DEBUG_TRACK_DRAWING
       
  5244             __ALFLOGSTRING3(">> %d FPS GROUP %S, %d", i, &processName, clientWindowGroupId );                                                                
       
  5245 #else
       
  5246             __ALFLOGSTRING1(">> %d FPS GROUP", i);                                                                
       
  5247 #endif
       
  5248             }
  5108         else 
  5249         else 
  5109             {
  5250             {
  5110 #ifdef  HUI_DEBUG_TRACK_DRAWING
  5251 #ifdef  HUI_DEBUG_TRACK_DRAWING
  5111             __ALFLOGSTRING3(">> %d UNKNOWN GROUP ?!!? %S, %d", i, &processName, clientWindowGroupId );
  5252             __ALFLOGSTRING3(">> %d UNKNOWN GROUP ?!!? %S, %d", i, &processName, clientWindowGroupId );
  5112 #endif
  5253 #endif
  5144     {
  5285     {
  5145     }
  5286     }
  5146 #endif        
  5287 #endif        
  5147 
  5288 
  5148 #ifdef ALF_DEBUG_VISUALIZE_WINDOWGROUP_ORDER
  5289 #ifdef ALF_DEBUG_VISUALIZE_WINDOWGROUP_ORDER
  5149 void CAlfBridge::VisualizeControlGroupOrderL(CHuiRoster& aRoster, CHuiControlGroup& /*aGroup*/)
  5290 void CAlfBridge::VisualizeControlGroupOrderL(CAlfScreen& aScreen, CHuiRoster& aRoster, CHuiControlGroup& /*aGroup*/)
  5150     {       
  5291     {       
  5151     TInt nbrofcolums = 3;
  5292     TInt nbrofcolums = 3;
  5152     TInt nbrofrows = 3;
  5293     TInt nbrofrows = 3;
  5153     TInt gridIndex = 0;
  5294     TInt gridIndex = 0;
  5154     TBool skipEmpty = EFalse;
  5295     TBool skipEmpty = EFalse;
  5155     if (aRoster.Count() > 3)
  5296     TInt skipCount = aScreen.FixedControlGroupCount() + 1;
  5156         {
  5297     if (aRoster.Count() > skipCount)
  5157         for (TInt i=aRoster.Count() - 3; i>0; i--)
  5298         {
       
  5299         for (TInt i=aRoster.Count() - skipCount; i>0; i--)
  5158             {
  5300             {
  5159             CHuiControl& control = aRoster.ControlGroup(i).Control(0);
  5301             CHuiControl& control = aRoster.ControlGroup(i).Control(0);
  5160             if (skipEmpty)
  5302             if (skipEmpty)
  5161                 {                        
  5303                 {                        
  5162                 TBool empty = ETrue;
  5304                 TBool empty = ETrue;
  5185             }                        
  5327             }                        
  5186         }
  5328         }
  5187     iAlfScreens[0]->iDisplay->SetClearBackgroundL(CHuiDisplay::EClearWithSkinBackground);            
  5329     iAlfScreens[0]->iDisplay->SetClearBackgroundL(CHuiDisplay::EClearWithSkinBackground);            
  5188     }
  5330     }
  5189 #else
  5331 #else
  5190 void CAlfBridge::VisualizeControlGroupOrderL(CHuiRoster& /*aRoster*/, CHuiControlGroup& /*aGroup*/)
  5332 void CAlfBridge::VisualizeControlGroupOrderL(CAlfScreen& /*aScreen*/, CHuiRoster& /*aRoster*/, CHuiControlGroup& /*aGroup*/)
  5191     {       
  5333     {       
  5192     }
  5334     }
  5193 #endif    
  5335 #endif    
  5194 
  5336 
  5195 // ---------------------------------------------------------------------------
  5337 // ---------------------------------------------------------------------------
  5387             {
  5529             {
  5388             // screen owns this bitmap
  5530             // screen owns this bitmap
  5389             aScreen->iSwRenderingTarget = new CFbsBitmap;
  5531             aScreen->iSwRenderingTarget = new CFbsBitmap;
  5390             if (aScreen->iSwRenderingTarget)
  5532             if (aScreen->iSwRenderingTarget)
  5391                 {
  5533                 {
  5392                 aScreen->iSwRenderingTarget->Create(aScreen->Size(), EColor16MA);
  5534                 aScreen->iSwRenderingTarget->Create(aScreen->Size(), EColor16MAP); 
  5393                 modified = ETrue;
  5535                 modified = ETrue;
  5394                 }
  5536                 }
  5395             }
  5537             }
  5396         
  5538         
  5397         if (aScreen->iSwRenderingTarget)
  5539         if (aScreen->iSwRenderingTarget)
  5508     {
  5650     {
  5509     TInt screenNumber = ResolveScreenNumber(aDisplay);    
  5651     TInt screenNumber = ResolveScreenNumber(aDisplay);    
  5510     TRAP_IGNORE(UploadSwRenderingTargetL(iAlfScreens[screenNumber]));
  5652     TRAP_IGNORE(UploadSwRenderingTargetL(iAlfScreens[screenNumber]));
  5511     }
  5653     }
  5512 
  5654 
       
  5655 // ---------------------------------------------------------------------------
       
  5656 // ---------------------------------------------------------------------------
       
  5657 // 
       
  5658 void CAlfBridge::Synchronized(TInt aId)
       
  5659     {
       
  5660     // Use P&S for now.
       
  5661     RProperty::Set( KAlfPSUidSynchronizer, KAlfPSKeySynchronizer, aId );
       
  5662     }
       
  5663 
  5513 // end of file
  5664 // end of file