uiacceltk/hitchcock/coretoolkit/inc/HuiFxEngine.h
changeset 19 f5bac0badc7e
parent 13 8f67d927ea57
equal deleted inserted replaced
14:83d2d132aa58 19:f5bac0badc7e
    36 class CHuiFxEffect;
    36 class CHuiFxEffect;
    37 class CHuiVisual;
    37 class CHuiVisual;
    38 class CHuiFxEffectCache;
    38 class CHuiFxEffectCache;
    39 class MAlfGfxEffectObserver;
    39 class MAlfGfxEffectObserver;
    40 class CHuiGc;
    40 class CHuiGc;
       
    41 
       
    42 class MHuiEffectObserver
       
    43     {
       
    44     public:
       
    45     virtual void EffectAdded(CHuiFxEffect* aEffect) = 0;
       
    46     virtual void EffectComplete(CHuiFxEffect* aEffect) = 0;
       
    47     };
    41 
    48 
    42 class CHuiFxEngine : public CBase, public MHuiLowMemoryObserver, public MHuiMemoryLevelObserver
    49 class CHuiFxEngine : public CBase, public MHuiLowMemoryObserver, public MHuiMemoryLevelObserver
    43     {
    50     {
    44     // important constant! Affects memory fragmentation in backend too small 
    51     // important constant! Affects memory fragmentation in backend too small 
    45     // number forces lots of acquires/releases resulting in fragmented memory 
    52     // number forces lots of acquires/releases resulting in fragmented memory 
   105             MAlfGfxEffectObserver* aEffectEndObserver = 0,
   112             MAlfGfxEffectObserver* aEffectEndObserver = 0,
   106             TInt aHandle = 0,
   113             TInt aHandle = 0,
   107             TInt aFlags = 0 );
   114             TInt aFlags = 0 );
   108     
   115     
   109     IMPORT_C TBool FxmlUsesInput1(const TDesC &aFileName);
   116     IMPORT_C TBool FxmlUsesInput1(const TDesC &aFileName);
   110 
   117     IMPORT_C TBool FxmlUsesOpaqueHint(const TDesC &aFileName);
   111     
   118     
   112     IMPORT_C void AdvanceTime(TReal32 aElapsedTime);
   119     IMPORT_C void AdvanceTime(TReal32 aElapsedTime);
   113     
   120     
   114     IMPORT_C TReal32 GetReferenceValue(THuiFxReferencePoint aPoint);
   121     IMPORT_C TReal32 GetReferenceValue(THuiFxReferencePoint aPoint);
   115     
   122     
   124 	 *
   131 	 *
   125 	 * Begins new group. start collecting effects, that should be set to motion at the same 
   132 	 * Begins new group. start collecting effects, that should be set to motion at the same 
   126 	 * time.
   133 	 * time.
   127 	 */
   134 	 */
   128 	IMPORT_C void BeginGroupEffect(TInt aGroup);
   135 	IMPORT_C void BeginGroupEffect(TInt aGroup);
   129 
       
   130     
   136     
   131     IMPORT_C TInt ActiveGroupEffect();
   137     IMPORT_C TInt ActiveGroupEffect();
   132     
   138     
       
   139     IMPORT_C TBool AddEffectToGroup(TInt aGroup);
   133     /*
   140     /*
   134 	 * StartGroupEffect
   141 	 * StartGroupEffect
   135 	 *
   142 	 *
   136 	 * Starts syncronously group of effects that have the same aGroup id. 
   143 	 * Starts syncronously group of effects that have the same aGroup id. 
   137 	 */
   144 	 */
   138     IMPORT_C void StartGroupEffect(TInt aGroup);
   145     IMPORT_C void StartGroupEffect(TInt aGroup);
   139     
   146     
   140     TInt LowMemoryState();
   147     TInt LowMemoryState();
   141     
   148     
   142     TBool HasActiveEffects() const;
   149     TBool HasActiveEffects() const;
       
   150     TBool HasActiveFadeEffect() const;
   143     
   151     
   144     void ClearCache();
   152     void ClearCache();
   145     
   153     
   146     void NotifyEffectEndObservers();
   154     void NotifyEffectEndObservers();
   147     
   155     
   148     IMPORT_C void SetMemoryLevel(THuiMemoryLevel aLevel);
   156     IMPORT_C void SetMemoryLevel(THuiMemoryLevel aLevel);
       
   157     
       
   158     void SetObserver(MHuiEffectObserver* aObserver)
       
   159         {
       
   160         iEffectObserver = aObserver;    
       
   161         }
       
   162 	
       
   163 	/**
       
   164 	 * Group effects wait until each effect has been drawn once. 
       
   165 	 *
       
   166 	 * Group effects are set into motion by NotifyEffectReady, when all effects in
       
   167 	 * the group have been drawn at least once.
       
   168 	 */
       
   169     void NotifyEffectReady(TInt aGroupId);
   149     
   170     
   150 protected:
   171 protected:
   151     IMPORT_C void AddEffectL(CHuiFxEffect* aEffect);
   172     IMPORT_C void AddEffectL(CHuiFxEffect* aEffect);
   152     IMPORT_C void RemoveEffect(CHuiFxEffect* aEffect);
   173     IMPORT_C void RemoveEffect(CHuiFxEffect* aEffect);
   153     
   174     
   155     TInt             iBuffersInUse;
   176     TInt             iBuffersInUse;
   156     
   177     
   157 private:
   178 private:
   158     
   179     
   159     TBool FxmlUsesInput1(CHuiFxEffect& aEffect);
   180     TBool FxmlUsesInput1(CHuiFxEffect& aEffect);
       
   181     TInt FindEffectGroup(TInt aGroup);
   160     
   182     
   161 private:
   183 private:
   162     // Render buffer management --- native implementations
   184     // Render buffer management --- native implementations
   163     virtual CHuiFxRenderbuffer* AcquireNativeRenderbuffer(const TSize& aDesiredSize) = 0;
   185     virtual CHuiFxRenderbuffer* AcquireNativeRenderbuffer(const TSize& aDesiredSize) = 0;
   164     virtual void ReleaseNativeRenderbuffer(CHuiFxRenderbuffer* aBuffer) = 0;
   186     virtual void ReleaseNativeRenderbuffer(CHuiFxRenderbuffer* aBuffer) = 0;
   187     RPointerArray<CHuiFxEffect>  iActiveEffects;
   209     RPointerArray<CHuiFxEffect>  iActiveEffects;
   188     THuiFxEngineType             iType;
   210     THuiFxEngineType             iType;
   189     TRect                        iExtRect;
   211     TRect                        iExtRect;
   190     CHuiFxEffectCache *iCache;
   212     CHuiFxEffectCache *iCache;
   191     TInt iLowGraphicsMemoryMode;
   213     TInt iLowGraphicsMemoryMode;
   192     RArray<TInt> iActiveEffectGroups;
   214     
       
   215     NONSHARABLE_STRUCT(TEffectGroupStruct)
       
   216         {
       
   217     public:
       
   218             
       
   219         TEffectGroupStruct(TInt aGroup) : iGroup(aGroup), iWaiting(0), iEndCalled(EFalse){};
       
   220 
       
   221         TInt iGroup;
       
   222         TInt iWaiting;
       
   223         TBool iEndCalled;
       
   224         };
       
   225     
       
   226 	/**
       
   227 	 * Only one simultanious effect group is supported
       
   228 	 */
       
   229     RArray<TEffectGroupStruct> iActiveEffectGroups;
       
   230     
       
   231     MHuiEffectObserver* iEffectObserver;
   193     };
   232     };
   194 
   233 
   195 #endif /*HUIFXENGINE_H_*/
   234 #endif /*HUIFXENGINE_H_*/