87 |
88 |
88 const TReal32 KAlfVisualDefaultOpacity = 1.0f; |
89 const TReal32 KAlfVisualDefaultOpacity = 1.0f; |
89 //const TReal32 KAlfVisualDefaultOpacity = 0.5f; |
90 //const TReal32 KAlfVisualDefaultOpacity = 0.5f; |
90 const TInt KEffectCleanupDelayInMs = 10; |
91 const TInt KEffectCleanupDelayInMs = 10; |
91 |
92 |
|
93 const TInt KPreventingCollisionOfIdsInSynchDrawRequests = 35; |
|
94 |
92 _LIT8(KAlfWindowGroupContainerControlTag, "WGROUP"); |
95 _LIT8(KAlfWindowGroupContainerControlTag, "WGROUP"); |
93 |
96 |
94 #define USE_APPLICATION_ENDFULLSCREEN_TIMEOUT |
97 #define USE_APPLICATION_ENDFULLSCREEN_TIMEOUT |
95 // This debug option shows window groups in a grid |
98 // This debug option shows window groups in a grid |
96 //#define ALF_DEBUG_VISUALIZE_WINDOWGROUP_ORDER |
99 //#define ALF_DEBUG_VISUALIZE_WINDOWGROUP_ORDER |
97 |
100 |
98 |
101 |
99 const TInt KFadeAction = 6000; |
102 const TInt KFadeAction = 6000; |
100 |
103 |
101 // ======== MEMBER FUNCTIONS ======== |
104 NONSHARABLE_CLASS( TAlfBridgeDrawerWrapper ) : public MAlfDrawerScreenInterface |
|
105 { |
|
106 public: |
|
107 TAlfBridgeDrawerWrapper(CAlfBridge& aBridge); |
|
108 TInt GetSizeAndRotation(TSize& aSize, TInt& aRotation); |
|
109 TInt ReadPixels(CFbsBitmap* aBitmap); |
|
110 private: |
|
111 CAlfBridge& iBridge; |
|
112 }; |
102 |
113 |
103 // ======== MEMBER FUNCTIONS ======== |
114 // ======== MEMBER FUNCTIONS ======== |
104 |
115 |
105 // --------------------------------------------------------------------------- |
116 // --------------------------------------------------------------------------- |
106 // --------------------------------------------------------------------------- |
117 // --------------------------------------------------------------------------- |
348 { |
364 { |
349 __ALFFXLOGSTRING1("CAlfBridge::RemoveVisual 0x%x", aWindowNodeId); |
365 __ALFFXLOGSTRING1("CAlfBridge::RemoveVisual 0x%x", aWindowNodeId); |
350 iWindowHashArray.Remove( aWindowNodeId ); |
366 iWindowHashArray.Remove( aWindowNodeId ); |
351 iPreviouslySearchedVisualId = 0; |
367 iPreviouslySearchedVisualId = 0; |
352 |
368 |
353 AMT_DEC_COUNTER( iTotalVisualCount ); |
369 AMT_DEC_COUNTER( iTotalVisualCount ); |
|
370 |
|
371 AMT_MAP_INC_VALUE( iIntMap, aWindowNodeId, EAlfModuleTestTypeBridgeReleaseWindow ); |
|
372 AMT_MAP_SET_VALUE( iBoolMap, aWindowNodeId, ETrue, EAlfModuleTestTypeBridgeReleaseWindow ); |
354 } |
373 } |
355 |
374 |
356 // --------------------------------------------------------------------------- |
375 // --------------------------------------------------------------------------- |
357 // FindVisual |
376 // FindVisual |
358 // --------------------------------------------------------------------------- |
377 // --------------------------------------------------------------------------- |
1295 } |
1335 } |
1296 |
1336 |
1297 TBool fullscreenCovered = EFalse; |
1337 TBool fullscreenCovered = EFalse; |
1298 CAlfAppSrvSessionBase* topMostAlfSrvSession = NULL; |
1338 CAlfAppSrvSessionBase* topMostAlfSrvSession = NULL; |
1299 |
1339 |
1300 //iActiveVisualCount = 0; |
|
1301 iBgSurfaceFound = EFalse; |
1340 iBgSurfaceFound = EFalse; |
1302 //iPaintedArea = 0; |
1341 iHomeScreenWallpaperWindowFound = EFalse; |
1303 |
1342 |
1304 // Check if effect group has an effect with opaque hint. |
1343 // Check if effect group has an effect with opaque hint. |
1305 CHuiControlGroup& fxcontrolgroup = *(iAlfScreens[aScreenNumber]->iFullscreenEffectControlGroup); |
1344 CHuiControlGroup& fxcontrolgroup = *(iAlfScreens[aScreenNumber]->iFullscreenEffectControlGroup); |
1306 CHuiControl& fxcontrol = fxcontrolgroup.Control(0); |
1345 CHuiControl& fxcontrol = fxcontrolgroup.Control(0); |
1307 CHuiCanvasVisual* fxlayout = (CHuiCanvasVisual*)&fxcontrol.Visual(0); |
1346 CHuiCanvasVisual* fxlayout = (CHuiCanvasVisual*)&fxcontrol.Visual(0); |
1308 CHuiVisual* fxExternalContent = fxlayout->ExternalContent(); |
1347 CHuiVisual* fxExternalContent = fxlayout->ExternalContent(); |
1486 __ALFLOGSTRING1(">>>> HandleVisualVisibility: Active visuals : %d", activevisualcount ); |
1525 __ALFLOGSTRING1(">>>> HandleVisualVisibility: Active visuals : %d", activevisualcount ); |
1487 __ALFLOGSTRING1(">>>> HandleVisualVisibility: Passive visuals: %d", passivevisualcount ); |
1526 __ALFLOGSTRING1(">>>> HandleVisualVisibility: Passive visuals: %d", passivevisualcount ); |
1488 #endif |
1527 #endif |
1489 |
1528 |
1490 } |
1529 } |
1491 if (iActivated) |
1530 |
1492 { |
1531 if (iActivated && !iLayoutSwitchInProgress) |
1493 if (iBgSurfaceFound) |
1532 { |
1494 { |
1533 if (iBgSurfaceFound || iHomeScreenWallpaperWindowFound) |
1495 if (!iInLowMemMode) |
1534 { |
|
1535 // only bg surface should trigger lowmem |
|
1536 if (!iInLowMemMode && iBgSurfaceFound) |
1496 { |
1537 { |
1497 SetLowMemory(ETrue); |
1538 SetLowMemory(ETrue); |
|
1539 iInLowMemMode = ETrue; |
|
1540 } |
|
1541 else if (!iBgSurfaceFound && iInLowMemMode) |
|
1542 { |
|
1543 SetLowMemory(EFalse); |
|
1544 iInLowMemMode = EFalse; |
|
1545 } |
|
1546 |
|
1547 // if the background animation is not hidden yet, hide it now |
|
1548 if (!iBgAnimHidden) |
|
1549 { |
1498 // Notify Bg anim |
1550 // Notify Bg anim |
1499 iBridgerClient.SendBlind(EAlfQueueRequestBGSessions, TIpcArgs(KAlfCompositionTargetHidden)); |
1551 iBridgerClient.SendBlind(EAlfQueueRequestBGSessions, TIpcArgs(KAlfCompositionTargetHidden)); |
1500 iInLowMemMode = ETrue; |
1552 iBgAnimHidden = ETrue; |
1501 } |
1553 } |
1502 } |
1554 } |
1503 else if (iInLowMemMode) |
1555 else if (iInLowMemMode || iBgAnimHidden) |
1504 { |
1556 { |
1505 SetLowMemory(EFalse); |
1557 // if we did not found bg surface, but are in low memory mode |
1506 // Notify Bg anim |
1558 // exit it now... |
1507 iBridgerClient.SendBlind(EAlfQueueRequestBGSessions, TIpcArgs(KAlfCompositionTargetVisible)); |
1559 if (!iBgSurfaceFound && iInLowMemMode) |
1508 iInLowMemMode = EFalse; |
1560 { |
|
1561 SetLowMemory(EFalse); |
|
1562 iInLowMemMode = EFalse; |
|
1563 } |
|
1564 |
|
1565 // if the bg animation is hidden and we did not found a background surface |
|
1566 // or the homescreen window containing wallpaper, show the background animation |
|
1567 // again |
|
1568 if (iBgAnimHidden && !iBgSurfaceFound && !iHomeScreenWallpaperWindowFound) |
|
1569 { |
|
1570 // Notify Bg anim |
|
1571 iBridgerClient.SendBlind(EAlfQueueRequestBGSessions, TIpcArgs(KAlfCompositionTargetVisible)); |
|
1572 iBgAnimHidden = EFalse; |
|
1573 } |
1509 } |
1574 } |
1510 } |
1575 } |
1511 |
1576 |
1512 if ( iSwRenderingEnabled ) |
1577 if ( iSwRenderingEnabled ) |
1513 { |
1578 { |
1517 // Finally, if there are fadeeffects applied to windowgroups, make sure first one does not |
1582 // Finally, if there are fadeeffects applied to windowgroups, make sure first one does not |
1518 // blend itself, but other windowgroups do blend. Otherwise windowgrouops above others |
1583 // blend itself, but other windowgroups do blend. Otherwise windowgrouops above others |
1519 // would clear the screen areas where they do not really draw. |
1584 // would clear the screen areas where they do not really draw. |
1520 if (fadeEffectInScreen) |
1585 if (fadeEffectInScreen) |
1521 { |
1586 { |
1522 TBool alwaysblend = EFalse; |
1587 TBool firstFadedWindowGroupFound = EFalse; |
1523 for (TInt j=0; j<screen->iDisplay->Roster().Count() - screen->FixedControlGroupCount(); j++) // skip the topmost (effect) layer |
1588 for (TInt j=0; j<screen->iDisplay->Roster().Count() - screen->FixedControlGroupCount(); j++) // skip the topmost (effect) layer |
1524 { |
1589 { |
1525 CHuiControlGroup& controlgroup = iAlfScreens[aScreenNumber]->iDisplay->Roster().ControlGroup(j); |
1590 CHuiControlGroup& controlgroup = iAlfScreens[aScreenNumber]->iDisplay->Roster().ControlGroup(j); |
1526 CHuiControl& control = controlgroup.Control(0); |
1591 CHuiControl& control = controlgroup.Control(0); |
1527 CHuiVisual* layout = &control.Visual(0); |
1592 CHuiVisual* layout = &control.Visual(0); |
1528 if (layout->Effect() && (layout->Effect()->EffectFlags() & KHuiFadeEffectFlag)) |
1593 if (layout->Effect() && (layout->Effect()->EffectFlags() & KHuiFadeEffectFlag)) |
1529 { |
1594 { |
1530 if (alwaysblend) |
1595 if (firstFadedWindowGroupFound) |
1531 { |
1596 { |
1532 TInt flags = layout->Effect()->EffectFlags(); |
1597 TInt flags = layout->Effect()->EffectFlags(); |
1533 flags |= KHuiFxAlwaysBlend; // Workaround for opaque layout canvasvisual. |
1598 flags |= KHuiFxAlwaysBlend; // Workaround for opaque layout canvasvisual. |
1534 layout->Effect()->SetEffectFlags(flags); |
1599 layout->Effect()->SetEffectFlags(flags); |
1535 } |
1600 } |
1617 { |
1682 { |
1618 // Check where visual is |
1683 // Check where visual is |
1619 visualDisplayRect = canvasVisual->DisplayRect(); |
1684 visualDisplayRect = canvasVisual->DisplayRect(); |
1620 |
1685 |
1621 // Make sure we clip visual rect to visible screen area |
1686 // Make sure we clip visual rect to visible screen area |
|
1687 ClipVisualRect(visualDisplayRect, aLayout->DisplayRect()); |
1622 ClipVisualRect(visualDisplayRect, aFullscreen); |
1688 ClipVisualRect(visualDisplayRect, aFullscreen); |
1623 |
1689 |
1624 // Check if this visual is covered by other opaque visuals which rects are in "covered" region |
1690 // Check if this visual is covered by other opaque visuals which rects are in "covered" region |
1625 visualRectIsCovered = IsRectCoveredByRegion(visualDisplayRect, iTempRegion); |
1691 visualRectIsCovered = IsRectCoveredByRegion(visualDisplayRect, iTempRegion); |
1626 } |
1692 } |
1692 EHuiVisualFlagInactive | EHuiVisualFlagShouldBeInactive | |
1758 EHuiVisualFlagInactive | EHuiVisualFlagShouldBeInactive | |
1693 EHuiVisualFlagUnderOpaqueHint | EHuiVisualFlagShouldBeUnderOpaqueHint ); |
1759 EHuiVisualFlagUnderOpaqueHint | EHuiVisualFlagShouldBeUnderOpaqueHint ); |
1694 canvasVisual->PrepareCache(); |
1760 canvasVisual->PrepareCache(); |
1695 canvasVisual->SetCapturingBufferL(aScreen->iSwRenderingTarget); |
1761 canvasVisual->SetCapturingBufferL(aScreen->iSwRenderingTarget); |
1696 |
1762 |
|
1763 // We found an _ACTIVE_ window in homescreens controlgroup |
|
1764 if (aControlGroup.SecureId() == 0x102750F0) |
|
1765 { |
|
1766 // which is fully opaque, and visible ... |
|
1767 if ( (canvasVisual->iOpacity.Now() > 0.001) && canvasVisual->Flags() & EHuiVisualFlagOpaqueHint) |
|
1768 { |
|
1769 // ... and it's a fullscreen one, and does not have a transparent clear in it |
|
1770 if (canvasVisual->DisplayRect().Round() == Display(0)->VisibleArea() && |
|
1771 !canvasVisual->HasTransParentClear()) |
|
1772 { |
|
1773 // we can "safely" asseme that the window is the |
|
1774 // one used to draw the user defined wallpaper |
|
1775 // ----> stop background animation as it's not visible |
|
1776 iHomeScreenWallpaperWindowFound = ETrue; |
|
1777 } |
|
1778 } |
|
1779 } |
|
1780 |
1697 // we've found non-inactive window which has background surface |
1781 // we've found non-inactive window which has background surface |
1698 // attached.. |
1782 // attached.. |
1699 if (canvasVisual->IsBackgroundDrawingEnabled() && |
1783 if (canvasVisual->IsBackgroundDrawingEnabled() && |
1700 canvasVisual->LayerExtent() != TRect() && |
1784 canvasVisual->LayerExtent() != TRect() && |
1701 !canvasVisual->LayerUsesAlphaFlag() ) |
1785 !canvasVisual->LayerUsesAlphaFlag() ) |
1702 { |
1786 { |
1703 // if paintedareacount is exactly one, it means that the window |
1787 // if paintedareacount is exactly one or two, it means that the window |
1704 // has background surface but no drawing commands |
1788 // has background surface but no drawing commands |
1705 if (canvasVisual->PaintedAreaCount() == 1) |
1789 TInt areaCount = canvasVisual->PaintedAreaCount(); |
|
1790 if (areaCount == 1 || areaCount == 2) |
1706 { |
1791 { |
1707 THuiCanvasPaintedArea pa = canvasVisual->PaintedArea(0); |
1792 TBool onlyFullScreenAreas = ETrue; |
1708 TRect r = pa.iPaintedRect.Round(); |
1793 for (TInt count = 0; count < areaCount; count++) |
|
1794 { |
|
1795 TRect area = canvasVisual->PaintedArea(count).iPaintedRect.Round(); |
|
1796 if (area != Display(0)->VisibleArea()) |
|
1797 { |
|
1798 onlyFullScreenAreas = EFalse; |
|
1799 } |
|
1800 } |
1709 // if we found a fullscreen surface with no other drawing commands |
1801 // if we found a fullscreen surface with no other drawing commands |
1710 // we can safely assume that it's about the only thing to be visible |
1802 // we can safely assume that it's about the only thing to be visible |
1711 // and we can release memory occupied by other parts of the system |
1803 // and we can release memory occupied by other parts of the system |
1712 // |
1804 // |
1713 // NOTE: this mechanism keeps the system in low mem state |
1805 // NOTE: this mechanism keeps the system in low mem state |
1714 // if the surface is visible, meaning that for example |
1806 // if the surface is visible, meaning that for example |
1715 // opening an options menu does not instantly trigger normal |
1807 // opening an options menu does not instantly trigger normal |
1716 // memory state. We want to do it like this as otherwise |
1808 // memory state. We want to do it like this as otherwise |
1717 // we would be triggering for example background animation |
1809 // we would be triggering for example background animation |
1718 // on / off quite rapidly........ |
1810 // on / off quite rapidly........ |
1719 if ( r == Display(0)->VisibleArea()) |
1811 if ( onlyFullScreenAreas ) |
1720 { |
1812 { |
1721 // Final test. Surface must not be ALF surface, but some other surface. |
1813 // Final test. Surface must not be ALF surface, but some other surface. |
1722 CHuiControlGroup* alfControlGroup = FindControlGroupBySecureId( iAlfSecureId ); |
1814 CHuiControlGroup* alfControlGroup = FindControlGroupBySecureId( iAlfSecureId ); |
1723 if (alfControlGroup != &aControlGroup) |
1815 if (alfControlGroup != &aControlGroup) |
1724 { |
1816 { |
1765 if ( canvasVisual->CanvasFlags() & EHuiCanvasFlagIncludeToVisibilityCalculation ) |
1857 if ( canvasVisual->CanvasFlags() & EHuiCanvasFlagIncludeToVisibilityCalculation ) |
1766 { |
1858 { |
1767 if ( !canvasVisual->HasCustomShape() ) |
1859 if ( !canvasVisual->HasCustomShape() ) |
1768 { |
1860 { |
1769 TRect displayRect(canvasVisual->DisplayRect()); |
1861 TRect displayRect(canvasVisual->DisplayRect()); |
|
1862 ClipVisualRect(displayRect, aLayout->DisplayRect()); |
1770 ClipVisualRect(displayRect, aFullscreen); |
1863 ClipVisualRect(displayRect, aFullscreen); |
1771 |
1864 |
1772 #ifdef ALF_DEBUG_PRINT_WINDOWGROUP_ORDER |
1865 #ifdef ALF_DEBUG_PRINT_WINDOWGROUP_ORDER |
1773 __ALFLOGSTRING2("Covered rect: iTl: %i, %i", displayRect.iTl.iX, displayRect.iTl.iY); |
1866 __ALFLOGSTRING2("Covered rect: iTl: %i, %i", displayRect.iTl.iX, displayRect.iTl.iY); |
1774 __ALFLOGSTRING2("Covered rect: iBr: %i, %i", displayRect.iBr.iX, displayRect.iBr.iY); |
1867 __ALFLOGSTRING2("Covered rect: iBr: %i, %i", displayRect.iBr.iX, displayRect.iBr.iY); |
1829 #endif |
1922 #endif |
1830 } |
1923 } |
1831 visualTreeActive |= visualIsActive; |
1924 visualTreeActive |= visualIsActive; |
1832 |
1925 |
1833 // iVisibleVisualCount is cleared in HandleVisualVisibility() |
1926 // iVisibleVisualCount is cleared in HandleVisualVisibility() |
1834 AMT_INC_COUNTER_IF( visualIsActive && !visualRectIsCovered , iVisibleVisualCount ); |
1927 AMT_INC_COUNTER_IF( visualIsActive && visualIsOpaque && !visualRectIsCovered, iVisibleVisualCount ); |
|
1928 |
|
1929 AMT_MAP_SET_VALUE_IF( |
|
1930 visualIsActive && visualIsOpaque && !visualRectIsCovered && (canvasVisual->CanvasFlags() & EHuiCanvasFlagIncludeToVisibilityCalculation), |
|
1931 iBoolMap, |
|
1932 AMT_MAP_CPTR_TO_KEY_CAST( canvasVisual ), |
|
1933 ETrue, |
|
1934 EAlfModuleTestTypeBridgeVisualVisibility); |
|
1935 AMT_MAP_SET_VALUE_IF( |
|
1936 !visualIsActive || !visualIsOpaque || visualRectIsCovered || !(canvasVisual->CanvasFlags() & EHuiCanvasFlagIncludeToVisibilityCalculation), |
|
1937 iBoolMap, |
|
1938 AMT_MAP_CPTR_TO_KEY_CAST( canvasVisual ), |
|
1939 EFalse, |
|
1940 EAlfModuleTestTypeBridgeVisualVisibility); |
1835 } // for loop end : children checking loop |
1941 } // for loop end : children checking loop |
1836 |
1942 |
1837 return visualTreeActive; |
1943 return visualTreeActive; |
1838 } |
1944 } |
1839 |
1945 |
2122 // TODO, break link |
2228 // TODO, break link |
2123 break; |
2229 break; |
2124 } |
2230 } |
2125 case EAlfDSMoveWindowToNewGroup: |
2231 case EAlfDSMoveWindowToNewGroup: |
2126 { |
2232 { |
2127 /* |
2233 HandleMoveWindowToNewGroupL( data ); |
2128 RDebug::Print(_L("CAlfBridge::DoDispatchL, EAlfDSMoveWindowToNewGroup, THIS METHOD IS UNTESTED. EXPECT TROUBLE!")); |
2234 break; |
2129 // TODO: TEST! |
|
2130 TInt windowGroupNodeId = data.iInt1; |
|
2131 TInt windowNodeId = data.iInt2; |
|
2132 TInt newGroupId = (TInt)data.iPtr; |
|
2133 CHuiLayout* layout = NULL; |
|
2134 CHuiCanvasVisual* viz = (CHuiCanvasVisual*)FindVisual(windowNodeId, windowGroupNodeId,screenNumber); |
|
2135 if (viz) |
|
2136 { |
|
2137 // #1 remove visual from old group |
|
2138 layout = viz->Layout(); |
|
2139 layout->Remove(viz); |
|
2140 viz->Owner().Remove(viz); |
|
2141 // #2 insert visual to the beginning of the new group |
|
2142 CHuiControlGroup* controlGroup = FindControlGroup(newGroupId,screenNumber); |
|
2143 if (controlGroup) |
|
2144 { |
|
2145 CHuiControl& control = controlGroup->Control(0); |
|
2146 CHuiLayout* layout = (CHuiLayout*)&control.Visual(0); |
|
2147 layout->AppendL( viz ); |
|
2148 } |
|
2149 }*/ |
|
2150 break; |
|
2151 } |
2235 } |
2152 case EAlfEffectFx: |
2236 case EAlfEffectFx: |
2153 { |
2237 { |
2154 HandleGfxEffectsL( data ); |
2238 HandleGfxEffectsL( data ); |
2155 break; |
2239 break; |
2615 __ALFLOGSTRING("CAlfBridge::HandleSetWindowPosL, EAlfDSSetWindowPos: Visual not found!"); |
2700 __ALFLOGSTRING("CAlfBridge::HandleSetWindowPosL, EAlfDSSetWindowPos: Visual not found!"); |
2616 } |
2701 } |
2617 |
2702 |
2618 AMT_INC_COUNTER_IF( viz, iVisualPositionChangedCount ); |
2703 AMT_INC_COUNTER_IF( viz, iVisualPositionChangedCount ); |
2619 AMT_SET_VALUE_IF( viz, iLatestVisualExtentRect, TRect( windowAttributes->iPosition, windowAttributes->iSize ) ); |
2704 AMT_SET_VALUE_IF( viz, iLatestVisualExtentRect, TRect( windowAttributes->iPosition, windowAttributes->iSize ) ); |
2620 AMT_MAP_SET_VALUE_IF( ( viz && iWindowHashArray.Find( windowNodeId ) ), |
2705 AMT_MAP_SET_VALUE_IF( viz, iPositionMap, windowNodeId, |
2621 iPositionMap, iWindowHashArray.Find( windowNodeId )->iClientSideId, |
2706 windowAttributes->iPosition, |
2622 windowAttributes->iPosition, EAlfModuleTestTypeBridgeChangePosition ); |
2707 EAlfModuleTestTypeBridgeChangeWindowPosition ); |
2623 } |
2708 } |
2624 |
2709 |
2625 // --------------------------------------------------------------------------- |
2710 // --------------------------------------------------------------------------- |
2626 // HandleSetWindowSizeL |
2711 // HandleSetWindowSizeL |
2627 // --------------------------------------------------------------------------- |
2712 // --------------------------------------------------------------------------- |
2649 } |
2734 } |
2650 iAlfScreens[screenNumber]->SetVisualTreeVisibilityChanged(ETrue); |
2735 iAlfScreens[screenNumber]->SetVisualTreeVisibilityChanged(ETrue); |
2651 |
2736 |
2652 AMT_INC_COUNTER_IF(viz, iVisualSizeChangedCount ); |
2737 AMT_INC_COUNTER_IF(viz, iVisualSizeChangedCount ); |
2653 AMT_SET_VALUE_IF(viz, iLatestVisualExtentRect, TRect( windowAttributes->iPosition, windowAttributes->iSize ) ); |
2738 AMT_SET_VALUE_IF(viz, iLatestVisualExtentRect, TRect( windowAttributes->iPosition, windowAttributes->iSize ) ); |
2654 AMT_MAP_SET_VALUE_IF( ( viz && iWindowHashArray.Find( windowNodeId ) ), |
2739 |
2655 iSizeMap, iWindowHashArray.Find( windowNodeId )->iClientSideId, |
2740 AMT_MAP_SET_VALUE_IF( viz, iSizeMap, windowNodeId, |
2656 windowAttributes->iSize, EAlfModuleTestTypeBridgeChangeSize ); |
2741 windowAttributes->iSize, |
|
2742 EAlfModuleTestTypeBridgeChangeWindowSize ); |
2657 } |
2743 } |
2658 |
2744 |
2659 // --------------------------------------------------------------------------- |
2745 // --------------------------------------------------------------------------- |
2660 // HandleSetWindowRotationL |
2746 // HandleSetWindowRotationL |
2661 // --------------------------------------------------------------------------- |
2747 // --------------------------------------------------------------------------- |
3079 |
3164 |
3080 // 1. if we get drawing commands after BeginFullScreen, we need to generate EndFullScreen call. |
3165 // 1. if we get drawing commands after BeginFullScreen, we need to generate EndFullScreen call. |
3081 // 2. only the first drawing commands will trigger EndFullScreen |
3166 // 2. only the first drawing commands will trigger EndFullScreen |
3082 // (this mechanism is here because we want to remove delay from fullscreen effects - and EndFullScreens are coming from application too late) |
3167 // (this mechanism is here because we want to remove delay from fullscreen effects - and EndFullScreens are coming from application too late) |
3083 |
3168 |
3084 if (viz->Owner().ControlGroup() == to_group) |
3169 if (viz && viz->Owner().ControlGroup() == to_group) |
3085 { |
3170 { |
3086 if (!iFullScreenEffectData->iDrawingCompleteTimer) |
3171 GfxTriggerEffectWhenFullScreenDrawn(to_group); |
3087 { |
3172 } |
3088 iFullScreenEffectData->InitDelayedEffectL(this, iAlfScreens[0]->Size()); |
|
3089 } |
|
3090 THuiCanvasPaintedArea p = viz->PaintedArea(0); |
|
3091 iFullScreenEffectData->iPaintedRegion.AddRect( p.iPaintedRect.Round() ); |
|
3092 TRect b = iFullScreenEffectData->iPaintedRegion.BoundingRect(); |
|
3093 __ALFFXLOGSTRING3( |
|
3094 "CAlfBridge::HandlePostCanvasBufferL : Effect to visual 0x%x, Covered rect: iTl.iX: %d , iTl.iY: %d", |
|
3095 viz, |
|
3096 b.iTl.iX, |
|
3097 b.iTl.iY); |
|
3098 __ALFFXLOGSTRING2("CAlfBridge::HandlePostCanvasBufferL : iBr.iX: %d, iBr.iY: %d", b.iBr.iX, b.iBr.iY); |
|
3099 } |
|
3100 } |
3173 } |
3101 #endif |
3174 #endif |
3102 } |
3175 } |
3103 |
3176 |
3104 // --------------------------------------------------------------------------- |
3177 // --------------------------------------------------------------------------- |
3105 // HandleGfxEndFullScreenTimeout |
3178 // HandleGfxEndFullScreenTimeout |
3106 // --------------------------------------------------------------------------- |
3179 // --------------------------------------------------------------------------- |
3107 // |
3180 // |
3108 void CAlfBridge::HandleGfxEndFullScreenTimeout(CFullScreenEffectState* aFullScreenEffectData) |
3181 void CAlfBridge::GfxTriggerEndFullScreen(CFullScreenEffectState* aFullScreenEffectData) |
3109 { |
3182 { |
3110 if (aFullScreenEffectData->iEndFullScreen) |
3183 if (aFullScreenEffectData->iEndFullScreen) |
3111 { |
3184 { |
3112 return; |
3185 return; |
3113 } |
3186 } |
3277 iAlfScreens[screenNumber]->SetVisualTreeVisibilityChanged(ETrue); // TODO: Check if really changed |
3351 iAlfScreens[screenNumber]->SetVisualTreeVisibilityChanged(ETrue); // TODO: Check if really changed |
3278 |
3352 |
3279 AMT_INC_COUNTER( iTotalVisualFlagChangedCount ); |
3353 AMT_INC_COUNTER( iTotalVisualFlagChangedCount ); |
3280 AMT_INC_COUNTER_IF( windowAttributes->iActive, iActiveVisualCount ); |
3354 AMT_INC_COUNTER_IF( windowAttributes->iActive, iActiveVisualCount ); |
3281 AMT_INC_COUNTER_IF( !windowAttributes->iActive, iPassiveVisualCount ); |
3355 AMT_INC_COUNTER_IF( !windowAttributes->iActive, iPassiveVisualCount ); |
3282 AMT_MAP_INC_VALUE_IF( ( iWindowHashArray.Find( windowNodeId ) ), |
3356 |
3283 iIntMap, iWindowHashArray.Find( windowNodeId )->iClientSideId, |
3357 AMT_MAP_SET_VALUE( iBoolMap, windowNodeId, windowAttributes->iActive, |
3284 EAlfModuleTestTypeBridgeChangeFlag ); |
3358 EAlfModuleTestTypeBridgeChangeWindowVisibility ); |
|
3359 AMT_MAP_SET_VALUE( iBoolMap, windowNodeId, windowAttributes->iActive, |
|
3360 EAlfModuleTestTypeBridgeActiveWindow ); |
3285 } |
3361 } |
3286 |
3362 |
3287 |
3363 |
3288 // --------------------------------------------------------------------------- |
3364 // --------------------------------------------------------------------------- |
3289 // HandleSetWindowFlagL |
3365 // HandleSetWindowFlagL |
3938 return (didFadeEffectLoad || alreadyFaded); |
4014 return (didFadeEffectLoad || alreadyFaded); |
3939 } |
4015 } |
3940 |
4016 |
3941 |
4017 |
3942 // --------------------------------------------------------------------------- |
4018 // --------------------------------------------------------------------------- |
|
4019 // HandleMoveWindowToNewGroupL |
|
4020 // --------------------------------------------------------------------------- |
|
4021 // |
|
4022 void CAlfBridge::HandleMoveWindowToNewGroupL( TAlfBridgerData& aData ) |
|
4023 { |
|
4024 TInt windowNodeId = aData.iInt1; |
|
4025 TInt screenNumber = aData.iInt2; |
|
4026 TInt newWindowGroupNodeId = (TInt)aData.iPtr; |
|
4027 |
|
4028 CHuiCanvasVisual* viz = (CHuiCanvasVisual*)FindVisual(windowNodeId); |
|
4029 |
|
4030 #ifdef _ALF_LOGGING |
|
4031 CHuiControlGroup* oldControlGroup = viz->Owner().ControlGroup(); |
|
4032 TInt oldWindowGroupId = 0; |
|
4033 if ( oldControlGroup ) |
|
4034 { |
|
4035 oldWindowGroupId = FindWindowGroupNodeId(screenNumber, *oldControlGroup ); |
|
4036 } |
|
4037 __ALFLOGSTRING3("CAlfBridge::HandleMoveWindowToNewGroupL moving nodeId 0x%x from group 0x%x to 0x%x ",windowNodeId, oldWindowGroupId, newWindowGroupNodeId ); |
|
4038 #endif |
|
4039 |
|
4040 if (viz) |
|
4041 { |
|
4042 CHuiLayout* oldLayout = viz->Layout(); |
|
4043 TBool isRootOfTheMovingTree = EFalse; // if true, we need to update the parent layout |
|
4044 |
|
4045 if ( viz->Owner().ControlGroup() && |
|
4046 (&viz->Owner().ControlGroup()->Control(0).Visual(0) == oldLayout) ) |
|
4047 { |
|
4048 // Symbian OS documentation: "This function allows a window with a window group as its |
|
4049 // immediate parent to be moved from one window group to another one." |
|
4050 // |
|
4051 // This implementation is assuming that only a window which is an immediate child of a window group |
|
4052 // can be moved to new group. Moving an immediate child (=root of the moving tree) |
|
4053 // causes the child windows to move as well. |
|
4054 isRootOfTheMovingTree = ETrue; |
|
4055 } |
|
4056 |
|
4057 // #1 remove visual from old group |
|
4058 if ( isRootOfTheMovingTree && oldLayout ) |
|
4059 { |
|
4060 // remove also from the old parent layout - new layout is coming from the new group |
|
4061 oldLayout->Remove(viz); |
|
4062 } |
|
4063 // else: keep the parent layout - assume that is moving as well. |
|
4064 |
|
4065 // remove from the old control |
|
4066 viz->Owner().Remove(viz); |
|
4067 |
|
4068 // #2 insert visual to the beginning of the new group |
|
4069 CHuiControlGroup* newControlGroup = FindControlGroup(newWindowGroupNodeId,screenNumber); |
|
4070 if (newControlGroup) |
|
4071 { |
|
4072 CHuiControl& newControl = newControlGroup->Control(0); |
|
4073 if ( isRootOfTheMovingTree ) |
|
4074 { |
|
4075 // update the parent layout to be the default layout of the window group |
|
4076 CHuiLayout* newLayout = (CHuiLayout*)&newControl.Visual(0); |
|
4077 newControl.AppendL( viz, newLayout ); |
|
4078 } |
|
4079 else |
|
4080 { |
|
4081 // just update the owner. Assume that the parent RWindowTreeNode/CAlfNode/CHuiLayout is moving as well. |
|
4082 newControl.AppendL( viz ); |
|
4083 } |
|
4084 } |
|
4085 else |
|
4086 { |
|
4087 __ALFLOGSTRING("CAlfBridge::HandleMoveWindowToNewGroupL cannot find new group! orphaning the visual"); |
|
4088 iOrphanStorage->AppendL( viz ); |
|
4089 } |
|
4090 } |
|
4091 else |
|
4092 { |
|
4093 __ALFLOGSTRING("CAlfBridge::HandleMoveWindowToNewGroupL cannot find moving visual!"); |
|
4094 } |
|
4095 } |
|
4096 |
|
4097 // --------------------------------------------------------------------------- |
3943 // HandleSetFadeEffect |
4098 // HandleSetFadeEffect |
3944 // --------------------------------------------------------------------------- |
4099 // --------------------------------------------------------------------------- |
3945 // |
4100 // |
3946 void CAlfBridge::HandleSetFadeEffectL( TAlfBridgerData& aData ) |
4101 void CAlfBridge::HandleSetFadeEffectL( TAlfBridgerData& aData ) |
3947 { |
4102 { |
4104 } |
4261 } |
4105 TBool NeedsStoredBuffers(CHuiFxEngine *aEngine, const TDesC &aFileName) |
4262 TBool NeedsStoredBuffers(CHuiFxEngine *aEngine, const TDesC &aFileName) |
4106 { |
4263 { |
4107 return aEngine->FxmlUsesInput1(aFileName); |
4264 return aEngine->FxmlUsesInput1(aFileName); |
4108 } |
4265 } |
4109 |
4266 |
|
4267 // --------------------------------------------------------------------------- |
|
4268 // StoreLayoutIfRequiredByEffectL |
|
4269 // |
|
4270 // Certains effects require screenshot to be taken when BeginFullScreen event |
|
4271 // is triggered. This method will take a screenshot (of the whole screen), if |
|
4272 // there is enough memory available. |
|
4273 // --------------------------------------------------------------------------- |
|
4274 // |
|
4275 TBool CAlfBridge::StoreLayoutIfRequiredByEffectL(CHuiLayout* aLayout, CFullScreenEffectState& aEvent, TBool& aNeededStoredLayout) |
|
4276 { |
|
4277 aNeededStoredLayout = NeedsStoredBuffers(iHuiEnv->EffectsEngine(), *aEvent.iEffectName); |
|
4278 __ALFFXLOGSTRING2("CAlfBridge::StoreLayoutIfRequiredByEffectL - aHandle: %d, Take screenhot: %d", aEvent.iHandle, aNeededStoredLayout); |
|
4279 if (aNeededStoredLayout) |
|
4280 { |
|
4281 TRAPD(err,StoreRenderBufferStartL(aLayout)); |
|
4282 __ALFFXLOGSTRING1("CAlfBridge::StoreLayoutIfRequiredByEffectL - Screenshot result: KErrNone == %d", err); |
|
4283 if (err == KErrNone) |
|
4284 { |
|
4285 aLayout->SetFreezeState(ETrue); |
|
4286 aEvent.iCanDestroyOrHideImmediately = ETrue; // if children of this layout are hidden or destroyed during effect, that can happen immediately |
|
4287 return ETrue; // storing of content requesteds, could store the content => success |
|
4288 } |
|
4289 else |
|
4290 { |
|
4291 return EFalse; // could not store the content => failed |
|
4292 } |
|
4293 } |
|
4294 else |
|
4295 { |
|
4296 __ALFFXLOGSTRING("CAlfBridge::StoreLayoutIfRequiredByEffectL - Storing not required"); |
|
4297 return ETrue; // no storing requred, no screenshot required => success |
|
4298 } |
|
4299 } |
|
4300 |
4110 TBool CAlfBridge::HandleGfxEventL(CFullScreenEffectState& aEvent, CHuiLayout* aToLayout, CHuiLayout *aFromLayout) |
4301 TBool CAlfBridge::HandleGfxEventL(CFullScreenEffectState& aEvent, CHuiLayout* aToLayout, CHuiLayout *aFromLayout) |
4111 { |
4302 { |
4112 __ALFFXLOGSTRING4("CAlfBridge::HandleGfxEventL - To layout: 0x%x, From layout: 0x%x, Effect handle: %d, Action: %d", aToLayout, aFromLayout, aEvent.iHandle, aEvent.iAction); |
4303 __ALFFXLOGSTRING4("CAlfBridge::HandleGfxEventL - To layout: 0x%x, From layout: 0x%x, Effect handle: %d, Action: %d", aToLayout, aFromLayout, aEvent.iHandle, aEvent.iAction); |
4113 TInt err = KErrNone; |
4304 TInt err = KErrNone; |
4114 TBool failed = EFalse; |
4305 TBool failed = EFalse; |
4129 switch(aEvent.iOperation) |
4320 switch(aEvent.iOperation) |
4130 { |
4321 { |
4131 case MAlfGfxEffectPlugin::EBeginFullscreen: |
4322 case MAlfGfxEffectPlugin::EBeginFullscreen: |
4132 { |
4323 { |
4133 aToLayout->SetStoredRenderBufferModificationsEnabled(ETrue); |
4324 aToLayout->SetStoredRenderBufferModificationsEnabled(ETrue); |
4134 TBool needStoredBuffers = NeedsStoredBuffers(engine, *aEvent.iEffectName); |
4325 TBool neededStoredBuffers; |
4135 __ALFFXLOGSTRING2("CAlfBridge::HandleGfxEventL - EBeginFullScreen: %d, Take screenhot: %d", aEvent.iHandle, needStoredBuffers); |
4326 TBool success = StoreLayoutIfRequiredByEffectL(aToLayout, aEvent, neededStoredBuffers); |
4136 if (needStoredBuffers) |
4327 |
|
4328 // if screenshot was requested and it was possible to take one, then add this layout |
|
4329 // to effectcleanup stack |
|
4330 if (neededStoredBuffers) |
4137 { |
4331 { |
4138 TRAP(err,StoreRenderBufferStartL(aToLayout)); |
4332 TInt dummy; |
4139 __ALFFXLOGSTRING1("CAlfBridge::HandleGfxEventL - EBeginFullScreen: Screenshot result: KErrNone == %d", err); |
4333 if (!HasActiveEffect(aToLayout, dummy)) |
4140 if (err == KErrNone) |
4334 { |
4141 { |
4335 __ALFFXLOGSTRING2("CAlfBridge::HandleGfxEventL - Add layout 0x%x with handle %d to cleanupstack", aToLayout, aEvent.iHandle); |
4142 aToLayout->SetFreezeState(ETrue); |
4336 AddEffectItemL(aEvent.iHandle, aToLayout, NULL, NULL, EFalse, dummy, EFalse); |
4143 aEvent.iCanDestroyOrHideImmediately = ETrue; // if children of this layout are hidden or destroyed during effect, that can happen immediately |
4337 } |
4144 } |
|
4145 else |
|
4146 { |
|
4147 return ETrue; // failed, effect will be canceled |
|
4148 } |
|
4149 } |
4338 } |
|
4339 // Screenshot was requested, but it could not be taken. Lets cancel the effect. |
|
4340 if (!success) |
|
4341 { |
|
4342 return ETrue; // this will cause effect cleanup |
|
4343 } |
|
4344 |
4150 |
4345 |
4151 switch(aEvent.iAction) |
4346 switch(aEvent.iAction) |
4152 { |
4347 { |
4153 case AknTransEffect::EApplicationActivate: |
4348 case AknTransEffect::EApplicationActivate: |
4154 case AknTransEffect::EApplicationStart: |
4349 case AknTransEffect::EApplicationStart: |
4157 case AknTransEffect::EApplicationStartSwitchRect: |
4352 case AknTransEffect::EApplicationStartSwitchRect: |
4158 { |
4353 { |
4159 aToLayout->iOpacity.Set(0.0f); // these are meant for applications that are not yet ready to be drawn, but possible already on the foreground |
4354 aToLayout->iOpacity.Set(0.0f); // these are meant for applications that are not yet ready to be drawn, but possible already on the foreground |
4160 FreezeLayoutUntilEffectDestroyedL(aFromLayout, aEvent.iHandle); |
4355 FreezeLayoutUntilEffectDestroyedL(aFromLayout, aEvent.iHandle); |
4161 aEvent.iEffectType = CFullScreenEffectState::EStartEffect; |
4356 aEvent.iEffectType = CFullScreenEffectState::EStartEffect; |
|
4357 aEvent.iCanDestroyOrHideImmediately = ETrue; // enable hiding of windows during application start/activate effects |
4162 break; |
4358 break; |
4163 } |
4359 } |
4164 case AknTransEffect::EApplicationExit: |
4360 case AknTransEffect::EApplicationExit: |
4165 { |
4361 { |
4166 aEvent.iEffectType = CFullScreenEffectState::EExitEffect; |
4362 aEvent.iEffectType = CFullScreenEffectState::EExitEffect; |
4177 // effect on a layout must be an application start effect. |
4373 // effect on a layout must be an application start effect. |
4178 // External content visual is not used for that. |
4374 // External content visual is not used for that. |
4179 __ALFFXLOGSTRING2("CAlfBridge::HandleGfxEventL - Found effect on layout 0x%x. Removing effect 0x%x", aToLayout, aToLayout->Effect()); |
4375 __ALFFXLOGSTRING2("CAlfBridge::HandleGfxEventL - Found effect on layout 0x%x. Removing effect 0x%x", aToLayout, aToLayout->Effect()); |
4180 aToLayout->SetEffect(NULL); |
4376 aToLayout->SetEffect(NULL); |
4181 } |
4377 } |
4182 if ( aEvent.iAction == AknTransEffect::EApplicationExit && !(aToLayout->Flags() & EHuiVisualFlagInactive)) |
4378 __ALFFXLOGSTRING2("CAlfBridge::HandleGfxEventL - Layout 0x%x is active: %d", aToLayout, !TBool(aToLayout->Flags() & EHuiVisualFlagInactive) ); |
|
4379 if (!(aToLayout->Flags() & EHuiVisualFlagInactive)) |
4183 { |
4380 { |
|
4381 TInt index; |
|
4382 if (aToLayout->StoredRenderBuffer() && HasActiveEffect(aToLayout, index) && index != KErrNotFound) |
|
4383 { |
|
4384 // a screenshot has been saved into the layout, and the layout was added to cleanupstack |
|
4385 // for cleaning. SetupEffectLayoutContainerL will add the same layout |
|
4386 // to the cleanupstack, but double cleaning is not a good idea. Thus it is removed here. |
|
4387 __ALFFXLOGSTRING1("CAlfBridge::HandleGfxEventL - Removing the layout 0x%x with screenshot from iEffectCleanupStack", aToLayout); |
|
4388 iEffectCleanupStack.Remove(index); |
|
4389 } |
4184 // this will tag the visual, that they cannot be hidden by HandleVisualVisibility |
4390 // this will tag the visual, that they cannot be hidden by HandleVisualVisibility |
4185 // Initialize layout for the exit effect |
4391 // Initialize layout for the exit effect |
4186 iLayoutInitializedForExitEffect = SetupEffectLayoutContainerL(aEvent.iHandle, aToLayout, ETrue, aEvent.iCanDestroyOrHideImmediately); |
4392 iLayoutInitializedForExitEffect = SetupEffectLayoutContainerL(aEvent.iHandle, aToLayout, ETrue, aEvent.iCanDestroyOrHideImmediately); |
4187 __ALFFXLOGSTRING1("CAlfBridge::HandleGfxEventL - EBeginFullscreen - iLayoutInitializedForExitEffect: %d", iLayoutInitializedForExitEffect); |
4393 __ALFFXLOGSTRING1("CAlfBridge::HandleGfxEventL - EBeginFullscreen - iLayoutInitializedForExitEffect: %d", iLayoutInitializedForExitEffect); |
4188 aEvent.iSetupDone = iLayoutInitializedForExitEffect; |
4394 aEvent.iSetupDone = iLayoutInitializedForExitEffect; |
4189 } |
4395 } |
4190 else |
4396 else |
4191 { |
4397 { |
4192 iLayoutInitializedForExitEffect = EFalse; |
4398 iLayoutInitializedForExitEffect = EFalse; |
4193 aEvent.iSetupDone = EFalse; |
4399 aEvent.iSetupDone = EFalse; |
|
4400 failed = ETrue; |
4194 } |
4401 } |
4195 return failed; |
4402 return failed; |
4196 } |
4403 } |
4197 default: |
4404 default: |
4198 break; |
4405 break; |
4215 __ALFFXLOGSTRING1("CAlfBridge::HandleGfxEventL - loading effect, handle %d", aEvent.iHandle ); |
4422 __ALFFXLOGSTRING1("CAlfBridge::HandleGfxEventL - loading effect, handle %d", aEvent.iHandle ); |
4216 if (aEvent.iAction == AknTransEffect::EApplicationExit) |
4423 if (aEvent.iAction == AknTransEffect::EApplicationExit) |
4217 { |
4424 { |
4218 // Exit effect was initialized earlier with EBeginFullscreen event |
4425 // Exit effect was initialized earlier with EBeginFullscreen event |
4219 layoutEffectable = aEvent.iSetupDone; |
4426 layoutEffectable = aEvent.iSetupDone; |
4220 __ALFFXLOGSTRING1("CAlfBridge::HandleGfxEventL - EEndFullScreen: %d", layoutEffectable); |
4427 __ALFFXLOGSTRING1("CAlfBridge::HandleGfxEventL - EEndFullScreen: iSetupDone: %d", layoutEffectable); |
4221 } |
4428 } |
4222 else |
4429 else |
4223 { |
4430 { |
4224 // add visuals to visual cleanupstack |
4431 // add visuals to visual cleanupstack |
4225 aToLayout->SetStoredRenderBufferModificationsEnabled(EFalse); |
4432 aToLayout->SetStoredRenderBufferModificationsEnabled(EFalse); |
|
4433 TInt index; |
|
4434 if (aToLayout->StoredRenderBuffer() && HasActiveEffect(aToLayout, index) && index != KErrNotFound) |
|
4435 { |
|
4436 // a screenshot has been saved into the layout, and the layout was added to cleanupstack |
|
4437 // for cleaning. SetupEffectLayoutContainerL will add the same layout |
|
4438 // to the cleanupstack, but double cleaning is not a good idea. Thus it is removed here. |
|
4439 __ALFFXLOGSTRING1("CAlfBridge::HandleGfxEventL - Removing the layout 0x%x with screenshot from iEffectCleanupStack", aToLayout); |
|
4440 iEffectCleanupStack.Remove(index); |
|
4441 } |
4226 layoutEffectable = SetupEffectLayoutContainerL(aEvent.iHandle,aToLayout, EFalse, aEvent.iCanDestroyOrHideImmediately); |
4442 layoutEffectable = SetupEffectLayoutContainerL(aEvent.iHandle,aToLayout, EFalse, aEvent.iCanDestroyOrHideImmediately); |
4227 aEvent.iSetupDone = layoutEffectable; |
4443 aEvent.iSetupDone = layoutEffectable; |
4228 aToLayout->SetStoredRenderBufferModificationsEnabled(ETrue); |
4444 aToLayout->SetStoredRenderBufferModificationsEnabled(ETrue); |
4229 } |
4445 } |
4230 |
4446 |
4231 if (layoutEffectable) |
4447 if (layoutEffectable) |
4232 { |
4448 { |
4233 TInt effectFlags = KHuiFxDelayRunUntilFirstFrameHasBeenDrawn; |
4449 TInt effectFlags = 0; |
|
4450 TInt activeEffectGroup = engine->ActiveGroupEffect(); |
|
4451 if (activeEffectGroup != KErrNotFound) |
|
4452 { |
|
4453 engine->AddEffectToGroup(activeEffectGroup); |
|
4454 } |
|
4455 __ALFFXLOGSTRING1("CAlfBridge::HandleGfxEventL - Active effect group: %d", activeEffectGroup); |
|
4456 effectFlags = KHuiFxDelayRunUntilFirstFrameHasBeenDrawn; |
4234 if (NeedsStoredBuffers(iHuiEnv->EffectsEngine(), *aEvent.iEffectName)) |
4457 if (NeedsStoredBuffers(iHuiEnv->EffectsEngine(), *aEvent.iEffectName)) |
4235 { |
4458 { |
4236 // Performance improvement, but this would be better to be a special hint param in the fxml |
4459 // Performance improvement, but this would be better to be a special hint param in the fxml |
4237 effectFlags |= KHuiFxOpaqueHint; |
4460 effectFlags |= KHuiFxOpaqueHint; |
4238 } |
4461 } |
4239 |
4462 |
4240 if (aEvent.iRect != TRect()) |
4463 if (aEvent.iRect != TRect()) |
4241 { |
4464 { |
4242 TRAP( err, engine->LoadGroupEffectL( *aEvent.iEffectName, effect, aToLayout->Effectable(), engine->ActiveGroupEffect(), &aEvent.iRect, this, aEvent.iHandle, effectFlags )); |
4465 TRAP( err, engine->LoadGroupEffectL( *aEvent.iEffectName, effect, aToLayout->Effectable(), activeEffectGroup, &aEvent.iRect, this, aEvent.iHandle, effectFlags )); |
4243 } |
4466 } |
4244 else |
4467 else |
4245 { |
4468 { |
4246 TRAP( err, engine->LoadGroupEffectL( *aEvent.iEffectName, effect, aToLayout->Effectable(), engine->ActiveGroupEffect(), NULL, this, aEvent.iHandle, effectFlags ) ); |
4469 TRAP( err, engine->LoadGroupEffectL( *aEvent.iEffectName, effect, aToLayout->Effectable(), activeEffectGroup, NULL, this, aEvent.iHandle, effectFlags ) ); |
4247 } |
4470 } |
4248 effect = NULL; |
4471 effect = NULL; |
4249 // only use the effect if the effect file was correctly parsed |
4472 // only use the effect if the effect file was correctly parsed |
4250 if (err != KErrNone) |
4473 if (err != KErrNone) |
4251 { |
4474 { |
4296 { |
4519 { |
4297 __ALFFXLOGSTRING("CAlfBridge::HandleGfxStopEvent BEGIN"); |
4520 __ALFFXLOGSTRING("CAlfBridge::HandleGfxStopEvent BEGIN"); |
4298 if (!iFullScreenEffectData) |
4521 if (!iFullScreenEffectData) |
4299 { |
4522 { |
4300 __ALFFXLOGSTRING("CAlfBridge::HandleGfxStopEvent - END: none"); |
4523 __ALFFXLOGSTRING("CAlfBridge::HandleGfxStopEvent - END: none"); |
|
4524 RemoveAllTemporaryPresenterVisuals(); |
|
4525 delete iControlEffectData; |
|
4526 iControlEffectData = NULL; |
4301 return; |
4527 return; |
4302 } |
4528 } |
4303 |
4529 |
4304 CFullScreenEffectState* fxData = iFullScreenEffectData; |
4530 CFullScreenEffectState* fxData = iFullScreenEffectData; |
4305 iFullScreenEffectData = NULL; |
4531 iFullScreenEffectData = NULL; |
4306 CleanupStack::PushL( fxData ); |
4532 CleanupStack::PushL( fxData ); |
4307 |
4533 |
4308 __ALFFXLOGSTRING2(" - handle: %d, toAppUid: 0x%x", fxData->iHandle, fxData->iToAppId); |
4534 __ALFFXLOGSTRING2("CAlfBridge::HandleGfxStopEvent - handle: %d, toAppUid: 0x%x", fxData->iHandle, fxData->iToAppId); |
4309 |
4535 |
4310 // clean effects with this handle |
4536 // clean effects with this handle |
4311 RemoveTemporaryPresenterVisual(NULL, fxData->iHandle); |
4537 RemoveTemporaryPresenterVisual(NULL, fxData->iHandle); |
4312 // this was abort, so we might have received earlier event hiding this window. Here we'll bring it |
4538 // this was abort, so we might have received earlier event hiding this window. Here we'll bring it |
4313 // back |
4539 // back |
4314 if (fxData->iToAppId && fxData->iToAppId != KErrNotFound) |
4540 if (fxData->iToAppId && fxData->iToAppId != KErrNotFound) |
4315 { |
4541 { |
4316 RemoveEffectFromApp(fxData->iToSecureId, fxData->iToWg ); |
4542 RemoveEffectFromApp(fxData->iToSecureId, fxData->iToWg ); |
4317 RemoveEffectFromApp(fxData->iFromSecureId, fxData->iFromWg ); |
4543 RemoveEffectFromApp(fxData->iFromSecureId, fxData->iFromWg ); |
4318 } |
4544 } |
4319 else |
4545 // abort ALL other possible control effects |
4320 { |
4546 RemoveAllTemporaryPresenterVisuals(); |
4321 // abort ALL effects |
4547 |
4322 RemoveAllTemporaryPresenterVisuals(); |
4548 delete iControlEffectData; |
4323 } |
4549 iControlEffectData = NULL; |
4324 |
4550 |
4325 iHuiEnv->ContinueRefresh(); |
4551 iHuiEnv->ContinueRefresh(); |
4326 |
4552 |
4327 if ( !aClientRequest ) |
4553 if ( !aClientRequest ) |
4328 { |
4554 { |
4387 RMemReadStream stream( bridgeBuffer, length ); |
4613 RMemReadStream stream( bridgeBuffer, length ); |
4388 |
4614 |
4389 // operation tells if this is begin full screen or end full screen |
4615 // operation tells if this is begin full screen or end full screen |
4390 TInt operation = stream.ReadInt32L(); |
4616 TInt operation = stream.ReadInt32L(); |
4391 |
4617 |
|
4618 // If we are in low memory state, we don't want to do any effects |
|
4619 if(iHuiEnv->MemoryLevel() < EHuiMemoryLevelReduced) |
|
4620 { |
|
4621 __ALFFXLOGSTRING("CAlfBridge::HandleGfxEffectsL - Returning because memory level below NORMAL"); |
|
4622 stream.Release(); |
|
4623 return; |
|
4624 } |
|
4625 |
4392 if ( operation == MAlfGfxEffectPlugin::EBeginFullscreen ) |
4626 if ( operation == MAlfGfxEffectPlugin::EBeginFullscreen ) |
4393 { |
4627 { |
4394 if ( !iFullScreenEffectData || !iFullScreenEffectData->iSetupDone ) |
4628 if ( !iFullScreenEffectData || !iFullScreenEffectData->iSetupDone ) |
4395 { |
4629 { |
4396 // No fullsceen effect ongoing or fullscreen effect hasn't yet been set up, |
4630 // No fullsceen effect ongoing or fullscreen effect hasn't yet been set up, |
4475 fxData->iWaitingWindowGroup = EFalse; |
4709 fxData->iWaitingWindowGroup = EFalse; |
4476 |
4710 |
4477 __ALFFXLOGSTRING3("CAlfBridge::HandleGfxEffectsL - Operation: %d, handle: %d, type: %d", operation, fxData->iHandle, fxData->iType); |
4711 __ALFFXLOGSTRING3("CAlfBridge::HandleGfxEffectsL - Operation: %d, handle: %d, type: %d", operation, fxData->iHandle, fxData->iType); |
4478 __ALFFXLOGSTRING2("CAlfBridge::HandleGfxEffectsL - towg: %d, fromwg: %d", fxData->iToWg, fxData->iFromWg); |
4712 __ALFFXLOGSTRING2("CAlfBridge::HandleGfxEffectsL - towg: %d, fromwg: %d", fxData->iToWg, fxData->iFromWg); |
4479 |
4713 |
4480 // find root nodes and attach effects to them |
4714 CHuiControlGroup* toGroup = NULL; |
4481 // First we need a windowgroup node id. So far we have a list of window ids |
4715 |
4482 |
|
4483 // wg2 is the window group that is supposed to disappear from view |
|
4484 // when a new application starts. We don't have any use for it now... |
|
4485 |
|
4486 // This is the group that is disappearing |
|
4487 // Currently we don't add an effect to it. |
|
4488 |
|
4489 // TODO: when ids available from wserv... |
|
4490 // if ( appUid2 ) |
|
4491 //{ |
|
4492 // group2 = FindControlGrouAppUId( appUid2, screen2, &alfGroup ); |
|
4493 // } |
|
4494 //if ( toAppId2 ) |
|
4495 // { |
|
4496 // group2 = FindControlGroupByAppId(toAppId2); |
|
4497 // } |
|
4498 //if ( wg2 && wg2 != KErrNotFound ) |
|
4499 // { |
|
4500 // group2 = FindControlGroupByWindowGroupId( wg2, screen2 ); |
|
4501 // } |
|
4502 // if ( group2 ) |
|
4503 // { |
|
4504 // CHuiControl& control = group2->Control(0); |
|
4505 // layout2 = (CHuiLayout*)&control.Visual(0); |
|
4506 // } |
|
4507 |
|
4508 // This effect is triggered either by BeginFullScreen or by EndFullScreen |
|
4509 // depending on if we have an application that is already running or not |
|
4510 |
|
4511 // TAlfControlGroupEntry* alfGroup = NULL; |
|
4512 |
|
4513 TBool failed = EFalse; |
4716 TBool failed = EFalse; |
4514 if (fxData->iToAppId && fxData->iToAppId != KErrNotFound) |
4717 if (fxData->iToAppId && fxData->iToAppId != KErrNotFound) |
4515 { |
4718 { |
4516 CHuiControlGroup* toGroup = NULL; |
|
4517 CHuiLayout* toLayout = NULL; |
4719 CHuiLayout* toLayout = NULL; |
4518 toGroup = FindControlGroupByFullScreenToEffect(); |
4720 toGroup = FindControlGroupByFullScreenToEffect(); |
4519 |
4721 |
4520 CHuiControlGroup* fromGroup = NULL; |
4722 CHuiControlGroup* fromGroup = NULL; |
4521 CHuiLayout* fromLayout = NULL; |
4723 CHuiLayout* fromLayout = NULL; |
4550 if ( failed ) |
4752 if ( failed ) |
4551 { |
4753 { |
4552 // Effect failed, reset state |
4754 // Effect failed, reset state |
4553 HandleGfxStopEvent( EFalse ); // destroys iFullScreenEffectData |
4755 HandleGfxStopEvent( EFalse ); // destroys iFullScreenEffectData |
4554 } |
4756 } |
|
4757 else |
|
4758 { |
|
4759 // it might be that the application is already having drawing for the whole screen. |
|
4760 // If so, then trigger EndFullScreen immediately. |
|
4761 if (fxData && |
|
4762 toGroup |
|
4763 && fxData->iOperation == MAlfGfxEffectPlugin::EBeginFullscreen |
|
4764 && fxData->iEffectType == CFullScreenEffectState::EStartEffect) |
|
4765 { |
|
4766 GfxTriggerEffectWhenFullScreenDrawn(toGroup); |
|
4767 } |
|
4768 } |
4555 |
4769 |
4556 for (TInt i = 0; i < iAlfScreens.Count(); i++) |
4770 for (TInt i = 0; i < iAlfScreens.Count(); i++) |
4557 { |
4771 { |
4558 iAlfScreens[i]->iDisplay->SetDirty(); |
4772 iAlfScreens[i]->iDisplay->SetDirty(); |
4559 } |
4773 } |
4560 iAlfScreens[0]->iVisualTreeVisibilityChanged = ETrue; |
4774 iAlfScreens[0]->iVisualTreeVisibilityChanged = ETrue; |
4561 iHuiEnv->ContinueRefresh(); |
4775 iHuiEnv->ContinueRefresh(); |
4562 |
4776 |
4563 __ALFFXLOGSTRING("CAlfBridge::HandleGfxEffectsL - END"); |
4777 __ALFFXLOGSTRING("CAlfBridge::HandleGfxEffectsL - END"); |
|
4778 } |
|
4779 |
|
4780 TBool CAlfBridge::GfxTriggerEffectWhenFullScreenDrawn(CHuiControlGroup* aToGroup) |
|
4781 { |
|
4782 if (!aToGroup || (aToGroup && aToGroup->Count() == 0)) |
|
4783 { |
|
4784 return EFalse; |
|
4785 } |
|
4786 iTempRegion.Clear(); |
|
4787 |
|
4788 CAlfScreen* screen = iAlfScreens[0]; |
|
4789 TRect fullscreen = TRect(TPoint(0,0), screen->Size()); |
|
4790 TBool fullscreenCovered(EFalse); |
|
4791 TInt dummy = 0; |
|
4792 |
|
4793 CHuiControl& control = aToGroup->Control(0); |
|
4794 CHuiLayout* toLayout = control.VisualCount() > 0 ? (CHuiLayout*)&control.Visual(0) : NULL; |
|
4795 if (!toLayout) |
|
4796 { |
|
4797 return EFalse; |
|
4798 } |
|
4799 TBool opaque = ETrue; // in app start case the layout is propably not opaque. Fake it. |
|
4800 IsFullScreenDrawnRecursive(toLayout, *aToGroup, control, fullscreenCovered, fullscreen, screen, dummy, opaque, iAlfScreens[0]->iDisplay->Orientation()); |
|
4801 fullscreenCovered = IsRectCoveredByRegion(fullscreen, iTempRegion); |
|
4802 __ALFFXLOGSTRING1("CAlfBridge::GfxTriggerEffectWhenFullScreenDrawn - Covered: %d", fullscreenCovered); |
|
4803 if (fullscreenCovered) |
|
4804 { |
|
4805 GfxTriggerEndFullScreen(iFullScreenEffectData); |
|
4806 return ETrue; |
|
4807 } |
|
4808 return EFalse; |
4564 } |
4809 } |
4565 |
4810 |
4566 // TODO: add effect type to effect struct. remove all fullscreen effects. currently some might hang around |
4811 // TODO: add effect type to effect struct. remove all fullscreen effects. currently some might hang around |
4567 void CAlfBridge::HandleGfxStopEffectsL(TAlfBridgerData data) |
4812 void CAlfBridge::HandleGfxStopEffectsL(TAlfBridgerData data) |
4568 { |
4813 { |
4827 if (iControlEffectData) |
5075 if (iControlEffectData) |
4828 { |
5076 { |
4829 delete iControlEffectData; |
5077 delete iControlEffectData; |
4830 iControlEffectData = NULL; |
5078 iControlEffectData = NULL; |
4831 } |
5079 } |
|
5080 |
|
5081 // If we are in low memory state, we don't want to do any effects |
|
5082 if(iHuiEnv->MemoryLevel() < EHuiMemoryLevelReduced) |
|
5083 { |
|
5084 __ALFFXLOGSTRING("CAlfBridge::HandleGfxControlEffectsL - Returning because memory level below NORMAL"); |
|
5085 stream.Release(); |
|
5086 return; |
|
5087 } |
|
5088 |
4832 CControlEffectState* fxData = new (ELeave) CControlEffectState; |
5089 CControlEffectState* fxData = new (ELeave) CControlEffectState; |
4833 CleanupStack::PushL(fxData); |
5090 CleanupStack::PushL(fxData); |
4834 fxData->ConstructL(action, stream); |
5091 fxData->ConstructL(action, stream); |
4835 iControlEffectData = fxData; |
5092 iControlEffectData = fxData; |
4836 CleanupStack::Pop(fxData); |
5093 CleanupStack::Pop(fxData); |
4872 // Check if there is an effects engine in HuiEnv |
5129 // Check if there is an effects engine in HuiEnv |
4873 CHuiFxEffect* effect = NULL; |
5130 CHuiFxEffect* effect = NULL; |
4874 CHuiFxEngine* engine = NULL; |
5131 CHuiFxEngine* engine = NULL; |
4875 // engine is not owned by us, it is a member of HuiEnv |
5132 // engine is not owned by us, it is a member of HuiEnv |
4876 engine = iHuiEnv->EffectsEngine(); |
5133 engine = iHuiEnv->EffectsEngine(); |
4877 if (NeedsStoredBuffers(engine, *aEvent.iEffectName)) |
|
4878 { |
|
4879 RecursiveStoreRenderBufferL(aCanvasVisual); |
|
4880 } |
|
4881 |
|
4882 if (engine) |
5134 if (engine) |
4883 { |
5135 { |
|
5136 if (NeedsStoredBuffers(engine, *aEvent.iEffectName)) |
|
5137 { |
|
5138 RecursiveStoreRenderBufferL(aCanvasVisual); |
|
5139 } |
|
5140 |
4884 // clear out old effect if this visual has one |
5141 // clear out old effect if this visual has one |
4885 __ALFFXLOGSTRING2("HandleGfxControlEffectsL - loading effect %S on visual 0x%x", aEvent.iEffectName, aCanvasVisual ); |
5142 __ALFFXLOGSTRING2("HandleGfxControlEffectsL - loading effect %S on visual 0x%x", aEvent.iEffectName, aCanvasVisual ); |
4886 __ALFFXLOGSTRING1("HandleGfxControlEffectsL - loading control effect, handle %d", aEvent.iHandle ); |
5143 __ALFFXLOGSTRING1("HandleGfxControlEffectsL - loading control effect, handle %d", aEvent.iHandle ); |
4887 if (aCanvasVisual->Effect()) |
5144 if (aCanvasVisual->Effect()) |
4888 { |
5145 { |
4889 __ALFFXLOGSTRING1("HandleGfxControlEffectsL - 0x%x has active effect. Requesting removal.", aCanvasVisual); |
5146 __ALFFXLOGSTRING1("HandleGfxControlEffectsL - 0x%x has active effect. Requesting removal.", aCanvasVisual); |
4890 // another effect coming to already effected visual. E.g. close options menu, while opening effect still ongoing |
5147 // another effect coming to already effected visual. E.g. close options menu, while opening effect still ongoing |
4891 RemoveTemporaryPresenterVisual(aCanvasVisual); |
5148 RemoveTemporaryPresenterVisual(aCanvasVisual); |
4892 } |
5149 } |
4893 TBool layoutEffectable(EFalse); |
5150 TBool layoutEffectable(EFalse); |
4894 aCanvasVisual->iOpacity.Set(KAlfVisualDefaultOpacity); |
|
4895 if (aEvent.iAction == KGfxControlDisappearAction) |
5151 if (aEvent.iAction == KGfxControlDisappearAction) |
4896 { // TODO: revise |
5152 { // TODO: revise |
4897 // The control stays visible because the inactive flag is not set |
5153 // The control stays visible because the inactive flag is not set |
4898 // if the window is reserved. |
5154 // if the window is reserved. |
4899 /*if (aCanvasVisual->iOpacity.Target() == 0.0f) |
5155 /*if (aCanvasVisual->iOpacity.Target() == 0.0f) |
4910 { |
5166 { |
4911 layoutEffectable = SetupEffectLayoutContainerL(aEvent.iHandle, aCanvasVisual, EFalse, EFalse); |
5167 layoutEffectable = SetupEffectLayoutContainerL(aEvent.iHandle, aCanvasVisual, EFalse, EFalse); |
4912 } |
5168 } |
4913 if (layoutEffectable) |
5169 if (layoutEffectable) |
4914 { |
5170 { |
4915 TRAP( err, engine->LoadGroupEffectL(*aEvent.iEffectName, effect, aCanvasVisual->Effectable(), engine->ActiveGroupEffect(), NULL, this, aEvent.iHandle, KHuiFxDelayRunUntilFirstFrameHasBeenDrawn ) ); |
5171 TInt effectFlags = 0; |
|
5172 |
|
5173 // effect will start delayed anyway when it is syncronized. this flag would break syncronization between effects. |
|
5174 effectFlags = KHuiFxDelayRunUntilFirstFrameHasBeenDrawn; |
|
5175 TInt activeEffectGroup = engine->ActiveGroupEffect(); |
|
5176 if (activeEffectGroup != KErrNotFound) |
|
5177 { |
|
5178 engine->AddEffectToGroup(activeEffectGroup); |
|
5179 } |
|
5180 TRAP( err, engine->LoadGroupEffectL(*aEvent.iEffectName, effect, aCanvasVisual->Effectable(), activeEffectGroup, NULL, this, aEvent.iHandle, effectFlags ) ); |
4916 } |
5181 } |
4917 else |
5182 else |
4918 { |
5183 { |
4919 err = KErrNotFound; |
5184 err = KErrNotFound; |
4920 } |
5185 } |
5651 modified = ETrue; |
5916 modified = ETrue; |
5652 } |
5917 } |
5653 // For tests |
5918 // For tests |
5654 //TUint32* data = aScreen->iSwRenderingTarget->DataAddress(); |
5919 //TUint32* data = aScreen->iSwRenderingTarget->DataAddress(); |
5655 } |
5920 } |
|
5921 |
|
5922 if (modified && aScreen->iSwRenderingTarget) |
|
5923 { |
|
5924 InitializeSwRenderingTarget(aScreen->iSwRenderingTarget); |
|
5925 } |
5656 } |
5926 } |
5657 else |
5927 else |
5658 { |
5928 { |
5659 delete aScreen->iSwRenderingTarget; |
5929 delete aScreen->iSwRenderingTarget; |
5660 aScreen->iSwRenderingTarget = NULL; |
5930 aScreen->iSwRenderingTarget = NULL; |
5661 modified = ETrue; |
5931 modified = ETrue; |
5662 } |
5932 } |
5663 |
5933 |
5664 return modified; |
5934 return modified; |
|
5935 } |
|
5936 |
|
5937 // --------------------------------------------------------------------------- |
|
5938 // --------------------------------------------------------------------------- |
|
5939 // |
|
5940 void CAlfBridge::InitializeSwRenderingTarget(CFbsBitmap* aBitmap) |
|
5941 { |
|
5942 __ALFLOGSTRING("CAlfBridge::InitializeSwRenderingTarget"); |
|
5943 TAlfBridgeDrawerWrapper wrapper(*this); |
|
5944 AlfDrawerInternal::CopyScreenToBitmap(&wrapper, aBitmap, |
|
5945 TRect(aBitmap->SizeInPixels())); |
|
5946 __ALFLOGSTRING("CAlfBridge::InitializeSwRenderingTarget ok"); |
5665 } |
5947 } |
5666 |
5948 |
5667 // --------------------------------------------------------------------------- |
5949 // --------------------------------------------------------------------------- |
5668 // --------------------------------------------------------------------------- |
5950 // --------------------------------------------------------------------------- |
5669 // |
5951 // |
5751 } |
6033 } |
5752 |
6034 |
5753 // --------------------------------------------------------------------------- |
6035 // --------------------------------------------------------------------------- |
5754 // --------------------------------------------------------------------------- |
6036 // --------------------------------------------------------------------------- |
5755 // |
6037 // |
5756 void CAlfBridge::LowMemoryCancelAllEffects() |
6038 void CAlfBridge::OnLowMemoryModifyAllEffects() |
5757 { |
6039 { |
5758 __ALFLOGSTRING("CAlfBridge::LowMemoryCancelAllEffects"); |
6040 __ALFLOGSTRING("CAlfBridge::OnLowMemoryModifyAllEffects"); |
5759 iLayoutSwitchEffectCoordinator->Cancel(); |
6041 iLayoutSwitchEffectCoordinator->LowMemoryEvent(); |
5760 HandleGfxStopEvent( EFalse ); |
6042 HandleGfxStopEvent( EFalse ); |
5761 __ALFLOGSTRING("CAlfBridge::LowMemoryCancelAllEffects done"); |
6043 |
|
6044 __ALFLOGSTRING("CAlfBridge::OnLowMemoryModifyAllEffects done"); |
5762 } |
6045 } |
5763 |
6046 |
5764 // --------------------------------------------------------------------------- |
6047 // --------------------------------------------------------------------------- |
5765 // --------------------------------------------------------------------------- |
6048 // --------------------------------------------------------------------------- |
5766 // |
6049 // |
5812 // --------------------------------------------------------------------------- |
6095 // --------------------------------------------------------------------------- |
5813 // --------------------------------------------------------------------------- |
6096 // --------------------------------------------------------------------------- |
5814 // |
6097 // |
5815 void CAlfBridge::Synchronized(TInt aId) |
6098 void CAlfBridge::Synchronized(TInt aId) |
5816 { |
6099 { |
5817 // Use P&S for now. |
6100 if(aId == iIdForLayoutSwitchFrameSync) |
5818 RProperty::Set( KAlfPSUidSynchronizer, KAlfPSKeySynchronizer, aId ); |
6101 { |
|
6102 // send notification to alfstreamer server about |
|
6103 if (iActivated) |
|
6104 { |
|
6105 iBridgerClient.SendBlind(KAlfCompositionLayoutSwitchComplete, TIpcArgs()); |
|
6106 } |
|
6107 } |
|
6108 else |
|
6109 { |
|
6110 // Use P&S for now. |
|
6111 RProperty::Set( KAlfPSUidSynchronizer, KAlfPSKeySynchronizer, aId ); |
|
6112 } |
5819 } |
6113 } |
5820 |
6114 |
5821 void CAlfBridge::SetWindowGroupAsAlfApp(TInt aId) |
6115 void CAlfBridge::SetWindowGroupAsAlfApp(TInt aId) |
5822 { |
6116 { |
5823 TBool lBreak = EFalse; |
6117 TBool lBreak = EFalse; |
5855 aOrientation = iAlfScreens[0]->iDisplay->Orientation(); |
6149 aOrientation = iAlfScreens[0]->iDisplay->Orientation(); |
5856 iTempRegion.Clear(); |
6150 iTempRegion.Clear(); |
5857 |
6151 |
5858 CAlfScreen* screen = iAlfScreens[0]; |
6152 CAlfScreen* screen = iAlfScreens[0]; |
5859 TRect fullscreen = TRect(TPoint(0,0), screen->Size()); |
6153 TRect fullscreen = TRect(TPoint(0,0), screen->Size()); |
5860 TBool fadeEffectInScreen = EFalse; |
6154 __ALFFXLOGSTRING3("CAlfBridge::IsFullScreenDrawn - new orientation %d, screen size: (%d,%d)", aOrientation, fullscreen.iBr.iX, fullscreen.iBr.iY ); |
5861 |
|
5862 TBool fullscreenCovered = EFalse; |
6155 TBool fullscreenCovered = EFalse; |
5863 CAlfAppSrvSessionBase* topMostAlfSrvSession = NULL; |
6156 CAlfAppSrvSessionBase* topMostAlfSrvSession = NULL; |
5864 |
6157 |
5865 //iActiveVisualCount = 0; |
|
5866 iBgSurfaceFound = EFalse; |
|
5867 //iPaintedArea = 0; |
|
5868 |
|
5869 // Check if effect group has an effect with opaque hint. |
6158 // Check if effect group has an effect with opaque hint. |
5870 CHuiControlGroup& fxcontrolgroup = *(iAlfScreens[0]->iFullscreenEffectControlGroup); |
6159 CHuiControlGroup& fxcontrolgroup = *(iAlfScreens[0]->iFullscreenEffectControlGroup); |
5871 CHuiControl& fxcontrol = fxcontrolgroup.Control(0); |
6160 CHuiControl& fxcontrol = fxcontrolgroup.Control(0); |
5872 CHuiCanvasVisual* fxlayout = (CHuiCanvasVisual*)&fxcontrol.Visual(0); |
6161 CHuiCanvasVisual* fxlayout = (CHuiCanvasVisual*)&fxcontrol.Visual(0); |
5873 CHuiVisual* fxExternalContent = fxlayout->ExternalContent(); |
6162 CHuiVisual* fxExternalContent = fxlayout->ExternalContent(); |
5879 else if (fxExternalContent && IsOpaqueEffect(fxExternalContent->Effect())) |
6168 else if (fxExternalContent && IsOpaqueEffect(fxExternalContent->Effect())) |
5880 { |
6169 { |
5881 fullscreenCovered = ETrue; |
6170 fullscreenCovered = ETrue; |
5882 } |
6171 } |
5883 |
6172 |
5884 |
|
5885 TBool alfWindowGroupFoundVisible = EFalse; |
6173 TBool alfWindowGroupFoundVisible = EFalse; |
5886 |
6174 |
5887 AMT_SET_VALUE( iVisibleVisualCount, 0 ); |
6175 AMT_SET_VALUE( iVisibleVisualCount, 0 ); |
5888 |
6176 |
5889 // skip the topmost (effect) layer, start from floating sprite group |
6177 // skip the topmost (effect) layer, start from floating sprite group |
5890 for (TInt j=screen->iDisplay->Roster().Count() - screen->FixedControlGroupCount(); j>=0; j--) |
6178 for (TInt j=screen->iDisplay->Roster().Count() - screen->FixedControlGroupCount(); j>=0; j--) |
5891 { |
6179 { |
5892 CHuiControlGroup& controlgroup = iAlfScreens[0]->iDisplay->Roster().ControlGroup(j); |
6180 CHuiControlGroup& controlgroup = iAlfScreens[0]->iDisplay->Roster().ControlGroup(j); |
5893 CHuiControl& control = controlgroup.Control(0); |
6181 CHuiControl& control = controlgroup.Control(0); |
5894 |
6182 __ALFFXLOGSTRING1("CAlfBridge::IsFullScreenDrawn : Group owner 0x%x", controlgroup.SecureId()); |
|
6183 |
|
6184 |
5895 if (control.Role() == EAlfFpsIndicatorContainer) |
6185 if (control.Role() == EAlfFpsIndicatorContainer) |
5896 { |
6186 { |
5897 // FPS container doesn't contain canvas visuals |
6187 // FPS container doesn't contain canvas visuals |
5898 continue; |
6188 continue; |
5899 } |
6189 } |
5901 CHuiCanvasVisual* layout = (CHuiCanvasVisual*)&control.Visual(0); |
6191 CHuiCanvasVisual* layout = (CHuiCanvasVisual*)&control.Visual(0); |
5902 |
6192 |
5903 // For optimization reasons, check if all visuals below in Z-order are covered |
6193 // For optimization reasons, check if all visuals below in Z-order are covered |
5904 if (!fullscreenCovered) |
6194 if (!fullscreenCovered) |
5905 { |
6195 { |
5906 fullscreenCovered = IsRectCoveredByRegion(fullscreen, iTempRegion); |
6196 fullscreenCovered = IsRectCoveredByRegion(fullscreen, iTempRegion); |
|
6197 |
|
6198 for(TInt ii=0;ii< iTempRegion.Count(); ii++) |
|
6199 { |
|
6200 __ALFFXLOGSTRING4("CAlfBridge::IsFullScreenDrawn (%d,%d)-(%d,%d)", iTempRegion[ii].iTl.iX, iTempRegion[ii].iTl.iY , iTempRegion[ii].iBr.iX, iTempRegion[ii].iBr.iY ); |
|
6201 } |
5907 } |
6202 } |
5908 |
6203 |
5909 // Dont mess with alf control group visuals, alf session handling does it for us |
6204 // Dont mess with alf control group visuals, alf session handling does it for us |
5910 if (control.Role() == EAlfSessionContainer) |
6205 if (control.Role() == EAlfSessionContainer) |
5911 { |
6206 { |
5912 CHuiLayout* hostContainer = control.ContainerLayout( NULL ); |
6207 CHuiLayout* hostContainer = control.ContainerLayout( NULL ); |
5913 TInt flags = hostContainer->Flags(); |
6208 TInt flags = hostContainer->Flags(); |
5914 if (!fullscreenCovered) |
6209 if (!fullscreenCovered) |
5915 { |
6210 { |
5916 // clear inactive flag if client has not made this controlgroup hidden |
6211 |
5917 if(!(flags&EHuiVisualFlagUnderOpaqueHint)) |
6212 if(!(flags&EHuiVisualFlagUnderOpaqueHint)) |
5918 { |
6213 { |
5919 alfWindowGroupFoundVisible = ETrue; |
6214 alfWindowGroupFoundVisible = ETrue; |
5920 if(iAppUi) |
6215 if(iAppUi) |
5921 { |
6216 { |
5954 continue; |
6249 continue; |
5955 } |
6250 } |
5956 |
6251 |
5957 __ALFLOGSTRING1("CAlfBridge::IsFullScreenDraw - fullscreen covered %d", fullscreenCovered) |
6252 __ALFLOGSTRING1("CAlfBridge::IsFullScreenDraw - fullscreen covered %d", fullscreenCovered) |
5958 TBool subTreeCovered = EFalse; |
6253 TBool subTreeCovered = EFalse; |
5959 TBool hasLayers = EFalse; |
|
5960 TBool hasActiveVisualsInVisualTree = |
6254 TBool hasActiveVisualsInVisualTree = |
5961 IsFullScreenDrawnRecursive( layout, controlgroup, control, fullscreenCovered, fullscreen, screen,subTreeCovered, hasLayers, IsVisualOpaque(*layout), aOrientation ); |
6255 IsFullScreenDrawnRecursive( layout, controlgroup, control, fullscreenCovered, fullscreen, screen,subTreeCovered, IsVisualOpaque(*layout), aOrientation ); |
5962 TBool hasFadeEffectsInVisualTree = (layout->CanvasFlags() & EHuiCanvasFlagExternalFadeExistsInsideVisualTree); |
|
5963 |
|
5964 // If root visuals effect is marked as opaque, then add whole screen area as covered. |
6256 // If root visuals effect is marked as opaque, then add whole screen area as covered. |
|
6257 /* |
5965 if (!fullscreenCovered) |
6258 if (!fullscreenCovered) |
5966 { |
6259 { |
5967 fullscreenCovered = IsOpaqueEffect(layout->Effect()); |
6260 fullscreenCovered = IsOpaqueEffect(layout->Effect()); |
5968 } |
6261 } |
5969 // "has layers" has been removed |
6262 */ |
5970 // If we layout is active setup the fade effects. Also if it is inactive, but has been |
6263 |
5971 // flagged as containing fade effect, then run the setup as well so that effects which |
|
5972 // are no more needed get removed. |
|
5973 |
|
5974 TBool isLayoutActive = !(layout->Flags() & EHuiVisualFlagInactive); |
|
5975 if (isLayoutActive && !hasActiveVisualsInVisualTree) |
|
5976 { |
|
5977 // Setting also the root visual (layout) as inactive, if it had none |
|
5978 // active children. This is because otherwise the Inactive checks won't |
|
5979 // work correctly within RosterImpl ScanDirty & ClearChanged phases. |
|
5980 |
|
5981 } |
|
5982 else if(!isLayoutActive && hasActiveVisualsInVisualTree) |
|
5983 { |
|
5984 } |
|
5985 if (fullscreenCovered) |
6264 if (fullscreenCovered) |
5986 { |
6265 { |
5987 return ETrue; |
6266 return ETrue; |
5988 } |
6267 } |
5989 } |
6268 } |
5996 CHuiControl& aControl, |
6275 CHuiControl& aControl, |
5997 TBool& aFullscreenCovered, |
6276 TBool& aFullscreenCovered, |
5998 TRect& aFullscreen, |
6277 TRect& aFullscreen, |
5999 CAlfScreen* aScreen, |
6278 CAlfScreen* aScreen, |
6000 TBool& aSubtreeVisible, |
6279 TBool& aSubtreeVisible, |
6001 TBool& aHasVisualsWithLayers, |
|
6002 TBool aChildCanBeOpaque, |
6280 TBool aChildCanBeOpaque, |
6003 TInt aOrientation) |
6281 TInt aOrientation) |
6004 { |
6282 { |
6005 TBool visualTreeActive = EFalse; |
6283 TBool visualTreeActive = EFalse; |
6006 TRect visualDisplayRect; |
6284 TRect visualDisplayRect; |
6026 // visual itself is opaque. |
6304 // visual itself is opaque. |
6027 // For example, parent can have opacity < 1 and that affects children as well. |
6305 // For example, parent can have opacity < 1 and that affects children as well. |
6028 // As another example, parent can have scaling transformation. |
6306 // As another example, parent can have scaling transformation. |
6029 visualIsOpaque = aChildCanBeOpaque && IsVisualOpaque(*canvasVisual); |
6307 visualIsOpaque = aChildCanBeOpaque && IsVisualOpaque(*canvasVisual); |
6030 |
6308 |
6031 if (visualIsOpaque && !canvasVisual->LayerExtent().IsEmpty()) |
|
6032 { |
|
6033 aHasVisualsWithLayers = ETrue; |
|
6034 } |
|
6035 |
|
6036 if (canvasVisual->Count()) |
6309 if (canvasVisual->Count()) |
6037 { |
6310 { |
6038 visualTreeActive |= IsFullScreenDrawnRecursive( canvasVisual, aControlGroup, aControl,aFullscreenCovered, aFullscreen, aScreen,visualSubtreeVisible, aHasVisualsWithLayers, visualIsOpaque, aOrientation ); |
6311 visualTreeActive |= IsFullScreenDrawnRecursive( canvasVisual, aControlGroup, aControl,aFullscreenCovered, aFullscreen, aScreen,visualSubtreeVisible, visualIsOpaque, aOrientation ); |
6039 } |
6312 } |
6040 |
6313 |
6041 |
6314 |
6042 if (visualSubtreeVisible) |
6315 if (visualSubtreeVisible) |
6043 { |
6316 { |
6050 visualRectIsCovered = ETrue; |
6323 visualRectIsCovered = ETrue; |
6051 } |
6324 } |
6052 else |
6325 else |
6053 { |
6326 { |
6054 // add the rect only if the window contains drawing for the new orientation |
6327 // add the rect only if the window contains drawing for the new orientation |
|
6328 |
6055 visualDisplayRect = canvasVisual->CommandBufferCoverage(aOrientation); |
6329 visualDisplayRect = canvasVisual->CommandBufferCoverage(aOrientation); |
6056 |
6330 |
6057 // Make sure we clip visual rect to visible screen area |
6331 // Make sure we clip visual rect to visible screen area |
6058 ClipVisualRect(visualDisplayRect, aFullscreen); |
6332 ClipVisualRect(visualDisplayRect, aFullscreen); |
6059 |
6333 |
6060 // Check if this visual is covered by other opaque visuals which rects are in "covered" region |
6334 // Check if this visual is covered by other opaque visuals which rects are in "covered" region |
6061 visualRectIsCovered = IsRectCoveredByRegion(visualDisplayRect, iTempRegion); |
6335 visualRectIsCovered = IsRectCoveredByRegion(visualDisplayRect, iTempRegion); |
6062 } |
6336 |
6063 |
6337 } |
6064 // Finally check the area that this visual covers and add it to covered region |
6338 |
6065 visualIsActive = !(canvasVisual->Flags() & EHuiVisualFlagInactive); |
6339 |
6066 |
6340 visualIsActive = canvasVisual->iOpacity.Now() > 0.01; // in fact this does not mean that visual should be drawn, but this atleast prevents disabled "on top" windows to be considered as visible. |
|
6341 |
6067 // Sprites and effects as we consider them always as transparent and also |
6342 // Sprites and effects as we consider them always as transparent and also |
6068 // if controlgroup is transformed somehow |
6343 // if controlgroup is transformed somehow |
6069 |
|
6070 if (aControl.Role() == EAlfFullScreenEffectContainer |
6344 if (aControl.Role() == EAlfFullScreenEffectContainer |
6071 || aControl.Role() == EAlfWindowFloatingSpriteContainer || |
6345 || aControl.Role() == EAlfWindowFloatingSpriteContainer || |
6072 aControlGroup.IsTransformed()) |
6346 aControlGroup.IsTransformed()) |
6073 { |
6347 { |
6074 visualIsOpaque = EFalse; |
6348 visualIsOpaque = EFalse; |
6076 |
6350 |
6077 if (visualIsActive && visualIsOpaque && !visualRectIsCovered) |
6351 if (visualIsActive && visualIsOpaque && !visualRectIsCovered) |
6078 { |
6352 { |
6079 // New visibility system takes only window shape into account. |
6353 // New visibility system takes only window shape into account. |
6080 if ( canvasVisual->CanvasFlags() & EHuiCanvasFlagIncludeToVisibilityCalculation ) |
6354 if ( canvasVisual->CanvasFlags() & EHuiCanvasFlagIncludeToVisibilityCalculation ) |
6081 { |
6355 { |
6082 if ( !canvasVisual->HasCustomShape() ) |
6356 iTempRegion.AddRect(visualDisplayRect); |
6083 { |
6357 iTempRegion.Tidy(); |
6084 TRect displayRect(canvasVisual->DisplayRect()); |
6358 __ALFFXLOGSTRING4("CAlfBridge::IsFullScreenDrawnRecursive - Added covered area (%d,%d)-(%d,%d)", visualDisplayRect.iTl.iX, visualDisplayRect.iTl.iY , visualDisplayRect.iBr.iX, visualDisplayRect.iBr.iY ); |
6085 ClipVisualRect(displayRect, aFullscreen); |
|
6086 iTempRegion.AddRect(displayRect); |
|
6087 iTempRegion.Tidy(); |
|
6088 } |
|
6089 else |
|
6090 { |
|
6091 TRect displayRect = canvasVisual->DisplayRect(); |
|
6092 const TRegion& region = canvasVisual->ShapeRegion(); |
|
6093 TPoint delta = -canvasVisual->ShapeOrigin() + displayRect.iTl; |
|
6094 |
|
6095 for (TInt i = 0; i < region.Count(); ++i) |
|
6096 { |
|
6097 TRect coveredRect(region[i]); |
|
6098 coveredRect.Move(delta); |
|
6099 ClipVisualRect(coveredRect, aFullscreen); |
|
6100 iTempRegion.AddRect(coveredRect); |
|
6101 iTempRegion.Tidy(); |
|
6102 } |
|
6103 } |
|
6104 } |
6359 } |
6105 } |
6360 } |
6106 visualTreeActive |= visualIsActive; |
6361 visualTreeActive |= visualIsActive; |
6107 |
6362 |
6108 // iVisibleVisualCount is cleared in HandleVisualVisibility() |
6363 // iVisibleVisualCount is cleared in HandleVisualVisibility() |
6109 AMT_INC_COUNTER_IF( visualIsActive && !visualRectIsCovered , iVisibleVisualCount ); |
6364 AMT_INC_COUNTER_IF( visualIsActive && !visualRectIsCovered , iVisibleVisualCount ); |
6110 } // for loop end : children checking loop |
6365 } // for loop end : children checking loop |
6111 |
|
6112 return visualTreeActive; |
6366 return visualTreeActive; |
6113 } |
6367 } |
6114 |
6368 |
|
6369 |
|
6370 void CAlfBridge::LayoutSwitchStart() |
|
6371 { |
|
6372 // mark all the application surfaces hidden |
|
6373 if (!iAlfScreens.Count()) |
|
6374 { |
|
6375 return; |
|
6376 } |
|
6377 iLayoutSwitchInProgress = ETrue; |
|
6378 CAlfScreen* screen = iAlfScreens[0]; |
|
6379 // skip the topmost (effect) layer, start from floating sprite group |
|
6380 for (TInt j=screen->iDisplay->Roster().Count() - screen->FixedControlGroupCount(); j>=0; j--) |
|
6381 { |
|
6382 CHuiControlGroup& controlgroup = screen->iDisplay->Roster().ControlGroup(j); |
|
6383 CHuiControl& control = controlgroup.Control(0); |
|
6384 |
|
6385 if (control.Role() == EAlfFpsIndicatorContainer || control.Role() == EAlfSessionContainer) |
|
6386 { |
|
6387 // FPS container doesn't contain canvas visuals and alfsession containers cannot have surfaces |
|
6388 continue; |
|
6389 } |
|
6390 |
|
6391 CHuiCanvasVisual* layout = (CHuiCanvasVisual*)&control.Visual(0); |
|
6392 MarkAllLayersHiddenRecursive(layout); |
|
6393 } |
|
6394 |
|
6395 } |
|
6396 |
|
6397 void CAlfBridge::MarkAllLayersHiddenRecursive(CHuiLayout* aLayout) |
|
6398 { |
|
6399 CHuiCanvasVisual* canvasVisual = NULL; |
|
6400 |
|
6401 for (TInt i = aLayout->Count()-1; i >= 0; i--) |
|
6402 { |
|
6403 canvasVisual = (CHuiCanvasVisual*)(&aLayout->Visual(i)); |
|
6404 if(canvasVisual) |
|
6405 { |
|
6406 if (canvasVisual->Count()) |
|
6407 { |
|
6408 MarkAllLayersHiddenRecursive(canvasVisual); |
|
6409 } |
|
6410 |
|
6411 if (!canvasVisual->LayerExtent().IsEmpty()) |
|
6412 { |
|
6413 canvasVisual->ClearCanvasFlags(EHuiCanvasFlagSurfaceVisible); |
|
6414 canvasVisual->SetCanvasFlags(EHuiCanvasFlagSurfaceInvisible); |
|
6415 } |
|
6416 } |
|
6417 } |
|
6418 } |
|
6419 |
|
6420 void CAlfBridge::LayoutSwitchComplete() |
|
6421 { |
|
6422 // send notification to alfstreamer server |
|
6423 /*if (iActivated) |
|
6424 { |
|
6425 iBridgerClient.SendBlind(KAlfCompositionLayoutSwitchComplete, TIpcArgs()); |
|
6426 } |
|
6427 */ |
|
6428 // request syncronized frame |
|
6429 iLayoutSwitchInProgress = EFalse; |
|
6430 if ( iHuiEnv ) |
|
6431 { |
|
6432 iIdForLayoutSwitchFrameSync = iIdForEAlfDSSynchronizeOp - KPreventingCollisionOfIdsInSynchDrawRequests; |
|
6433 iHuiEnv->Synchronize( iIdForLayoutSwitchFrameSync, this ); |
|
6434 } |
|
6435 } |
|
6436 |
|
6437 TAlfBridgeDrawerWrapper::TAlfBridgeDrawerWrapper(CAlfBridge& aBridge) |
|
6438 : iBridge( aBridge ) |
|
6439 { |
|
6440 } |
|
6441 |
|
6442 TInt TAlfBridgeDrawerWrapper::GetSizeAndRotation(TSize& aSize, TInt& aRotation) |
|
6443 { |
|
6444 return iBridge.GetSizeAndRotation(aSize, aRotation); |
|
6445 } |
|
6446 |
|
6447 TInt TAlfBridgeDrawerWrapper::ReadPixels(CFbsBitmap* aBitmap) |
|
6448 { |
|
6449 return iBridge.ReadPixels(aBitmap); |
|
6450 } |
|
6451 |
6115 // end of file |
6452 // end of file |