468 } |
460 } |
469 return NULL; |
461 return NULL; |
470 } |
462 } |
471 |
463 |
472 // --------------------------------------------------------------------------- |
464 // --------------------------------------------------------------------------- |
|
465 // FindControlGroupBySecureId |
473 // --------------------------------------------------------------------------- |
466 // --------------------------------------------------------------------------- |
474 // |
467 // |
475 CHuiControlGroup* CAlfBridge::FindControlGroupByAppId( TInt aAppId ) |
468 CHuiControlGroup* CAlfBridge::FindControlGroupBySecureId( TInt aSecureId, TInt aWgId ) const |
476 { |
469 { |
|
470 if ( aSecureId == 0 ) |
|
471 { |
|
472 return NULL; |
|
473 } |
|
474 |
477 for ( TInt i = 0; i < iAlfScreens[0]->iControlGroups.Count(); i++ ) |
475 for ( TInt i = 0; i < iAlfScreens[0]->iControlGroups.Count(); i++ ) |
478 { |
476 { |
479 if ( iAlfScreens[0]->iControlGroups[i].iSecureId == aAppId ) |
477 TAlfControlGroupEntry& groupEntry = iAlfScreens[0]->iControlGroups[i]; |
480 { |
478 if ( groupEntry.iSecureId == aSecureId ) |
481 return iAlfScreens[0]->iControlGroups[i].iControlGroup; |
479 { |
|
480 if ( aWgId != -1 ) |
|
481 { |
|
482 // match the window group as well |
|
483 if ( groupEntry.iClientWindowGroupId == aWgId ) |
|
484 { |
|
485 // found match |
|
486 return groupEntry.iControlGroup; |
|
487 } |
|
488 // found a matching SID, but the window group ID was incorrect. keep going... |
|
489 } |
|
490 else |
|
491 { |
|
492 // done for the day |
|
493 return groupEntry.iControlGroup; |
|
494 } |
482 } |
495 } |
483 } |
496 } |
484 return NULL; |
497 return NULL; |
485 } |
498 } |
486 |
499 |
487 // --------------------------------------------------------------------------- |
500 // --------------------------------------------------------------------------- |
|
501 // FindControlGroupByFullScreenToEffect |
|
502 // --------------------------------------------------------------------------- |
|
503 // |
|
504 CHuiControlGroup* CAlfBridge::FindControlGroupByFullScreenToEffect() const |
|
505 { |
|
506 if ( iFullScreenEffectData ) |
|
507 { |
|
508 return FindControlGroupBySecureId( iFullScreenEffectData->iToSecureId, iFullScreenEffectData->iToWg ); |
|
509 } |
|
510 return NULL; |
|
511 } |
|
512 |
|
513 // --------------------------------------------------------------------------- |
|
514 // FindControlGroupByFullScreenFromEffect |
|
515 // --------------------------------------------------------------------------- |
|
516 // |
|
517 CHuiControlGroup* CAlfBridge::FindControlGroupByFullScreenFromEffect() const |
|
518 { |
|
519 if ( iFullScreenEffectData ) |
|
520 { |
|
521 return FindControlGroupBySecureId( iFullScreenEffectData->iFromSecureId, iFullScreenEffectData->iFromWg ); |
|
522 } |
|
523 return NULL; |
|
524 } |
|
525 |
|
526 // --------------------------------------------------------------------------- |
488 // --------------------------------------------------------------------------- |
527 // --------------------------------------------------------------------------- |
489 // |
528 // |
490 |
529 |
491 void CAlfBridge::ListFamilyTreeL( RPointerArray<CHuiLayout>& aArray, const CHuiLayout* aLayout ) |
530 void CAlfBridge::ListFamilyTreeL( RPointerArray<CHuiLayout>& aArray, const CHuiLayout* aLayout ) |
492 { |
531 { |
1319 if (fullscreenCovered) |
1355 if (fullscreenCovered) |
1320 __ALFLOGSTRING("Full screen covered!"); |
1356 __ALFLOGSTRING("Full screen covered!"); |
1321 #endif |
1357 #endif |
1322 } |
1358 } |
1323 |
1359 |
|
1360 |
|
1361 // Dont mess with alf control group visuals, alf session handling does it for us |
|
1362 if (control.Role() == EAlfSessionContainer) |
|
1363 { |
|
1364 CHuiLayout* hostContainer = control.ContainerLayout( NULL ); |
|
1365 TInt flags = hostContainer->Flags(); |
|
1366 if (!fullscreenCovered) |
|
1367 { |
|
1368 // clear inactive flag if client has not made this controlgroup hidden |
|
1369 if(!(flags&EHuiVisualFlagUnderOpaqueHint)) |
|
1370 { |
|
1371 alfWindowGroupFoundVisible = ETrue; |
|
1372 if(iAppUi) |
|
1373 { |
|
1374 topMostAlfSrvSession = iAppUi->SrvSessionForControlGroup(controlgroup); |
|
1375 } |
|
1376 hostContainer->ClearFlags(EHuiVisualFlagInactive); |
|
1377 |
|
1378 // just add the rect to covered region because alf draws solid background |
|
1379 iTempRegion.AddRect(fullscreen); |
|
1380 iTempRegion.Tidy(); |
|
1381 fullscreenCovered = ETrue; |
|
1382 } |
|
1383 else // else put as inactive |
|
1384 { |
|
1385 hostContainer->SetFlags(EHuiVisualFlagInactive); |
|
1386 } |
|
1387 } |
|
1388 else if(!alfWindowGroupFoundVisible || flags&EHuiVisualFlagUnderOpaqueHint) |
|
1389 { |
|
1390 // this alf session control group should not be visible anymore because avkon application is on top |
|
1391 // -> change to inactive |
|
1392 hostContainer->SetFlags(EHuiVisualFlagInactive); |
|
1393 } |
|
1394 else if(!(flags&EHuiVisualFlagUnderOpaqueHint)) // alf app covers full screen |
|
1395 { |
|
1396 // check if current controlgroup belongs to same srvsession as the topmost visible alf session container |
|
1397 CAlfAppSrvSessionBase* alfsrvsession = NULL; |
|
1398 if(iAppUi) |
|
1399 { |
|
1400 alfsrvsession = iAppUi->SrvSessionForControlGroup(controlgroup); |
|
1401 } |
|
1402 if(topMostAlfSrvSession!=NULL && topMostAlfSrvSession == alfsrvsession) |
|
1403 { |
|
1404 hostContainer->ClearFlags(EHuiVisualFlagInactive); |
|
1405 } |
|
1406 else |
|
1407 { |
|
1408 hostContainer->SetFlags(EHuiVisualFlagInactive); |
|
1409 } |
|
1410 } |
|
1411 continue; |
|
1412 } |
|
1413 |
|
1414 |
|
1415 |
|
1416 |
1324 if (!fullscreenCovered) |
1417 if (!fullscreenCovered) |
1325 { |
1418 { |
1326 fullscreenCovered = screen->iDisplay->Roster().IsVisibleContentFrozen(); |
1419 fullscreenCovered = screen->iDisplay->Roster().IsVisibleContentFrozen(); |
1327 #ifdef ALF_DEBUG_PRINT_WINDOWGROUP_ORDER |
1420 #ifdef ALF_DEBUG_PRINT_WINDOWGROUP_ORDER |
1328 if (fullscreenCovered) |
1421 if (fullscreenCovered) |
1329 __ALFLOGSTRING("Full screen covered because of frozen roster content"); |
1422 __ALFLOGSTRING("Full screen covered because of frozen roster content"); |
1330 #endif |
1423 #endif |
1331 } |
1424 } |
1332 |
1425 |
1333 TBool subTreeCovered = EFalse; |
1426 TBool subTreeCovered = EFalse; |
1334 TBool hasActiveVisualsInVisualTree = HandleLayoutVisualVisibility( layout, controlgroup, control, fullscreenCovered, fullscreen, screen, subTreeCovered, IsVisualOpaque(*layout) ); |
1427 TBool hasLayers = EFalse; |
|
1428 TBool hasActiveVisualsInVisualTree = |
|
1429 HandleLayoutVisualVisibility( layout, controlgroup, control, |
|
1430 fullscreenCovered, fullscreen, screen, |
|
1431 subTreeCovered, hasLayers, IsVisualOpaque(*layout) ); |
1335 TBool hasFadeEffectsInVisualTree = (layout->CanvasFlags() & EHuiCanvasFlagExternalFadeExistsInsideVisualTree); |
1432 TBool hasFadeEffectsInVisualTree = (layout->CanvasFlags() & EHuiCanvasFlagExternalFadeExistsInsideVisualTree); |
1336 |
1433 |
1337 // If root visuals effect is marked as opaque, then add whole screen area as covered. |
1434 // If root visuals effect is marked as opaque, then add whole screen area as covered. |
1338 if (!fullscreenCovered) |
1435 if (!fullscreenCovered) |
1339 { |
1436 { |
1340 fullscreenCovered = IsOpaqueEffect(layout->Effect()); |
1437 fullscreenCovered = IsOpaqueEffect(layout->Effect()); |
1341 } |
1438 } |
1342 |
1439 |
|
1440 if ( hasLayers && iActivated ) |
|
1441 { |
|
1442 HandleLayerVisibility( layout, controlgroup, control, hasActiveVisualsInVisualTree ); |
|
1443 } |
|
1444 |
1343 // If we layout is active setup the fade effects. Also if it is inactive, but has been |
1445 // If we layout is active setup the fade effects. Also if it is inactive, but has been |
1344 // flagged as containing fade effect, then run the setup as well so that effects which |
1446 // flagged as containing fade effect, then run the setup as well so that effects which |
1345 // are no more needed get removed. |
1447 // are no more needed get removed. |
1346 if (hasActiveVisualsInVisualTree || (!hasActiveVisualsInVisualTree && hasFadeEffectsInVisualTree)) |
1448 if (hasActiveVisualsInVisualTree || (!hasActiveVisualsInVisualTree && hasFadeEffectsInVisualTree)) |
1347 { |
1449 { |
1362 { |
1464 { |
1363 layout->ClearCanvasFlags(EHuiCanvasFlagExternalFadeExistsInsideVisualTree); |
1465 layout->ClearCanvasFlags(EHuiCanvasFlagExternalFadeExistsInsideVisualTree); |
1364 } |
1466 } |
1365 } |
1467 } |
1366 |
1468 |
1367 if (!hasActiveVisualsInVisualTree) |
1469 TBool isLayoutActive = !(layout->Flags() & EHuiVisualFlagInactive); |
|
1470 if (isLayoutActive && !hasActiveVisualsInVisualTree) |
1368 { |
1471 { |
1369 // Setting also the root visual (layout) as inactive, if it had none |
1472 // Setting also the root visual (layout) as inactive, if it had none |
1370 // active children. This is because otherwise the Inactive checks won't |
1473 // active children. This is because otherwise the Inactive checks won't |
1371 // work correctly within RosterImpl ScanDirty & ClearChanged phases. |
1474 // work correctly within RosterImpl ScanDirty & ClearChanged phases. |
1372 layout->SetFlag(EHuiVisualFlagInactive); |
1475 layout->SetFlag(EHuiVisualFlagInactive); |
1373 } |
1476 } |
1374 else |
1477 else if(!isLayoutActive && hasActiveVisualsInVisualTree) |
1375 { |
1478 { |
1376 layout->ClearFlag(EHuiVisualFlagInactive); |
1479 layout->ClearFlag(EHuiVisualFlagInactive); |
|
1480 layout->SetPos(fullscreen.iTl); |
|
1481 layout->SetSize(fullscreen.Size()); |
1377 } |
1482 } |
1378 |
1483 |
1379 #ifdef ALF_DEBUG_PRINT_WINDOWGROUP_ORDER |
1484 #ifdef ALF_DEBUG_PRINT_WINDOWGROUP_ORDER |
1380 __ALFLOGSTRING1(">>>> HandleVisualVisibility: Control group index: %d", j ); |
1485 __ALFLOGSTRING1(">>>> HandleVisualVisibility: Control group index: %d", j ); |
1381 __ALFLOGSTRING1(">>>> HandleVisualVisibility: Active visuals : %d", activevisualcount ); |
1486 __ALFLOGSTRING1(">>>> HandleVisualVisibility: Active visuals : %d", activevisualcount ); |
1382 __ALFLOGSTRING1(">>>> HandleVisualVisibility: Passive visuals: %d", passivevisualcount ); |
1487 __ALFLOGSTRING1(">>>> HandleVisualVisibility: Passive visuals: %d", passivevisualcount ); |
1383 #endif |
1488 #endif |
1384 |
1489 |
1385 } |
1490 } |
1386 if (iBgSurfaceFound) |
1491 if (iActivated) |
1387 { |
1492 { |
1388 if (!iInLowMemMode) |
1493 if (iBgSurfaceFound) |
1389 { |
1494 { |
1390 SetLowMemory(ETrue); |
1495 if (!iInLowMemMode) |
1391 iBridgerClient.SendBlind(KAlfCompositionTargetHidden, TIpcArgs()); |
1496 { |
1392 iInLowMemMode = ETrue; |
1497 SetLowMemory(ETrue); |
1393 } |
1498 // Notify Bg anim |
1394 } |
1499 iBridgerClient.SendBlind(EAlfQueueRequestBGSessions, TIpcArgs(KAlfCompositionTargetHidden)); |
1395 else if (iInLowMemMode) |
1500 iInLowMemMode = ETrue; |
1396 { |
1501 } |
1397 SetLowMemory(EFalse); |
1502 } |
1398 iBridgerClient.SendBlind(KAlfCompositionTargetVisible, TIpcArgs()); |
1503 else if (iInLowMemMode) |
1399 iInLowMemMode = EFalse; |
1504 { |
1400 } |
1505 SetLowMemory(EFalse); |
1401 |
1506 // Notify Bg anim |
|
1507 iBridgerClient.SendBlind(EAlfQueueRequestBGSessions, TIpcArgs(KAlfCompositionTargetVisible)); |
|
1508 iInLowMemMode = EFalse; |
|
1509 } |
|
1510 } |
|
1511 |
|
1512 if ( iSwRenderingEnabled ) |
|
1513 { |
|
1514 screen->iDisplay->SetForegroundTextureOptions( alfWindowGroupFoundVisible ); |
|
1515 } |
1402 |
1516 |
1403 // Finally, if there are fadeeffects applied to windowgroups, make sure first one does not |
1517 // Finally, if there are fadeeffects applied to windowgroups, make sure first one does not |
1404 // blend itself, but other windowgroups do blend. Otherwise windowgrouops above others |
1518 // blend itself, but other windowgroups do blend. Otherwise windowgrouops above others |
1405 // would clear the screen areas where they do not really draw. |
1519 // would clear the screen areas where they do not really draw. |
1406 if (fadeEffectInScreen) |
1520 if (fadeEffectInScreen) |
1407 { |
1521 { |
1408 TBool firstFadedWindowGroupFound = EFalse; |
1522 TBool alwaysblend = EFalse; |
1409 for (TInt j=0; j<screen->iDisplay->Roster().Count() - screen->FixedControlGroupCount(); j++) // skip the topmost (effect) layer |
1523 for (TInt j=0; j<screen->iDisplay->Roster().Count() - screen->FixedControlGroupCount(); j++) // skip the topmost (effect) layer |
1410 { |
1524 { |
1411 CHuiControlGroup& controlgroup = iAlfScreens[aScreenNumber]->iDisplay->Roster().ControlGroup(j); |
1525 CHuiControlGroup& controlgroup = iAlfScreens[aScreenNumber]->iDisplay->Roster().ControlGroup(j); |
1412 CHuiControl& control = controlgroup.Control(0); |
1526 CHuiControl& control = controlgroup.Control(0); |
1413 CHuiVisual* layout = &control.Visual(0); |
1527 CHuiVisual* layout = &control.Visual(0); |
1414 if (layout->Effect() && (layout->Effect()->EffectFlags() & KHuiFadeEffectFlag)) |
1528 if (layout->Effect() && (layout->Effect()->EffectFlags() & KHuiFadeEffectFlag)) |
1415 { |
1529 { |
1416 if (firstFadedWindowGroupFound) |
1530 if (alwaysblend) |
1417 { |
1531 { |
1418 TInt flags = layout->Effect()->EffectFlags(); |
1532 TInt flags = layout->Effect()->EffectFlags(); |
1419 flags |= KHuiFxAlwaysBlend; // Workaround for opaque layout canvasvisual. |
1533 flags |= KHuiFxAlwaysBlend; // Workaround for opaque layout canvasvisual. |
1420 layout->Effect()->SetEffectFlags(flags); |
1534 layout->Effect()->SetEffectFlags(flags); |
1421 } |
1535 } |
1424 { |
1538 { |
1425 // Special handling for ALF fading...fading happens via empty alf originated event window group |
1539 // Special handling for ALF fading...fading happens via empty alf originated event window group |
1426 TInt flags = layout->Effect()->EffectFlags(); |
1540 TInt flags = layout->Effect()->EffectFlags(); |
1427 flags |= KHuiFxEnableBackgroundInAllLayers; // This forces effect to happen to background pixels that are read from surface. |
1541 flags |= KHuiFxEnableBackgroundInAllLayers; // This forces effect to happen to background pixels that are read from surface. |
1428 flags |= KHuiFxFrozenBackground; // To get optimal UI performance, we ignore changes in ALF scene when it is faded. |
1542 flags |= KHuiFxFrozenBackground; // To get optimal UI performance, we ignore changes in ALF scene when it is faded. |
|
1543 alwaysblend = ETrue; |
1429 layout->Effect()->SetEffectFlags(flags); |
1544 layout->Effect()->SetEffectFlags(flags); |
1430 } |
1545 } |
1431 |
1546 } |
1432 firstFadedWindowGroupFound = ETrue; |
1547 } |
1433 } |
1548 } |
1434 } |
|
1435 } |
|
1436 |
|
1437 AMT_FUNC_EXC(AMT_DATA()->iActiveVisualCount = iTempTotalActiveVisualCount; |
|
1438 AMT_DATA()->iPassiveVisualCount = iTempTotalPassiveVisualCount; |
|
1439 AMT_DATA()->PrintState() |
|
1440 ); |
|
1441 } |
1549 } |
1442 |
1550 |
1443 TBool CAlfBridge::HandleLayoutVisualVisibility( |
1551 TBool CAlfBridge::HandleLayoutVisualVisibility( |
1444 CHuiLayout* aLayout, |
1552 CHuiLayout* aLayout, |
1445 CHuiControlGroup& aControlGroup, |
1553 CHuiControlGroup& aControlGroup, |
1446 CHuiControl& aControl, |
1554 CHuiControl& aControl, |
1447 TBool& aFullscreenCovered, |
1555 TBool& aFullscreenCovered, |
1448 TRect& aFullscreen, |
1556 TRect& aFullscreen, |
1449 CAlfScreen* aScreen, |
1557 CAlfScreen* aScreen, |
1450 TBool& aSubtreeVisible, |
1558 TBool& aSubtreeVisible, |
|
1559 TBool& aHasVisualsWithLayers, |
1451 TBool aChildCanBeOpaque ) |
1560 TBool aChildCanBeOpaque ) |
1452 { |
1561 { |
1453 TBool visualTreeActive = EFalse; |
1562 TBool visualTreeActive = EFalse; |
1454 TRect visualDisplayRect; |
1563 TRect visualDisplayRect; |
1455 TBool visualRectIsCovered = EFalse; |
1564 TBool visualRectIsCovered = EFalse; |
1473 // Child can be considered to be opaque only if all parents are opaque and |
1582 // Child can be considered to be opaque only if all parents are opaque and |
1474 // visual itself is opaque. |
1583 // visual itself is opaque. |
1475 // For example, parent can have opacity < 1 and that affects children as well. |
1584 // For example, parent can have opacity < 1 and that affects children as well. |
1476 // As another example, parent can have scaling transformation. |
1585 // As another example, parent can have scaling transformation. |
1477 visualIsOpaque = aChildCanBeOpaque && IsVisualOpaque(*canvasVisual); |
1586 visualIsOpaque = aChildCanBeOpaque && IsVisualOpaque(*canvasVisual); |
|
1587 |
|
1588 if (!canvasVisual->LayerExtent().IsEmpty()) |
|
1589 { |
|
1590 aHasVisualsWithLayers = ETrue; |
|
1591 } |
|
1592 |
1478 if (canvasVisual->Count()) |
1593 if (canvasVisual->Count()) |
1479 { |
1594 { |
1480 visualTreeActive |= HandleLayoutVisualVisibility( canvasVisual, aControlGroup, aControl, aFullscreenCovered, aFullscreen, aScreen, visualSubtreeVisible, visualIsOpaque ); |
1595 visualTreeActive |= HandleLayoutVisualVisibility( canvasVisual, aControlGroup, aControl, |
|
1596 aFullscreenCovered, aFullscreen, aScreen, |
|
1597 visualSubtreeVisible, aHasVisualsWithLayers, visualIsOpaque ); |
1481 } |
1598 } |
1482 #ifdef HUI_DEBUG_TRACK_DRAWING |
1599 #ifdef HUI_DEBUG_TRACK_DRAWING |
1483 if ( canvasVisual->Tracking() ) |
1600 if ( canvasVisual->Tracking() ) |
1484 { |
1601 { |
1485 RDebug::Print(_L("CAlfBridge::HandleVisualVisibility: tracked visual 0x%x"), canvasVisual); |
1602 RDebug::Print(_L("CAlfBridge::HandleVisualVisibility: tracked visual 0x%x"), canvasVisual); |
1646 #ifdef ALF_DEBUG_PRINT_WINDOWGROUP_ORDER |
1758 #ifdef ALF_DEBUG_PRINT_WINDOWGROUP_ORDER |
1647 if (canvasVisual->PaintedAreaCount()) |
1759 if (canvasVisual->PaintedAreaCount()) |
1648 __ALFLOGSTRING2("Visual has painted areas: displayrect: iTl: %i, %i", visualDisplayRect.iTl.iX, visualDisplayRect.iTl.iY); |
1760 __ALFLOGSTRING2("Visual has painted areas: displayrect: iTl: %i, %i", visualDisplayRect.iTl.iX, visualDisplayRect.iTl.iY); |
1649 __ALFLOGSTRING2("Visual has painted areas: displayrect: iBr: %i, %i", visualDisplayRect.iBr.iX,visualDisplayRect.iBr.iY); |
1761 __ALFLOGSTRING2("Visual has painted areas: displayrect: iBr: %i, %i", visualDisplayRect.iBr.iX,visualDisplayRect.iBr.iY); |
1650 #endif |
1762 #endif |
|
1763 #ifndef ALF_OLD_VISIBILITY |
|
1764 // New visibility system takes only window shape into account. |
|
1765 if ( canvasVisual->CanvasFlags() & EHuiCanvasFlagIncludeToVisibilityCalculation ) |
|
1766 { |
|
1767 if ( !canvasVisual->HasCustomShape() ) |
|
1768 { |
|
1769 TRect displayRect(canvasVisual->DisplayRect()); |
|
1770 ClipVisualRect(displayRect, aFullscreen); |
|
1771 |
|
1772 #ifdef ALF_DEBUG_PRINT_WINDOWGROUP_ORDER |
|
1773 __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); |
|
1775 #endif |
|
1776 |
|
1777 iTempRegion.AddRect(displayRect); |
|
1778 iTempRegion.Tidy(); |
|
1779 } |
|
1780 else |
|
1781 { |
|
1782 TRect displayRect = canvasVisual->DisplayRect(); |
|
1783 const TRegion& region = canvasVisual->ShapeRegion(); |
|
1784 TPoint delta = -canvasVisual->ShapeOrigin() + displayRect.iTl; |
|
1785 |
|
1786 for (TInt i = 0; i < region.Count(); ++i) |
|
1787 { |
|
1788 TRect coveredRect(region[i]); |
|
1789 coveredRect.Move(delta); |
|
1790 ClipVisualRect(coveredRect, aFullscreen); |
|
1791 |
|
1792 #ifdef ALF_DEBUG_PRINT_WINDOWGROUP_ORDER |
|
1793 __ALFLOGSTRING2("Covered rect: iTl: %i, %i", coveredRect.iTl.iX, coveredRect.iTl.iY); |
|
1794 __ALFLOGSTRING2("Covered rect: iBr: %i, %i", coveredRect.iBr.iX, coveredRect.iBr.iY); |
|
1795 #endif |
|
1796 |
|
1797 iTempRegion.AddRect(coveredRect); |
|
1798 iTempRegion.Tidy(); |
|
1799 } |
|
1800 } |
|
1801 } |
|
1802 #else |
1651 for (TInt k=0; k < canvasVisual->PaintedAreaCount(); k++) |
1803 for (TInt k=0; k < canvasVisual->PaintedAreaCount(); k++) |
1652 { |
1804 { |
1653 THuiCanvasPaintedArea paintArea = canvasVisual->PaintedArea(k); |
1805 THuiCanvasPaintedArea paintArea = canvasVisual->PaintedArea(k); |
1654 TRect coveredRect = paintArea.iPaintedRect; |
1806 TRect coveredRect = paintArea.iPaintedRect; |
1655 |
1807 |
1671 // If effect is marked as opaque, then add whole visual area as covered. |
1823 // If effect is marked as opaque, then add whole visual area as covered. |
1672 if (IsOpaqueEffect(canvasVisual->Effect())) |
1824 if (IsOpaqueEffect(canvasVisual->Effect())) |
1673 { |
1825 { |
1674 iTempRegion.AddRect(visualDisplayRect); |
1826 iTempRegion.AddRect(visualDisplayRect); |
1675 iTempRegion.Tidy(); |
1827 iTempRegion.Tidy(); |
1676 } |
1828 } |
|
1829 #endif |
1677 } |
1830 } |
1678 visualTreeActive |= visualIsActive; |
1831 visualTreeActive |= visualIsActive; |
|
1832 |
|
1833 // iVisibleVisualCount is cleared in HandleVisualVisibility() |
|
1834 AMT_INC_COUNTER_IF( visualIsActive && !visualRectIsCovered , iVisibleVisualCount ); |
1679 } // for loop end : children checking loop |
1835 } // for loop end : children checking loop |
1680 |
1836 |
1681 return visualTreeActive; |
1837 return visualTreeActive; |
1682 } |
1838 } |
1683 |
1839 |
|
1840 |
|
1841 // --------------------------------------------------------------------------- |
|
1842 // --------------------------------------------------------------------------- |
|
1843 // |
|
1844 void CAlfBridge::HandleLayerVisibility( |
|
1845 CHuiLayout* aLayout, |
|
1846 CHuiControlGroup& aControlGroup, |
|
1847 CHuiControl& aControl, |
|
1848 TBool aVisible ) |
|
1849 { |
|
1850 CHuiCanvasVisual* canvasVisual = NULL; |
|
1851 |
|
1852 for (TInt i = aLayout->Count()-1; i >= 0; i--) |
|
1853 { |
|
1854 canvasVisual = (CHuiCanvasVisual*)(&aLayout->Visual(i)); |
|
1855 |
|
1856 if (canvasVisual->Count()) |
|
1857 { |
|
1858 HandleLayerVisibility( |
|
1859 canvasVisual, aControlGroup, |
|
1860 aControl, aVisible ); |
|
1861 } |
|
1862 |
|
1863 if (!canvasVisual->LayerExtent().IsEmpty()) |
|
1864 { |
|
1865 // Determine if surface is visible. |
|
1866 TBool surfaceWasVisible = ( canvasVisual->CanvasFlags() & EHuiCanvasFlagSurfaceVisible ); |
|
1867 TBool surfaceWasInvisible = ( canvasVisual->CanvasFlags() & EHuiCanvasFlagSurfaceInvisible ); |
|
1868 __ALFLOGSTRING2("CAlfBridge::HideTarget: %d %d", aVisible, surfaceWasVisible); |
|
1869 |
|
1870 TBool forcedUpdate = !surfaceWasVisible && !surfaceWasInvisible; |
|
1871 |
|
1872 if ( !aVisible && ( forcedUpdate || surfaceWasVisible ) ) |
|
1873 { |
|
1874 // notify surface observer that it has been hidden |
|
1875 __ALFLOGSTRING("CAlfBridge::HideTarget >>"); |
|
1876 TLex8 lex(canvasVisual->Tag()); |
|
1877 TInt windowId(0); |
|
1878 if (lex.Val(windowId) == KErrNone) |
|
1879 { |
|
1880 __ALFLOGSTRING1("CAlfBridge::HideTarget: WindowId: %d", windowId); |
|
1881 canvasVisual->SetCanvasFlags( EHuiCanvasFlagSurfaceInvisible ); |
|
1882 canvasVisual->ClearCanvasFlags( EHuiCanvasFlagSurfaceVisible ); |
|
1883 |
|
1884 iBridgerClient.SendBlind(EAlfPostDataToCompositionTarget, TIpcArgs(KAlfCompositionTargetHidden, windowId)); |
|
1885 iBridgerClient.SendBlind(EAlfPostDataToCompositionClient, TIpcArgs(KAlfCompositionTargetHidden, windowId)); |
|
1886 } |
|
1887 __ALFLOGSTRING("CAlfBridge::HideTarget <<"); |
|
1888 } |
|
1889 else if ( aVisible && ( forcedUpdate || surfaceWasInvisible ) ) |
|
1890 { |
|
1891 // notify surface observer that it has been hidden |
|
1892 __ALFLOGSTRING("CAlfBridge::ShowTarget >>"); |
|
1893 TLex8 lex(canvasVisual->Tag()); |
|
1894 TInt windowId(0); |
|
1895 if (lex.Val(windowId) == KErrNone) |
|
1896 { |
|
1897 __ALFLOGSTRING1("CAlfBridge::ShowTarget: WindowId: %d", windowId); |
|
1898 canvasVisual->ClearCanvasFlags( EHuiCanvasFlagSurfaceInvisible ); |
|
1899 canvasVisual->SetCanvasFlags( EHuiCanvasFlagSurfaceVisible ); |
|
1900 |
|
1901 iBridgerClient.SendBlind(EAlfPostDataToCompositionTarget, TIpcArgs(KAlfCompositionTargetVisible, windowId)); |
|
1902 iBridgerClient.SendBlind(EAlfPostDataToCompositionClient, TIpcArgs(KAlfCompositionTargetVisible, windowId)); |
|
1903 } |
|
1904 __ALFLOGSTRING("CAlfBridge::ShowTarget <<"); |
|
1905 } |
|
1906 else |
|
1907 { |
|
1908 // No change - ignore. |
|
1909 } |
|
1910 } |
|
1911 } // for loop end : children checking loop |
|
1912 } |
1684 |
1913 |
1685 // --------------------------------------------------------------------------- |
1914 // --------------------------------------------------------------------------- |
1686 // --------------------------------------------------------------------------- |
1915 // --------------------------------------------------------------------------- |
1687 // |
1916 // |
1688 void CAlfBridge::ClearCanvasVisualCommandSets(TBool aInactiveOnly) |
1917 void CAlfBridge::ClearCanvasVisualCommandSets(TBool aInactiveOnly) |
2452 } |
2708 } |
2453 else |
2709 else |
2454 { |
2710 { |
2455 __ALFLOGSTRING("CAlfBridge::HandleSetWindowOpacityL, EAlfDSSetWindowOpacity: Visual not found!"); |
2711 __ALFLOGSTRING("CAlfBridge::HandleSetWindowOpacityL, EAlfDSSetWindowOpacity: Visual not found!"); |
2456 } |
2712 } |
|
2713 } |
|
2714 |
|
2715 // --------------------------------------------------------------------------- |
|
2716 // HandleSetTransparencyAlphaChannel |
|
2717 // --------------------------------------------------------------------------- |
|
2718 // |
|
2719 void CAlfBridge::HandleSetTransparencyAlphaChannelL( TAlfBridgerData& aData ) |
|
2720 { |
|
2721 TInt windowNodeId = aData.iInt2; |
|
2722 TAlfWindowAttributes* windowAttributes = (TAlfWindowAttributes*) (*iHost)->GetVarDataL( (TInt)aData.iPtr ); |
|
2723 TInt screenNumber = windowAttributes->iScreenNumber; |
|
2724 // fetch visual |
|
2725 CHuiVisual* viz = FindVisual(windowNodeId); |
|
2726 if (viz) |
|
2727 { |
|
2728 #ifdef HUI_DEBUG_TRACK_DRAWING |
|
2729 if ( viz->Tracking() ) |
|
2730 { |
|
2731 RDebug::Print(_L("CAlfBridge::HandleSetTransparencyAlphaChannel - Tracked visual")); |
|
2732 } |
|
2733 #endif |
|
2734 if ( windowAttributes->iActive ) |
|
2735 { |
|
2736 viz->ClearFlag( EHuiVisualFlagOpaqueHint ); |
|
2737 } |
|
2738 else |
|
2739 { |
|
2740 viz->SetFlag( EHuiVisualFlagOpaqueHint ); |
|
2741 } |
|
2742 |
|
2743 iAlfScreens[screenNumber]->SetVisualTreeVisibilityChanged(ETrue); // TODO: Check if really changed |
|
2744 } |
|
2745 else |
|
2746 { |
|
2747 __ALFLOGSTRING("CAlfBridge::HandleSetTransparencyAlphaChannel, EAlfDSSetTransparencyAlphaChannel: Visual not found!"); |
|
2748 } |
|
2749 } |
|
2750 |
|
2751 // --------------------------------------------------------------------------- |
|
2752 // HandleSetWindowAreaL |
|
2753 // --------------------------------------------------------------------------- |
|
2754 // |
|
2755 void CAlfBridge::HandleIncludeToVisibilityCalculationL( TAlfBridgerData& aData ) |
|
2756 { |
|
2757 TInt windowNodeId = aData.iInt2; |
|
2758 TAlfWindowAttributes* windowAttributes = (TAlfWindowAttributes*) (*iHost)->GetVarDataL( (TInt)aData.iPtr ); |
|
2759 TInt screenNumber = windowAttributes->iScreenNumber; |
|
2760 // fetch visual |
|
2761 CHuiVisual* viz = FindVisual(windowNodeId); |
|
2762 if (viz) |
|
2763 { |
|
2764 #ifdef HUI_DEBUG_TRACK_DRAWING |
|
2765 if ( viz->Tracking() ) |
|
2766 { |
|
2767 RDebug::Print(_L("CAlfBridge::HandleIncludeToVisibilityCalculationL - Tracked visual")); |
|
2768 } |
|
2769 #endif |
|
2770 if ( windowAttributes->iWindowNodeType == EAlfWinTreeNodeClient ) |
|
2771 { |
|
2772 CHuiCanvasVisual* canvasVisual = static_cast<CHuiCanvasVisual*>(viz); |
|
2773 |
|
2774 if ( windowAttributes->iActive ) |
|
2775 { |
|
2776 canvasVisual->SetCanvasFlags( EHuiCanvasFlagIncludeToVisibilityCalculation ); |
|
2777 } |
|
2778 else |
|
2779 { |
|
2780 canvasVisual->ClearCanvasFlags( EHuiCanvasFlagIncludeToVisibilityCalculation ); |
|
2781 } |
|
2782 } |
|
2783 |
|
2784 iAlfScreens[screenNumber]->SetVisualTreeVisibilityChanged(ETrue); // TODO: Check if really changed |
|
2785 } |
|
2786 else |
|
2787 { |
|
2788 __ALFLOGSTRING("CAlfBridge::HandleIncludeToVisibilityCalculationL, EAlfDSIncludeToVisibilityCalculation: Visual not found!"); |
|
2789 } |
|
2790 } |
|
2791 |
|
2792 // --------------------------------------------------------------------------- |
|
2793 // HandleSetWindowAreaL |
|
2794 // --------------------------------------------------------------------------- |
|
2795 // |
|
2796 void CAlfBridge::HandleSetWindowAreaL( TAlfBridgerData& aData ) |
|
2797 { |
|
2798 TInt windowNodeId = aData.iInt2; |
|
2799 TAny* ptr = (TAny*)(*iHost)->GetVarDataL( (TInt)aData.iPtr ); |
|
2800 |
|
2801 TInt screenNumber = 0; |
|
2802 TPoint origin; |
|
2803 TInt count = 0; |
|
2804 RRegion region; |
|
2805 CleanupClosePushL( region ); |
|
2806 |
|
2807 { |
|
2808 RMemReadStream str(ptr, 4*sizeof(TInt32)); |
|
2809 screenNumber = str.ReadInt32L(); |
|
2810 origin.iX = str.ReadInt32L(); |
|
2811 origin.iY = str.ReadInt32L(); |
|
2812 count = str.ReadInt32L(); |
|
2813 str.Release(); |
|
2814 } |
|
2815 |
|
2816 if ( count > 0 ) |
|
2817 { |
|
2818 RMemReadStream str(((TUint8*)ptr) + 4*sizeof(TInt32), 4*sizeof(TInt32)*count); |
|
2819 TRect rect; |
|
2820 for (TInt i = 0; i < count; ++i) |
|
2821 { |
|
2822 rect.iTl.iX = str.ReadInt32L(); |
|
2823 rect.iTl.iY = str.ReadInt32L(); |
|
2824 rect.iBr.iX = str.ReadInt32L(); |
|
2825 rect.iBr.iY = str.ReadInt32L(); |
|
2826 region.AddRect(rect); |
|
2827 } |
|
2828 str.Release(); |
|
2829 } |
|
2830 |
|
2831 |
|
2832 // fetch visual |
|
2833 CHuiVisual* viz = FindVisual(windowNodeId); |
|
2834 if (viz) |
|
2835 { |
|
2836 #ifdef HUI_DEBUG_TRACK_DRAWING |
|
2837 if ( viz->Tracking() ) |
|
2838 { |
|
2839 RDebug::Print(_L("CAlfBridge::HandleSetWindowAreaL - Tracked visual")); |
|
2840 } |
|
2841 #endif |
|
2842 |
|
2843 |
|
2844 CHuiCanvasVisual* canvas = static_cast<CHuiCanvasVisual*>(viz); |
|
2845 canvas->SetShape( origin, region ); |
|
2846 |
|
2847 iAlfScreens[screenNumber]->SetVisualTreeVisibilityChanged(ETrue); |
|
2848 } |
|
2849 else |
|
2850 { |
|
2851 __ALFLOGSTRING("CAlfBridge::HandleSetWindowAreaL, EAlfDSSetWindowArea: Visual not found!"); |
|
2852 } |
|
2853 |
|
2854 CleanupStack::PopAndDestroy(); |
2457 } |
2855 } |
2458 |
2856 |
2459 // --------------------------------------------------------------------------- |
2857 // --------------------------------------------------------------------------- |
2460 // HandleReorderWindowL |
2858 // HandleReorderWindowL |
2461 // --------------------------------------------------------------------------- |
2859 // --------------------------------------------------------------------------- |
2665 #ifdef USE_APPLICATION_ENDFULLSCREEN_TIMEOUT |
3063 #ifdef USE_APPLICATION_ENDFULLSCREEN_TIMEOUT |
2666 if (iFullScreenEffectData |
3064 if (iFullScreenEffectData |
2667 && iFullScreenEffectData->iEffectType != CFullScreenEffectState::ENotDefinedEffect |
3065 && iFullScreenEffectData->iEffectType != CFullScreenEffectState::ENotDefinedEffect |
2668 && !iFullScreenEffectData->iEndFullScreen) |
3066 && !iFullScreenEffectData->iEndFullScreen) |
2669 { |
3067 { |
2670 TInt toAppUid; |
3068 |
|
3069 CHuiControlGroup *to_group = NULL; |
2671 if (iFullScreenEffectData->iEffectType == CFullScreenEffectState::EExitEffect) |
3070 if (iFullScreenEffectData->iEffectType == CFullScreenEffectState::EExitEffect) |
2672 { |
3071 { |
2673 toAppUid = iFullScreenEffectData->iFromAppId; |
3072 to_group = FindControlGroupByFullScreenFromEffect(); |
2674 } |
3073 } |
2675 else |
3074 else |
2676 { |
3075 { |
2677 toAppUid = iFullScreenEffectData->iToAppId; |
3076 to_group = FindControlGroupByFullScreenToEffect(); |
2678 } |
3077 } |
2679 |
3078 |
2680 CHuiControlGroup *to_group = FindControlGroupByAppId(toAppUid); |
|
2681 |
3079 |
2682 // 1. if we get drawing commands after BeginFullScreen, we need to generate EndFullScreen call. |
3080 // 1. if we get drawing commands after BeginFullScreen, we need to generate EndFullScreen call. |
2683 // 2. only the first drawing commands will trigger EndFullScreen |
3081 // 2. only the first drawing commands will trigger EndFullScreen |
2684 // (this mechanism is here because we want to remove delay from fullscreen effects - and EndFullScreens are coming from application too late) |
3082 // (this mechanism is here because we want to remove delay from fullscreen effects - and EndFullScreens are coming from application too late) |
2685 |
3083 |
2686 if (viz->Owner().ControlGroup() == to_group) |
3084 if (viz->Owner().ControlGroup() == to_group) |
2687 { |
3085 { |
2688 iFullScreenEffectData->ResetTimerL(this); |
3086 if (!iFullScreenEffectData->iDrawingCompleteTimer) |
2689 iFullScreenEffectData->iDisplaySize = iAlfScreens[0]->Size(); |
3087 { |
|
3088 iFullScreenEffectData->InitDelayedEffectL(this, iAlfScreens[0]->Size()); |
|
3089 } |
2690 THuiCanvasPaintedArea p = viz->PaintedArea(0); |
3090 THuiCanvasPaintedArea p = viz->PaintedArea(0); |
2691 iFullScreenEffectData->iPaintedRegion.AddRect( p.iPaintedRect.Round() ); |
3091 iFullScreenEffectData->iPaintedRegion.AddRect( p.iPaintedRect.Round() ); |
2692 TRect b = iFullScreenEffectData->iPaintedRegion.BoundingRect(); |
3092 TRect b = iFullScreenEffectData->iPaintedRegion.BoundingRect(); |
2693 __ALFFXLOGSTRING3( |
3093 __ALFFXLOGSTRING3( |
2694 "CAlfBridge::HandlePostCanvasBufferL : Effect to visual 0x%x, Covered rect: iTl.iX: %d , iTl.iY: %d", |
3094 "CAlfBridge::HandlePostCanvasBufferL : Effect to visual 0x%x, Covered rect: iTl.iX: %d , iTl.iY: %d", |
3716 TRAP(err,StoreRenderBufferStartL(aToLayout)); |
4138 TRAP(err,StoreRenderBufferStartL(aToLayout)); |
3717 __ALFFXLOGSTRING1("CAlfBridge::HandleGfxEventL - EBeginFullScreen: Screenshot result: KErrNone == %d", err); |
4139 __ALFFXLOGSTRING1("CAlfBridge::HandleGfxEventL - EBeginFullScreen: Screenshot result: KErrNone == %d", err); |
3718 if (err == KErrNone) |
4140 if (err == KErrNone) |
3719 { |
4141 { |
3720 aToLayout->SetFreezeState(ETrue); |
4142 aToLayout->SetFreezeState(ETrue); |
|
4143 aEvent.iCanDestroyOrHideImmediately = ETrue; // if children of this layout are hidden or destroyed during effect, that can happen immediately |
3721 } |
4144 } |
3722 else |
4145 else |
3723 { |
4146 { |
3724 return ETrue; // failed, effect will be canceled |
4147 return ETrue; // failed, effect will be canceled |
3725 } |
4148 } |
3726 } |
4149 } |
3727 |
4150 |
3728 switch(aEvent.iAction) |
4151 switch(aEvent.iAction) |
3729 { |
4152 { |
|
4153 case AknTransEffect::EApplicationActivate: |
3730 case AknTransEffect::EApplicationStart: |
4154 case AknTransEffect::EApplicationStart: |
3731 case AknTransEffect::EApplicationStartRect: |
4155 case AknTransEffect::EApplicationStartRect: |
|
4156 case AknTransEffect::EApplicationStartSwitch: |
|
4157 case AknTransEffect::EApplicationStartSwitchRect: |
3732 { |
4158 { |
3733 aToLayout->iOpacity.Set(0.0f); // these are meant for applications that yet dont have anything to show |
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 |
3734 FreezeLayoutUntilEffectDestroyedL(aFromLayout, aEvent.iHandle); |
4160 FreezeLayoutUntilEffectDestroyedL(aFromLayout, aEvent.iHandle); |
3735 aEvent.iEffectType = CFullScreenEffectState::EStartEffect; |
4161 aEvent.iEffectType = CFullScreenEffectState::EStartEffect; |
3736 break; |
4162 break; |
3737 } |
4163 } |
3738 case AknTransEffect::EApplicationStartSwitch: |
|
3739 case AknTransEffect::EApplicationStartSwitchRect: |
|
3740 { |
|
3741 aToLayout->iOpacity.Set(0.0f); // this is meant for applications that are in the background. |
|
3742 FreezeLayoutUntilEffectDestroyedL(aFromLayout, aEvent.iHandle); |
|
3743 aEvent.iEffectType = CFullScreenEffectState::EStartEffect; |
|
3744 break; |
|
3745 } |
|
3746 |
|
3747 case AknTransEffect::EApplicationExit: |
4164 case AknTransEffect::EApplicationExit: |
3748 { |
4165 { |
3749 aEvent.iEffectType = CFullScreenEffectState::EExitEffect; |
4166 aEvent.iEffectType = CFullScreenEffectState::EExitEffect; |
3750 // The effect should start when the new view is ready, |
4167 // The effect should start when the new view is ready, |
3751 // but we have no signal telling us that, so we just have to do our best |
4168 // but we have no signal telling us that, so we just have to do our best |
4079 |
4507 |
4080 // This effect is triggered either by BeginFullScreen or by EndFullScreen |
4508 // This effect is triggered either by BeginFullScreen or by EndFullScreen |
4081 // depending on if we have an application that is already running or not |
4509 // depending on if we have an application that is already running or not |
4082 |
4510 |
4083 // TAlfControlGroupEntry* alfGroup = NULL; |
4511 // TAlfControlGroupEntry* alfGroup = NULL; |
4084 // TODO: |
|
4085 //wg1 = (*iHost)->FindWgForAppUid(TUid::Uid(toAppId1)); |
|
4086 //if (!wg1 && action != AknTransEffect::EApplicationExit ) |
|
4087 // { |
|
4088 // // window group is not available yet, but it will be created in short while. |
|
4089 // iEffectWaitingWindowgroup.Append(toAppId1); |
|
4090 // } |
|
4091 // TODO: when ids available from wserv... |
|
4092 // if ( appUid1 ) |
|
4093 //{ |
|
4094 // group1 = FindControlGrouAppUId( appUid1, screen1, &alfGroup ); |
|
4095 // } |
|
4096 |
4512 |
4097 TBool failed = EFalse; |
4513 TBool failed = EFalse; |
4098 if (fxData->iToAppId && fxData->iToAppId != KErrNotFound) |
4514 if (fxData->iToAppId && fxData->iToAppId != KErrNotFound) |
4099 { |
4515 { |
4100 CHuiControlGroup* toGroup = NULL; |
4516 CHuiControlGroup* toGroup = NULL; |
4101 CHuiLayout* toLayout = NULL; |
4517 CHuiLayout* toLayout = NULL; |
4102 toGroup = FindControlGroupByAppId(fxData->iToAppId); |
4518 toGroup = FindControlGroupByFullScreenToEffect(); |
4103 |
4519 |
4104 CHuiControlGroup* fromGroup = NULL; |
4520 CHuiControlGroup* fromGroup = NULL; |
4105 CHuiLayout* fromLayout = NULL; |
4521 CHuiLayout* fromLayout = NULL; |
4106 fromGroup = FindControlGroupByAppId(fxData->iFromAppId); |
4522 fromGroup = FindControlGroupByFullScreenFromEffect(); |
4107 |
4523 |
4108 if (!toGroup) // group has been destroyed and moved to effectControlGroup for waiting the application exit effect EndFullScreen trigger |
4524 if (!toGroup) // group has been destroyed and moved to effectControlGroup for waiting the application exit effect EndFullScreen trigger |
4109 { |
4525 { |
4110 toLayout = FindLayoutByEffectHandle(fxData->iHandle); |
4526 toLayout = FindLayoutByEffectHandle(fxData->iHandle); |
4111 } |
4527 } |
4308 CHuiLayout* aSourceLayout, |
4748 CHuiLayout* aSourceLayout, |
4309 CHuiLayout* aTargetLayout, |
4749 CHuiLayout* aTargetLayout, |
4310 CHuiControl* aEffectControl, |
4750 CHuiControl* aEffectControl, |
4311 TInt& aItemsDestroyed, |
4751 TInt& aItemsDestroyed, |
4312 TBool aAddLayout, |
4752 TBool aAddLayout, |
4313 TBool aIsExitEffect) |
4753 TBool aIsExitEffect, |
|
4754 TBool aCanDestroyOrHideImmediately) |
4314 { |
4755 { |
4315 __ALFFXLOGSTRING2("CAlfBridge::AddToEffectLayoutContainerL 0x%x is having %d children", aSourceLayout, aSourceLayout->Count()); |
4756 __ALFFXLOGSTRING2("CAlfBridge::AddToEffectLayoutContainerL 0x%x is having %d children", aSourceLayout, aSourceLayout->Count()); |
4316 if (aAddLayout) |
4757 if (aAddLayout) |
4317 { |
4758 { |
4318 AddEffectItemL(aEffectHandle, aSourceLayout, aTargetLayout, aEffectControl, EFalse, aItemsDestroyed, aIsExitEffect); |
4759 AddEffectItemL(aEffectHandle, aSourceLayout, aTargetLayout, aEffectControl, EFalse, aItemsDestroyed, aIsExitEffect, aCanDestroyOrHideImmediately); |
4319 } |
4760 } |
4320 |
4761 |
4321 for (TInt i = 0; i < aSourceLayout->Count(); i++) |
4762 for (TInt i = 0; i < aSourceLayout->Count(); i++) |
4322 { |
4763 { |
4323 CHuiCanvasVisual& sourceVisual = static_cast<CHuiCanvasVisual&> (aSourceLayout->Visual(i)); |
4764 CHuiCanvasVisual& sourceVisual = static_cast<CHuiCanvasVisual&> (aSourceLayout->Visual(i)); |
4324 |
4765 |
4325 if (sourceVisual.Count()) |
4766 if (sourceVisual.Count()) |
4326 { |
4767 { |
4327 CHuiLayout& layout = static_cast<CHuiLayout&> (aSourceLayout->Visual(i)); |
4768 CHuiLayout& layout = static_cast<CHuiLayout&> (aSourceLayout->Visual(i)); |
4328 AddToEffectLayoutContainerL(aEffectHandle, &layout, NULL, aEffectControl, aItemsDestroyed, EFalse,aIsExitEffect ); |
4769 AddToEffectLayoutContainerL(aEffectHandle, &layout, NULL, aEffectControl, aItemsDestroyed, EFalse,aIsExitEffect, aCanDestroyOrHideImmediately ); |
4329 } |
4770 } |
4330 AddEffectItemL(aEffectHandle, &sourceVisual, aTargetLayout, aEffectControl, EFalse, aItemsDestroyed, aIsExitEffect); |
4771 AddEffectItemL(aEffectHandle, &sourceVisual, aTargetLayout, aEffectControl, EFalse, aItemsDestroyed, aIsExitEffect, aCanDestroyOrHideImmediately); |
4331 } |
4772 } |
4332 __ALFFXLOGSTRING2("CAlfBridge::AddToEffectLayoutContainerL 0x%x end of children", aSourceLayout, aSourceLayout->Count()); |
4773 __ALFFXLOGSTRING2("CAlfBridge::AddToEffectLayoutContainerL 0x%x end of children", aSourceLayout, aSourceLayout->Count()); |
4333 } |
4774 } |
4334 |
4775 |
4335 TBool CAlfBridge::SetupEffectLayoutContainerL(TInt aHandle,CHuiLayout* aSourceLayout, TBool aIsExitEffect) |
4776 TBool CAlfBridge::SetupEffectLayoutContainerL(TInt aHandle,CHuiLayout* aSourceLayout, TBool aIsExitEffect, TBool aCanDestroyOrHideImmediately) |
4336 { |
4777 { |
4337 __ALFFXLOGSTRING3("CAlfBridge::SetupEffectLayoutContainerL - aHandle: %d, aSourceLayout: 0x%x, aIsExitEffect: % d >>", aHandle, aSourceLayout, aIsExitEffect ); |
4778 __ALFFXLOGSTRING4("CAlfBridge::SetupEffectLayoutContainerL - aHandle: %d, aSourceLayout: 0x%x, aIsExitEffect: % d, CanDestroyOrHideImmediately: %d >>", |
|
4779 aHandle, |
|
4780 aSourceLayout, |
|
4781 aIsExitEffect, |
|
4782 aCanDestroyOrHideImmediately ); |
4338 |
4783 |
4339 if (aSourceLayout->Flags() & EHuiVisualFlagDrawOnlyAsExternalContent) |
4784 if (aSourceLayout->Flags() & EHuiVisualFlagDrawOnlyAsExternalContent) |
4340 { |
4785 { |
4341 // the requested visual is already having an effect. |
4786 // the requested visual is already having an effect. |
4342 __ALFFXLOGSTRING("CAlfBridge::SetupEffectLayoutContainerL - WE ARE ALREADY HAVING EFFECT! WHAT TO DO??"); |
4787 __ALFFXLOGSTRING("CAlfBridge::SetupEffectLayoutContainerL - WE ARE ALREADY HAVING EFFECT! WHAT TO DO??"); |
4347 CHuiLayout& effectControlGroupLayout = (CHuiLayout&) effectControlGroup.Visual(0); |
4792 CHuiLayout& effectControlGroupLayout = (CHuiLayout&) effectControlGroup.Visual(0); |
4348 |
4793 |
4349 // CHuiCanvasVisual* temporaryPresenterLayout = CHuiCanvasVisual::AddNewL( effectControlGroup, &effectControlGroupLayout); |
4794 // CHuiCanvasVisual* temporaryPresenterLayout = CHuiCanvasVisual::AddNewL( effectControlGroup, &effectControlGroupLayout); |
4350 // create presenter visual and set bindings |
4795 // create presenter visual and set bindings |
4351 TInt itemsDestroyed(0); |
4796 TInt itemsDestroyed(0); |
4352 AddToEffectLayoutContainerL(aHandle, aSourceLayout, NULL, &effectControlGroup, itemsDestroyed, EFalse, aIsExitEffect); |
4797 AddToEffectLayoutContainerL(aHandle, aSourceLayout, NULL, &effectControlGroup, itemsDestroyed, EFalse, aIsExitEffect, aCanDestroyOrHideImmediately); |
4353 |
4798 |
4354 if (aIsExitEffect) |
4799 if (aIsExitEffect) |
4355 { |
4800 { |
4356 CHuiCanvasVisual* temporaryPresenterVisual = AddEffectItemL(aHandle, aSourceLayout, &effectControlGroupLayout, &effectControlGroup, ETrue, itemsDestroyed, aIsExitEffect); |
4801 CHuiCanvasVisual* temporaryPresenterVisual = AddEffectItemL(aHandle, aSourceLayout, &effectControlGroupLayout, &effectControlGroup, ETrue, itemsDestroyed, aIsExitEffect, EFalse); |
4357 aSourceLayout->SetFlag(EHuiVisualFlagDrawOnlyAsExternalContent); |
4802 aSourceLayout->SetFlag(EHuiVisualFlagDrawOnlyAsExternalContent); |
4358 __ALFFXLOGSTRING3("CAlfBridge::SetupEffectLayoutContainerL - adding handle: %d, 0x%x (source layout)-> 0x%x (presenter layout) to iEffectCleanupStack", aHandle, aSourceLayout, temporaryPresenterVisual); |
4803 __ALFFXLOGSTRING3("CAlfBridge::SetupEffectLayoutContainerL - adding handle: %d, 0x%x (source layout)-> 0x%x (presenter layout) to iEffectCleanupStack", aHandle, aSourceLayout, temporaryPresenterVisual); |
4359 } |
4804 } |
4360 else |
4805 else |
4361 { |
4806 { |
4362 AddEffectItemL(aHandle, aSourceLayout, NULL, &effectControlGroup, EFalse, itemsDestroyed, EFalse); |
4807 AddEffectItemL(aHandle, aSourceLayout, NULL, &effectControlGroup, EFalse, itemsDestroyed, EFalse, EFalse); |
4363 __ALFFXLOGSTRING2("CAlfBridge::SetupEffectLayoutContainerL - adding handle: %d, 0x%x (source layout), NO presenter layout) to iEffectCleanupStack", aHandle, aSourceLayout); |
4808 __ALFFXLOGSTRING2("CAlfBridge::SetupEffectLayoutContainerL - adding handle: %d, 0x%x (source layout), NO presenter layout) to iEffectCleanupStack", aHandle, aSourceLayout); |
4364 } |
4809 } |
4365 iAlfScreens[0]->iVisualTreeVisibilityChanged = ETrue; |
4810 iAlfScreens[0]->iVisualTreeVisibilityChanged = ETrue; |
4366 iAlfScreens[0]->iDisplay->SetDirty(); |
4811 iAlfScreens[0]->iDisplay->SetDirty(); |
4367 if (itemsDestroyed) |
4812 if (itemsDestroyed) |
4368 { |
4813 { |
4369 __ALFFXLOGSTRING3("CAlfBridge::SetupEffectLayoutContainerL - trying to put effect on destroyed visuals. Skipping effect visual: 0x%x, handle %d, %d items destroyed", aSourceLayout, aHandle, itemsDestroyed); |
4814 __ALFFXLOGSTRING3("CAlfBridge::SetupEffectLayoutContainerL - trying to put effect on destroyed visuals. Skipping effect visual: 0x%x, handle %d, %d items destroyed", aSourceLayout, aHandle, itemsDestroyed); |
4370 } |
4815 } |
4371 __ALFFXLOGSTRING("CAlfBridge::SetupEffectLayoutContainerL"); |
4816 __ALFFXLOGSTRING("CAlfBridge::SetupEffectLayoutContainerL"); |
4372 return ETrue; // TBool(!itemsDestroyed); |
4817 return ETrue; // TBool(!itemsDestroyed); |
4373 } |
|
4374 |
|
4375 void CAlfBridge::SetupEffectContainerL(TInt aHandle, |
|
4376 CHuiCanvasVisual* aSourceVisual, TBool aIsExitEffect) |
|
4377 { |
|
4378 // if the original visual is having an effect, then remove it. |
|
4379 if (HasActiveEffect(aSourceVisual)) |
|
4380 { |
|
4381 RemoveTemporaryPresenterVisual(aSourceVisual); |
|
4382 } |
|
4383 |
|
4384 // Create new temporary presenter visual for the effect |
|
4385 CHuiControl& effectControlGroup = |
|
4386 iAlfScreens[0]->iFullscreenEffectControlGroup->Control(0); |
|
4387 CHuiLayout* layout = (CHuiLayout*) &effectControlGroup.Visual(0); |
|
4388 CHuiCanvasVisual* temporaryPresenterVisual = NULL; |
|
4389 temporaryPresenterVisual = CHuiCanvasVisual::AddNewL(effectControlGroup, layout); |
|
4390 // attach the source to the presenter visual |
|
4391 temporaryPresenterVisual->SetExternalContentL(aSourceVisual); |
|
4392 aSourceVisual->SetFlag(EHuiVisualFlagDrawOnlyAsExternalContent); |
|
4393 temporaryPresenterVisual->ClearFlag(EHuiVisualFlagInactive); |
|
4394 aSourceVisual->SetChanged(); |
|
4395 // append to cleanup stack. this is cleaned in RemoveTemporaryVisuals after effect has finished |
|
4396 iEffectCleanupStack.AppendL(TEffectCleanupStruct(aHandle, aSourceVisual, temporaryPresenterVisual, EFalse /*iIsLayout*/, aIsExitEffect)); |
|
4397 __ALFFXLOGSTRING3("CAlfBridge::SetupEffectContainerL - adding handle: %d, 0x%x (source visual)-> 0x%x (presenter visual)", aHandle, aSourceVisual, temporaryPresenterVisual); |
|
4398 } |
4818 } |
4399 |
4819 |
4400 void CAlfBridge::HandleGfxControlEffectsL( TAlfBridgerData data ) |
4820 void CAlfBridge::HandleGfxControlEffectsL( TAlfBridgerData data ) |
4401 { |
4821 { |
4402 TInt action = data.iInt1; |
4822 TInt action = data.iInt1; |
4741 TInt itemsRemoved(0); |
5158 TInt itemsRemoved(0); |
4742 CHuiControl& effectControlGroup = iAlfScreens[0]->iFullscreenEffectControlGroup->Control(0); |
5159 CHuiControl& effectControlGroup = iAlfScreens[0]->iFullscreenEffectControlGroup->Control(0); |
4743 CHuiLayout* effectControlGroupLayout = (CHuiLayout*) &effectControlGroup.Visual(0); |
5160 CHuiLayout* effectControlGroupLayout = (CHuiLayout*) &effectControlGroup.Visual(0); |
4744 __ALFFXLOGSTRING1("CAlfBridge::RemoveTemporaryPresenterVisuals - BEGIN - effects in layout %d", effectControlGroupLayout->Count()); |
5161 __ALFFXLOGSTRING1("CAlfBridge::RemoveTemporaryPresenterVisuals - BEGIN - effects in layout %d", effectControlGroupLayout->Count()); |
4745 |
5162 |
4746 while (iFinishedCleanupStackEffects.Count()) |
5163 while(iFinishedCleanupStackEffects.Count()) |
4747 { |
5164 { |
4748 for (TInt i = 0; i < iEffectCleanupStack.Count() && iFinishedCleanupStackEffects.Count(); i++) |
5165 for (TInt i = 0; i < iEffectCleanupStack.Count() ; i++) |
4749 { |
5166 { |
4750 __ALFFXLOGSTRING2("CAlfBridge::RemoveTemporaryPresenterVisuals - looping, finished count: %d, index in active effecs: %d", iFinishedCleanupStackEffects.Count(), i ); |
5167 __ALFFXLOGSTRING2("CAlfBridge::RemoveTemporaryPresenterVisuals - looping, finished count: %d, index in active effecs: %d", iFinishedCleanupStackEffects.Count(), i ); |
4751 |
|
4752 TEffectCleanupStruct& effectItem = iEffectCleanupStack[i]; |
5168 TEffectCleanupStruct& effectItem = iEffectCleanupStack[i]; |
|
5169 |
4753 if (iFinishedCleanupStackEffects[0] == effectItem.iHandle) |
5170 if (iFinishedCleanupStackEffects[0] == effectItem.iHandle) |
4754 { |
5171 { |
4755 if (RemoveTemporaryPresenterItem(effectItem)) |
5172 if (RemoveTemporaryPresenterItem(effectItem)) |
4756 { |
5173 { |
4757 itemsRemoved++; |
5174 itemsRemoved++; |
4758 } |
5175 } |
4759 if (iEffectCleanupStack.Count() > i) |
5176 if (iEffectCleanupStack.Count() > i) |
4760 { |
5177 { |
4761 iEffectCleanupStack.Remove(i); |
5178 iEffectCleanupStack.Remove(i); |
|
5179 break; |
4762 } |
5180 } |
4763 iFinishedCleanupStackEffects.Remove(0); |
5181 } |
4764 i--; |
5182 } |
4765 } |
5183 iFinishedCleanupStackEffects.Remove(0); |
4766 } |
5184 } |
4767 } |
5185 |
|
5186 if (iFinishedCleanupStackEffects.Count()) |
|
5187 { |
|
5188 __ALFFXLOGSTRING1("CAlfBridge::RemoveTemporaryPresenterVisuals - There are still %d finished effects, that could not be found. They have been cleaned already. Reseting the array", iFinishedCleanupStackEffects.Count()); |
|
5189 iFinishedCleanupStackEffects.Reset(); |
|
5190 } |
|
5191 |
4768 iAlfScreens[0]->iVisualTreeVisibilityChanged = ETrue; // TODO: Check if really changed |
5192 iAlfScreens[0]->iVisualTreeVisibilityChanged = ETrue; // TODO: Check if really changed |
4769 iAlfScreens[0]->iDisplay->SetDirty(); |
5193 iAlfScreens[0]->iDisplay->SetDirty(); |
4770 __ALFFXLOGSTRING1("CAlfBridge::RemoveTemporaryPresenterVisuals - END - effects in layout %d", effectControlGroupLayout->Count()); |
5194 __ALFFXLOGSTRING1("CAlfBridge::RemoveTemporaryPresenterVisuals - END - effects in layout %d", effectControlGroupLayout->Count()); |
4771 return itemsRemoved; |
5195 return itemsRemoved; |
4772 } |
5196 } |
5309 __ALFLOGSTRING("CAlfBridge::LowMemoryCancelAllEffects"); |
5758 __ALFLOGSTRING("CAlfBridge::LowMemoryCancelAllEffects"); |
5310 iLayoutSwitchEffectCoordinator->Cancel(); |
5759 iLayoutSwitchEffectCoordinator->Cancel(); |
5311 HandleGfxStopEvent( EFalse ); |
5760 HandleGfxStopEvent( EFalse ); |
5312 __ALFLOGSTRING("CAlfBridge::LowMemoryCancelAllEffects done"); |
5761 __ALFLOGSTRING("CAlfBridge::LowMemoryCancelAllEffects done"); |
5313 } |
5762 } |
|
5763 |
|
5764 // --------------------------------------------------------------------------- |
|
5765 // --------------------------------------------------------------------------- |
|
5766 // |
|
5767 TInt CAlfBridge::GetSizeAndRotation(TSize& aSize, TInt& aRotation) |
|
5768 { |
|
5769 if ( !iAlfScreens.Count() ) |
|
5770 { |
|
5771 return KErrNotReady; |
|
5772 } |
|
5773 |
|
5774 switch (iAlfScreens[0]->iDisplay->Orientation()) |
|
5775 { |
|
5776 case CHuiGc::EOrientationCCW90: |
|
5777 aRotation = 1; |
|
5778 break; |
|
5779 case CHuiGc::EOrientation180: |
|
5780 aRotation = 2; |
|
5781 break; |
|
5782 case CHuiGc::EOrientationCW90: |
|
5783 aRotation = 3; |
|
5784 break; |
|
5785 case CHuiGc::EOrientationNormal: |
|
5786 default: |
|
5787 aRotation = 0; |
|
5788 break; |
|
5789 } |
|
5790 |
|
5791 aSize = iAlfScreens[0]->iDisplay->Size(); |
|
5792 |
|
5793 __ALFLOGSTRING3("CAlfBridge::GetSizeAndRotation %d x %d, rot %d", aSize.iWidth, aSize.iHeight, aRotation); |
|
5794 return KErrNone; |
|
5795 } |
|
5796 |
|
5797 // --------------------------------------------------------------------------- |
|
5798 // --------------------------------------------------------------------------- |
|
5799 // |
|
5800 TInt CAlfBridge::ReadPixels(CFbsBitmap* aBitmap) |
|
5801 { |
|
5802 if ( !iAlfScreens.Count() ) |
|
5803 { |
|
5804 return KErrNotReady; |
|
5805 } |
|
5806 __ALFLOGSTRING("CAlfBridge::ReadPixels"); |
|
5807 TRAPD(err, iAlfScreens[0]->iDisplay->CopyScreenToBitmapL(aBitmap)); |
|
5808 __ALFLOGSTRING1("CAlfBridge::ReadPixels ret %d", err); |
|
5809 return err; |
|
5810 } |
5314 |
5811 |
5315 // --------------------------------------------------------------------------- |
5812 // --------------------------------------------------------------------------- |
5316 // --------------------------------------------------------------------------- |
5813 // --------------------------------------------------------------------------- |
5317 // |
5814 // |
5318 void CAlfBridge::Synchronized(TInt aId) |
5815 void CAlfBridge::Synchronized(TInt aId) |
5348 TBool CAlfBridge::IsAlfOriginatedWindow(CHuiCanvasVisual& aVisual) |
5845 TBool CAlfBridge::IsAlfOriginatedWindow(CHuiCanvasVisual& aVisual) |
5349 { |
5846 { |
5350 return (aVisual.Owner().ControlGroup()->ResourceId() == iAlfWindowGroupNodeId); |
5847 return (aVisual.Owner().ControlGroup()->ResourceId() == iAlfWindowGroupNodeId); |
5351 } |
5848 } |
5352 |
5849 |
|
5850 // experimental |
|
5851 TBool CAlfBridge::IsFullScreenDrawn( TInt aOrientation) |
|
5852 { |
|
5853 if (!iAlfScreens.Count()) |
|
5854 return EFalse; |
|
5855 aOrientation = iAlfScreens[0]->iDisplay->Orientation(); |
|
5856 iTempRegion.Clear(); |
|
5857 |
|
5858 CAlfScreen* screen = iAlfScreens[0]; |
|
5859 TRect fullscreen = TRect(TPoint(0,0), screen->Size()); |
|
5860 TBool fadeEffectInScreen = EFalse; |
|
5861 |
|
5862 TBool fullscreenCovered = EFalse; |
|
5863 CAlfAppSrvSessionBase* topMostAlfSrvSession = NULL; |
|
5864 |
|
5865 //iActiveVisualCount = 0; |
|
5866 iBgSurfaceFound = EFalse; |
|
5867 //iPaintedArea = 0; |
|
5868 |
|
5869 // Check if effect group has an effect with opaque hint. |
|
5870 CHuiControlGroup& fxcontrolgroup = *(iAlfScreens[0]->iFullscreenEffectControlGroup); |
|
5871 CHuiControl& fxcontrol = fxcontrolgroup.Control(0); |
|
5872 CHuiCanvasVisual* fxlayout = (CHuiCanvasVisual*)&fxcontrol.Visual(0); |
|
5873 CHuiVisual* fxExternalContent = fxlayout->ExternalContent(); |
|
5874 |
|
5875 if (fxlayout && IsOpaqueEffect(fxlayout->Effect())) |
|
5876 { |
|
5877 fullscreenCovered = ETrue; |
|
5878 } |
|
5879 else if (fxExternalContent && IsOpaqueEffect(fxExternalContent->Effect())) |
|
5880 { |
|
5881 fullscreenCovered = ETrue; |
|
5882 } |
|
5883 |
|
5884 |
|
5885 TBool alfWindowGroupFoundVisible = EFalse; |
|
5886 |
|
5887 AMT_SET_VALUE( iVisibleVisualCount, 0 ); |
|
5888 |
|
5889 // skip the topmost (effect) layer, start from floating sprite group |
|
5890 for (TInt j=screen->iDisplay->Roster().Count() - screen->FixedControlGroupCount(); j>=0; j--) |
|
5891 { |
|
5892 CHuiControlGroup& controlgroup = iAlfScreens[0]->iDisplay->Roster().ControlGroup(j); |
|
5893 CHuiControl& control = controlgroup.Control(0); |
|
5894 |
|
5895 if (control.Role() == EAlfFpsIndicatorContainer) |
|
5896 { |
|
5897 // FPS container doesn't contain canvas visuals |
|
5898 continue; |
|
5899 } |
|
5900 |
|
5901 CHuiCanvasVisual* layout = (CHuiCanvasVisual*)&control.Visual(0); |
|
5902 |
|
5903 // For optimization reasons, check if all visuals below in Z-order are covered |
|
5904 if (!fullscreenCovered) |
|
5905 { |
|
5906 fullscreenCovered = IsRectCoveredByRegion(fullscreen, iTempRegion); |
|
5907 } |
|
5908 |
|
5909 // Dont mess with alf control group visuals, alf session handling does it for us |
|
5910 if (control.Role() == EAlfSessionContainer) |
|
5911 { |
|
5912 CHuiLayout* hostContainer = control.ContainerLayout( NULL ); |
|
5913 TInt flags = hostContainer->Flags(); |
|
5914 if (!fullscreenCovered) |
|
5915 { |
|
5916 // clear inactive flag if client has not made this controlgroup hidden |
|
5917 if(!(flags&EHuiVisualFlagUnderOpaqueHint)) |
|
5918 { |
|
5919 alfWindowGroupFoundVisible = ETrue; |
|
5920 if(iAppUi) |
|
5921 { |
|
5922 topMostAlfSrvSession = iAppUi->SrvSessionForControlGroup(controlgroup); |
|
5923 } |
|
5924 |
|
5925 // just add the rect to covered region because alf draws solid background |
|
5926 iTempRegion.AddRect(fullscreen); |
|
5927 iTempRegion.Tidy(); |
|
5928 fullscreenCovered = ETrue; |
|
5929 } |
|
5930 } |
|
5931 else if(!alfWindowGroupFoundVisible || flags&EHuiVisualFlagUnderOpaqueHint) |
|
5932 { |
|
5933 // this alf session control group should not be visible anymore because avkon application is on top |
|
5934 // -> change to inactive |
|
5935 |
|
5936 } |
|
5937 else if(!(flags&EHuiVisualFlagUnderOpaqueHint)) // alf app covers full screen |
|
5938 { |
|
5939 // check if current controlgroup belongs to same srvsession as the topmost visible alf session container |
|
5940 CAlfAppSrvSessionBase* alfsrvsession = NULL; |
|
5941 if(iAppUi) |
|
5942 { |
|
5943 alfsrvsession = iAppUi->SrvSessionForControlGroup(controlgroup); |
|
5944 } |
|
5945 if(topMostAlfSrvSession!=NULL && topMostAlfSrvSession == alfsrvsession) |
|
5946 { |
|
5947 |
|
5948 } |
|
5949 else |
|
5950 { |
|
5951 |
|
5952 } |
|
5953 } |
|
5954 continue; |
|
5955 } |
|
5956 |
|
5957 __ALFLOGSTRING1("CAlfBridge::IsFullScreenDraw - fullscreen covered %d", fullscreenCovered) |
|
5958 TBool subTreeCovered = EFalse; |
|
5959 TBool hasLayers = EFalse; |
|
5960 TBool hasActiveVisualsInVisualTree = |
|
5961 IsFullScreenDrawnRecursive( layout, controlgroup, control, fullscreenCovered, fullscreen, screen,subTreeCovered, hasLayers, 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. |
|
5965 if (!fullscreenCovered) |
|
5966 { |
|
5967 fullscreenCovered = IsOpaqueEffect(layout->Effect()); |
|
5968 } |
|
5969 // "has layers" has been removed |
|
5970 // If we layout is active setup the fade effects. Also if it is inactive, but has been |
|
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) |
|
5986 { |
|
5987 return ETrue; |
|
5988 } |
|
5989 } |
|
5990 return fullscreenCovered; |
|
5991 } |
|
5992 |
|
5993 TBool CAlfBridge::IsFullScreenDrawnRecursive( |
|
5994 CHuiLayout* aLayout, |
|
5995 CHuiControlGroup& aControlGroup, |
|
5996 CHuiControl& aControl, |
|
5997 TBool& aFullscreenCovered, |
|
5998 TRect& aFullscreen, |
|
5999 CAlfScreen* aScreen, |
|
6000 TBool& aSubtreeVisible, |
|
6001 TBool& aHasVisualsWithLayers, |
|
6002 TBool aChildCanBeOpaque, |
|
6003 TInt aOrientation) |
|
6004 { |
|
6005 TBool visualTreeActive = EFalse; |
|
6006 TRect visualDisplayRect; |
|
6007 TBool visualRectIsCovered = EFalse; |
|
6008 TBool visualIsOpaque = EFalse; |
|
6009 TBool visualIsActive = EFalse; |
|
6010 CHuiCanvasVisual* canvasVisual = NULL; |
|
6011 |
|
6012 for (TInt i=aLayout->Count()-1; i >= 0; i--) |
|
6013 { |
|
6014 visualDisplayRect = TRect(0,0,0,0); |
|
6015 visualRectIsCovered = EFalse; |
|
6016 visualIsOpaque = EFalse; |
|
6017 visualIsActive = EFalse; |
|
6018 TBool visualSubtreeVisible = EFalse; |
|
6019 |
|
6020 // Check first if visual itself is hidden or does hide other visuals below |
|
6021 // in z-order. If it does not hide, then we do not add its displayrect to covering |
|
6022 // region. |
|
6023 canvasVisual = (CHuiCanvasVisual*)(&aLayout->Visual(i)); |
|
6024 |
|
6025 // Child can be considered to be opaque only if all parents are opaque and |
|
6026 // visual itself is opaque. |
|
6027 // For example, parent can have opacity < 1 and that affects children as well. |
|
6028 // As another example, parent can have scaling transformation. |
|
6029 visualIsOpaque = aChildCanBeOpaque && IsVisualOpaque(*canvasVisual); |
|
6030 |
|
6031 if (visualIsOpaque && !canvasVisual->LayerExtent().IsEmpty()) |
|
6032 { |
|
6033 aHasVisualsWithLayers = ETrue; |
|
6034 } |
|
6035 |
|
6036 if (canvasVisual->Count()) |
|
6037 { |
|
6038 visualTreeActive |= IsFullScreenDrawnRecursive( canvasVisual, aControlGroup, aControl,aFullscreenCovered, aFullscreen, aScreen,visualSubtreeVisible, aHasVisualsWithLayers, visualIsOpaque, aOrientation ); |
|
6039 } |
|
6040 |
|
6041 |
|
6042 if (visualSubtreeVisible) |
|
6043 { |
|
6044 aSubtreeVisible = ETrue; |
|
6045 } |
|
6046 |
|
6047 // Optimization, it is faster to check fullscreen than read visuals displayrect |
|
6048 if (aFullscreenCovered) |
|
6049 { |
|
6050 visualRectIsCovered = ETrue; |
|
6051 } |
|
6052 else |
|
6053 { |
|
6054 // add the rect only if the window contains drawing for the new orientation |
|
6055 visualDisplayRect = canvasVisual->CommandBufferCoverage(aOrientation); |
|
6056 |
|
6057 // Make sure we clip visual rect to visible screen area |
|
6058 ClipVisualRect(visualDisplayRect, aFullscreen); |
|
6059 |
|
6060 // Check if this visual is covered by other opaque visuals which rects are in "covered" region |
|
6061 visualRectIsCovered = IsRectCoveredByRegion(visualDisplayRect, iTempRegion); |
|
6062 } |
|
6063 |
|
6064 // Finally check the area that this visual covers and add it to covered region |
|
6065 visualIsActive = !(canvasVisual->Flags() & EHuiVisualFlagInactive); |
|
6066 |
|
6067 // Sprites and effects as we consider them always as transparent and also |
|
6068 // if controlgroup is transformed somehow |
|
6069 |
|
6070 if (aControl.Role() == EAlfFullScreenEffectContainer |
|
6071 || aControl.Role() == EAlfWindowFloatingSpriteContainer || |
|
6072 aControlGroup.IsTransformed()) |
|
6073 { |
|
6074 visualIsOpaque = EFalse; |
|
6075 } |
|
6076 |
|
6077 if (visualIsActive && visualIsOpaque && !visualRectIsCovered) |
|
6078 { |
|
6079 // New visibility system takes only window shape into account. |
|
6080 if ( canvasVisual->CanvasFlags() & EHuiCanvasFlagIncludeToVisibilityCalculation ) |
|
6081 { |
|
6082 if ( !canvasVisual->HasCustomShape() ) |
|
6083 { |
|
6084 TRect displayRect(canvasVisual->DisplayRect()); |
|
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 } |
|
6105 } |
|
6106 visualTreeActive |= visualIsActive; |
|
6107 |
|
6108 // iVisibleVisualCount is cleared in HandleVisualVisibility() |
|
6109 AMT_INC_COUNTER_IF( visualIsActive && !visualRectIsCovered , iVisibleVisualCount ); |
|
6110 } // for loop end : children checking loop |
|
6111 |
|
6112 return visualTreeActive; |
|
6113 } |
|
6114 |
5353 // end of file |
6115 // end of file |