20 #ifndef __ALF_BRIDGE_H__ |
20 #ifndef __ALF_BRIDGE_H__ |
21 #define __ALF_BRIDGE_H__ |
21 #define __ALF_BRIDGE_H__ |
22 |
22 |
23 #include <e32hashtab.h> |
23 #include <e32hashtab.h> |
24 |
24 |
|
25 #define AMT_CONTROL() static_cast<CAlfModuleTestDataControl*>(Dll::Tls()) |
|
26 #include "alfmoduletest.h" |
|
27 |
25 #include "alfscreen.h" |
28 #include "alfscreen.h" |
26 #include "alfstreamerbridge.h" |
29 #include "alfstreamerbridge.h" |
27 #include "alfdecoderserverclient.h" |
30 #include "alfdecoderserverclient.h" |
28 |
31 |
29 #include <alf/alfconstants.h> |
32 #include <alf/alfconstants.h> |
30 |
33 |
31 #include "HuiFxEffect.h" |
34 #include "HuiFxEffect.h" |
|
35 #include "huisynchronizationobserver.h" |
32 #include <alf/AlfTransEffectPlugin.h> |
36 #include <alf/AlfTransEffectPlugin.h> |
33 #include <uiacceltk/HuiDisplay.h> |
37 #include <uiacceltk/HuiDisplay.h> |
34 |
38 |
35 class CAlfEffectEndTimer; |
39 class CAlfEffectEndTimer; |
36 class CAlfCommandDebug; |
40 class CAlfCommandDebug; |
37 class CAlfLayoutSwitchEffectCoordinator; |
41 class CAlfLayoutSwitchEffectCoordinator; |
38 class RMemReadStream; |
42 class RMemReadStream; |
39 |
43 class CHuiCanvasVisual; |
|
44 class CFullScreenEffectState; |
|
45 class CControlEffectState; |
|
46 |
40 const TInt KAlfBridgeRegionGranularity = 10; |
47 const TInt KAlfBridgeRegionGranularity = 10; |
41 |
48 |
42 NONSHARABLE_CLASS(CAlfBridge): |
49 NONSHARABLE_CLASS(CAlfBridge): |
43 public CBase, |
50 public CBase, |
44 public MAlfStreamerListener, |
51 public MAlfStreamerListener, |
45 public MHuiDisplayRefreshObserver, |
52 public MHuiDisplayRefreshObserver, |
46 public MHuiBitmapProvider, |
53 public MHuiBitmapProvider, |
47 public MAlfGfxEffectObserver, |
54 public MAlfGfxEffectObserver, |
48 public MHuiRosterObserver |
55 public MHuiSynchronizationObserver |
49 { |
56 { |
50 // Helper class for keeping ongoing effects in order. Kept in iEffectCleanupStack |
57 // Helper class for keeping ongoing effects in order. Kept in iEffectCleanupStack |
51 private: |
58 private: |
52 |
59 |
53 struct TEffectCleanupStruct |
60 struct TEffectCleanupStruct |
185 * @param aClientRequest ETrue if requested by client. |
192 * @param aClientRequest ETrue if requested by client. |
186 */ |
193 */ |
187 void HandleGfxStopEvent( TBool aClientRequest ); |
194 void HandleGfxStopEvent( TBool aClientRequest ); |
188 |
195 |
189 void EnableSwRenderingL(TBool aEnable = ETrue); |
196 void EnableSwRenderingL(TBool aEnable = ETrue); |
190 void UploadSwRenderingTargetL( CAlfScreen* aScreen ); |
|
191 TBool PrepareSwRenderingTarget( CAlfScreen* aScreen ); |
197 TBool PrepareSwRenderingTarget( CAlfScreen* aScreen ); |
192 |
198 |
193 /** |
199 /** |
194 * Sets memory level. |
200 * Sets memory level. |
195 * @param aMemoryLevel memory level. |
201 * @param aMemoryLevel memory level. |
217 |
223 |
218 /** |
224 /** |
219 * Cancels all effects due to low memory. |
225 * Cancels all effects due to low memory. |
220 */ |
226 */ |
221 void LowMemoryCancelAllEffects(); |
227 void LowMemoryCancelAllEffects(); |
222 |
228 |
223 // From MHuiRosterObserver |
229 /** |
224 void NotifyRosterDrawStart(CHuiDisplay& aDisplay); |
230 * Sets HuiControlGroup as Alf application window group |
225 void NotifyRosterDrawEnd(CHuiDisplay& aDisplay); |
231 */ |
226 |
232 void SetWindowGroupAsAlfApp(TInt aId); |
|
233 |
|
234 // From MHuiSynchronizationObserver |
|
235 void Synchronized(TInt aId); |
|
236 |
|
237 /* |
|
238 * HandleGfxEndFullScreenTimeout |
|
239 * |
|
240 * GfxTransEffect API gives EndFullScreen events too late. Thus there is a two stage process for triggering |
|
241 * the EndFullScreen effect after BeginFullScreen event arrived. |
|
242 * |
|
243 * For application start effects we give N milliseconds timeout for application to finish drawing after |
|
244 * the first drawing has arrived. If after N milliseconds application has not drawn 75% of the screen, it |
|
245 * gets another N milliseconds. Most cases, the first N milliseconds is enough. |
|
246 */ |
|
247 void HandleGfxEndFullScreenTimeout(CFullScreenEffectState* aFullScreenEffectData); |
|
248 |
227 private: |
249 private: |
228 |
250 |
229 class CFullScreenEffectState; |
|
230 |
|
231 class CControlEffectState; |
|
232 |
251 |
233 CAlfBridge( CAlfStreamerBridge** aHost ); |
252 CAlfBridge( CAlfStreamerBridge** aHost ); |
234 |
253 |
235 void ConstructL(CHuiEnv* aEnv); |
254 void ConstructL(CHuiEnv* aEnv); |
236 |
255 |
278 |
297 |
279 /** |
298 /** |
280 * Handles begin and end fullscreen events |
299 * Handles begin and end fullscreen events |
281 */ |
300 */ |
282 TBool HandleGfxEventL(CFullScreenEffectState& aEvent, CHuiLayout* aToLayout, CHuiLayout *aFromLayout); |
301 TBool HandleGfxEventL(CFullScreenEffectState& aEvent, CHuiLayout* aToLayout, CHuiLayout *aFromLayout); |
|
302 |
|
303 |
|
304 /* |
|
305 * ResolveAfterEffectAppearingApplicationL |
|
306 * |
|
307 * In case of an exit effect the appearing application is not notifed to alf |
|
308 * by the GfxTransEffect API. In such case it is being resolved from Roster by |
|
309 * taking the application directly under the application that is being moved |
|
310 * to the background (when called by HandleReorderWindow) or being destroyed |
|
311 * (called by DeleteControlGroupL). |
|
312 * |
|
313 * In some situation Alf may end up with wrong appearing application uid. In such |
|
314 * case the worst that can happen, is that we must wait the frameworks |
|
315 * EndFullScreen event to arrive. |
|
316 */ |
|
317 void ResolveAfterEffectAppearingApplicationL(CHuiControlGroup* aGroup); |
|
318 |
283 |
319 |
284 /** |
320 /** |
285 * FreezeLayoutUntilEffectDestroyedL |
321 * FreezeLayoutUntilEffectDestroyedL |
286 * |
322 * |
287 * Tries to take screenshot of the layout. If that fails, the layout will not be effected at all. |
323 * Tries to take screenshot of the layout. If that fails, the layout will not be effected at all. |
382 * |
418 * |
383 * @return NULL, if visual does not have temporary presenter visual in the active effect list |
419 * @return NULL, if visual does not have temporary presenter visual in the active effect list |
384 */ |
420 */ |
385 CHuiLayout* FindLayoutByEffectHandle(TInt aHandle); |
421 CHuiLayout* FindLayoutByEffectHandle(TInt aHandle); |
386 |
422 |
387 /* |
423 /** |
388 * HasActiveEffect |
424 * HasActiveEffect |
|
425 * |
|
426 * Note. The visual might not have effect, but it is child for visual that has effect. |
|
427 * In both cases, this method returns ETrue. Otherwise EFalse. |
|
428 * |
|
429 * @param aVisual Visual to be checked for effect participation. |
389 */ |
430 */ |
390 TBool HasActiveEffect(CHuiVisual* aVisual); |
431 TBool HasActiveEffect(CHuiVisual* aVisual); |
|
432 |
|
433 /** |
|
434 * HasActiveEffect |
|
435 * |
|
436 * Note. The visual might not have effect, but it is child for visual that has effect. |
|
437 * In both cases, this method returns ETrue. Otherwise EFalse. |
|
438 * |
|
439 * @param aVisual Visual to be checked for effect participation. |
|
440 * @param aIndex Index of the effect item in iEffectCleanupStack, if found. Otherwise KErrNotFound |
|
441 */ |
|
442 TBool HasActiveEffect(CHuiVisual* aVisual, TInt& aIndex); |
391 |
443 |
392 /* |
444 /* |
393 * FindEffectHandle |
445 * FindEffectHandle |
394 * |
446 * |
395 * @return Returns the effect handle number, which is associated with this visual. If none found, then |
447 * @return Returns the effect handle number, which is associated with this visual. If none found, then |
636 TBool SetupFadeEffectL(CHuiCanvasVisual& aVisual); |
689 TBool SetupFadeEffectL(CHuiCanvasVisual& aVisual); |
637 void PrepareFadeEffects( CHuiCanvasVisual& aVisual ); |
690 void PrepareFadeEffects( CHuiCanvasVisual& aVisual ); |
638 TBool LoadFadeEffectsL( CHuiCanvasVisual& aVisual ); |
691 TBool LoadFadeEffectsL( CHuiCanvasVisual& aVisual ); |
639 |
692 |
640 // Fading related utility methods |
693 // Fading related utility methods |
641 static TBool CanFadeChildren( CHuiCanvasVisual& aParent ); |
694 TBool CanFadeChildren( CHuiCanvasVisual& aParent ); |
642 static TInt RecursiveChildCount( CHuiCanvasVisual& aParent, TInt aCanvasFlags ); |
695 TInt RecursiveChildCount( CHuiCanvasVisual& aParent, TInt aCanvasFlags ); |
643 static TBool IsFadedByParent( CHuiCanvasVisual& aVisual ); |
696 TBool IsFadedByParent( CHuiCanvasVisual& aVisual ); |
644 static TBool IsNearestParentEffectFade( CHuiCanvasVisual& aVisual ); |
697 TBool IsNearestParentEffectFade( CHuiCanvasVisual& aVisual ); |
645 static TBool HasActivePaintedAreas( CHuiCanvasVisual& aVisual, TBool aIncludeChildren ); |
698 TBool HasActivePaintedAreas( CHuiCanvasVisual& aVisual, TBool aIncludeChildren ); |
646 static TBool HasActiveFadedChildren( CHuiCanvasVisual& aVisual ); |
699 TBool HasActiveFadedChildren( CHuiCanvasVisual& aVisual ); |
647 |
700 |
648 private: |
701 private: |
649 |
702 |
650 RPointerArray<CAlfScreen> iAlfScreens; |
703 RPointerArray<CAlfScreen> iAlfScreens; |
651 void SetCursorTimerL(TUint aTime = 0, CHuiVisual* aCursor = 0); |
704 void SetCursorTimerL(TUint aTime = 0, CHuiVisual* aCursor = 0); |
|
705 TBool IsAlfOriginatedWindow(CHuiCanvasVisual& aVisual); |
652 |
706 |
653 NONSHARABLE_CLASS ( TDeadControlGroup ) |
707 NONSHARABLE_CLASS ( TDeadControlGroup ) |
654 { |
708 { |
655 public: |
709 public: |
656 TDeadControlGroup(): |
710 TDeadControlGroup(): |
713 |
767 |
714 // iEffectCleanupStack contains the entries for effects that are currently associated |
768 // iEffectCleanupStack contains the entries for effects that are currently associated |
715 // with visuals in iFullscreenEffectControlGroup |
769 // with visuals in iFullscreenEffectControlGroup |
716 RArray<TEffectCleanupStruct> iEffectCleanupStack; |
770 RArray<TEffectCleanupStruct> iEffectCleanupStack; |
717 |
771 |
718 // Effects that have finished by their own, or framework requested to end them |
|
719 RArray<TInt> iFinishedEffects; |
|
720 |
|
721 // Same as iEffectCleanupStack, but only the ones that can be now cleaned away. |
772 // Same as iEffectCleanupStack, but only the ones that can be now cleaned away. |
722 // See method RemoveTemporaryPresenterVisuals. |
773 // See method RemoveTemporaryPresenterVisuals. |
723 RArray<TInt> iFinishedCleanupStackEffects; |
774 RArray<TInt> iFinishedCleanupStackEffects; |
724 |
775 |
725 // Effects states are used for effects request that arrive before the effected |
776 |
726 // window has been created. This is very common with fullscreen effects and |
|
727 // occational with control effects. |
|
728 // |
|
729 // NOTE: control effects support currently only one "delayed" effect. This is propably |
|
730 // not sufficient for all sitations. |
|
731 NONSHARABLE_CLASS(CEffectState) : public CBase |
|
732 { |
|
733 public: |
|
734 |
|
735 CEffectState(); |
|
736 ~CEffectState(); |
|
737 |
|
738 protected: |
|
739 /** |
|
740 * ResolveFileNameL |
|
741 * |
|
742 * Reads filename from stream and composes it to iEffectName variable. |
|
743 */ |
|
744 void ResolveFileNameL(RMemReadStream& aStream); |
|
745 |
|
746 public: |
|
747 |
|
748 TInt iAction; |
|
749 TInt iHandle; |
|
750 |
|
751 HBufC* iEffectName; |
|
752 // Handle using which client should be informed of completion. |
|
753 TInt iCompletionHandle; |
|
754 // State information |
|
755 TInt iOperation; |
|
756 |
|
757 }; |
|
758 |
|
759 NONSHARABLE_CLASS( CControlEffectState ) : public CEffectState |
|
760 { |
|
761 public: |
|
762 |
|
763 TUint32 iClientHandle; |
|
764 TUint32 iClientGroupHandle; |
|
765 |
|
766 void ConstructL(TInt aAction, RMemReadStream& aStream); |
|
767 }; |
|
768 |
|
769 NONSHARABLE_CLASS( CFullScreenEffectState ) : public CEffectState |
|
770 { |
|
771 public: |
|
772 // CFullScreenEffectState(); |
|
773 // ~CFullScreenEffectState(); |
|
774 |
|
775 void ConstructL(TInt aAction, RMemReadStream& aStream); |
|
776 |
|
777 // Information from BeginFullScreen |
|
778 TInt iType; |
|
779 TInt iWg1; |
|
780 TInt iWg2; |
|
781 TInt iToAppId; |
|
782 TInt iFromAppId; |
|
783 TRect iRect; |
|
784 |
|
785 // ETrue if waiting for window group to appear |
|
786 TBool iWaitingWindowGroup; |
|
787 // ETrue if end fullscreen has been performed |
|
788 TBool iEndFullScreen; |
|
789 // ETrue if setup effect container has been done |
|
790 TBool iSetupDone; |
|
791 |
|
792 // used for resolving the iCleanupStackItem that holds the frozen app layout underneath the starting application |
|
793 TInt iAppStartScreenshotItemHandle; |
|
794 }; |
|
795 |
|
796 /** |
777 /** |
797 * Full screen effect state. |
778 * Full screen effect state. |
798 * Own. |
779 * Own. |
799 */ |
780 */ |
800 CFullScreenEffectState* iFullScreenEffectData; |
781 CFullScreenEffectState* iFullScreenEffectData; |
844 TInt32 iClientSideId; |
825 TInt32 iClientSideId; |
845 TInt32 iClientSideGroupId; |
826 TInt32 iClientSideGroupId; |
846 }; |
827 }; |
847 |
828 |
848 RHashMap<TUint32,THashVisualStruct> iWindowHashArray; |
829 RHashMap<TUint32,THashVisualStruct> iWindowHashArray; |
|
830 CHuiControl* iOrphanStorage; // owned. holds the visuals which are orphaned from their control group |
849 class TRegisteredEffectsStruct |
831 class TRegisteredEffectsStruct |
850 { |
832 { |
851 public: |
833 public: |
852 TRegisteredEffectsStruct() |
834 TRegisteredEffectsStruct() |
853 { |
835 { |
894 TBool iSwRenderingEnabled; |
876 TBool iSwRenderingEnabled; |
895 |
877 |
896 TBool iForcedSwRendering; |
878 TBool iForcedSwRendering; |
897 TBool iLowMemoryMode; |
879 TBool iLowMemoryMode; |
898 THuiMemoryLevel iCurrentMemoryLevel; |
880 THuiMemoryLevel iCurrentMemoryLevel; |
|
881 |
|
882 #ifdef USE_MODULE_TEST_HOOKS_FOR_ALF |
|
883 TInt iTempTotalActiveVisualCount; |
|
884 TInt iTempTotalPassiveVisualCount; |
|
885 #endif |
|
886 #ifdef ALF_DEBUG_PRINT_WINDOWGROUP_ORDER |
|
887 TInt activevisualcount; |
|
888 TInt passivevisualcount; |
|
889 #endif |
899 }; |
890 }; |
900 |
891 |
901 #endif // __ALF_BRIDGE_H__ |
892 #endif // __ALF_BRIDGE_H__ |