uiacceltk/hitchcock/AlfRenderStage/inc/alfrenderstage.h
changeset 0 15bf7259bb7c
child 3 d8a3531bc6b8
child 13 8f67d927ea57
equal deleted inserted replaced
-1:000000000000 0:15bf7259bb7c
       
     1 /*
       
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:   AlfRenderStage provides a method for redirect avkon drawing to a graphics accelerator
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef __ALFRENDERSTAGE_H__
       
    21 #define __ALFRENDERSTAGE_H__
       
    22 
       
    23 #include <graphics/wsrenderstage.h>
       
    24 #include <graphics/wscursor.h>
       
    25 #include "alfrsgc.h"
       
    26 #include <alfhintapi.h>
       
    27 
       
    28 #include <graphics/wsgraphicdrawer.h>
       
    29 #include <e32hashtab.h>
       
    30 #include <alfstreamerconsts.h>
       
    31 #include "alfrssendbuffer.h"
       
    32 #include "alfrenderstageutils.h"
       
    33 
       
    34 class CAlfFader;
       
    35 class CFbsBitGc;
       
    36 class MWsGraphicDrawerEnvironment;
       
    37 class CAlfRenderStage;
       
    38 class CAlfAsynchGoomSession;
       
    39 
       
    40  
       
    41 /**
       
    42  *  This is the implementation of CAlfRenderStage which is created by a CAlfRenderStageFactory
       
    43  *
       
    44  *  This class provides interface for applications to draw and manipulate the screen. It listenes
       
    45  *  window events and draw commands (passed via CAlfGraphicsContext) and serializes the data. After frame
       
    46  *  draw is complete, the serialized data is passed to AlfStreamerServer for further processing.
       
    47  *
       
    48  *  @lib alfrenderstage.lib
       
    49  *  @since S60 v5.2
       
    50  */
       
    51 
       
    52 class CAlfRenderStage : 
       
    53     public CWsRenderStage, 
       
    54     public MWsEventHandler,
       
    55     public MWsTextCursor,
       
    56     public MAlfCompositionAgnosticWindowTreeObserver,
       
    57     public MAlfHintObserver,
       
    58     public MWsDrawAnnotationObserver
       
    59         {
       
    60 public:
       
    61 
       
    62     /**
       
    63      * NewL
       
    64      * 
       
    65      * Constructor
       
    66      * 
       
    67      * @param aEnv   
       
    68      * @param aScreen   
       
    69      * @param aScreenNumber   
       
    70      * @return  New instance of the class
       
    71      */
       
    72     static CAlfRenderStage* NewL(MWsGraphicDrawerEnvironment* aEnv, MWsScreen* aScreen, TInt aScreenNumber, CWsRenderStage* aNext);
       
    73 	
       
    74     /**
       
    75      * C++ destructor
       
    76      */
       
    77     ~CAlfRenderStage();    
       
    78 
       
    79 public: // New methods
       
    80         
       
    81     /**
       
    82      * EndCallBack
       
    83      *
       
    84      * Asynchronous SendBuffer
       
    85      * 
       
    86      * @param aFinished   
       
    87      */
       
    88     void EndCallBack( TRequestStatus* aFinished );
       
    89 
       
    90     /**
       
    91      * WsGraphicsContext
       
    92      *
       
    93      * Getter function
       
    94      * 
       
    95      * @return Graphics context
       
    96      */
       
    97     CAlfGraphicsContext* WsGraphicsContext();
       
    98 
       
    99     /**
       
   100      * AlfSendBuffer
       
   101      * 
       
   102      * Getter function
       
   103      * 
       
   104      * @return Send buffer
       
   105      */
       
   106     CAlfRsSendBuffer* AlfSendBuffer();
       
   107 
       
   108     /**
       
   109      * ScreenNumber
       
   110      * 
       
   111      * Getter function
       
   112      * 
       
   113      * @return Screen number
       
   114      */     
       
   115    TInt ScreenNumber() const;
       
   116 
       
   117 public: // From CWsRenderStage
       
   118 
       
   119     TAny* ResolveObjectInterface(TUint aTypeId);
       
   120     void Begin(const TRegion* aRegion);
       
   121     void End(TRequestStatus* aFinished);	
       
   122 public: // from MWsEventHandler
       
   123 
       
   124     /**
       
   125      * @note This will be soon obsolete.
       
   126      */
       
   127     void DoHandleEvent(const TWservCrEvent& aEvent);
       
   128     
       
   129 public: // from MWsTextCursor
       
   130     
       
   131     void DrawTextCursor(const TTextCursorInfo& aTextCursorInfo);
       
   132 
       
   133 public: // from MAlfCompositionWsWindowTreeObserver
       
   134 
       
   135 	void NodeCreated(const MWsWindowTreeNode& aWindowTreeNode, MWsWindowTreeNode const* aParent);
       
   136 	void NodeReleased(const MWsWindowTreeNode& aWindowTreeNode);
       
   137 	void NodeActivated(const MWsWindowTreeNode& aWindowTreeNode);
       
   138 	void NodeExtentChanged(const MWsWindowTreeNode& aWindowTreeNode, const TRect& aRect );
       
   139 	void SiblingOrderChanged(const MWsWindowTreeNode& aWindowTreeNode, TInt aNewPos);
       
   140 	void FlagChanged(const MWsWindowTreeNode& aWindowTreeNode, TInt aFlags, TBool aNewValue);
       
   141 	void AttributeChanged(const MWsWindowTreeNode& aWindowTreeNode, TInt aAttribute );
       
   142 	void FadeCountChanged(const MWsWindowTreeNode& aWindowTreeNode, TInt aFadeCount);
       
   143 	void TransparentRegionChanged(const MWsWindowTreeNode& aWindowTreeNode, const TRegion& aNewTransparentRegion, const TRegion* aNewOpaqueRegion);
       
   144 	void MovedToWindowGroup(const MWsWindowTreeNode& aWindowTreeNode, const MWsWindowTreeNode& aNewWindowGroupNode);
       
   145 	void WindowGroupChained(const MWsWindowTreeNode& aParent, const MWsWindowTreeNode& aChild);
       
   146 	void WindowGroupChainBrokenAfter(const MWsWindowTreeNode& aWindowGroupNode);
       
   147 	void FadeAllChildren(const MWsWindowTreeNode& aWindowTreeNode, TBool aFaded);
       
   148 	
       
   149 public: // from MWsDrawAnnotationObserver
       
   150 	void WindowRedrawStart(const MWsWindowTreeNode& aWindowTreeNode, const TRegion& aRegion);
       
   151 	void WindowRedrawEnd(const MWsWindowTreeNode& aWindowTreeNode);
       
   152 	void WindowAnimRedrawStart(const MWsWindowTreeNode& aWindowTreeNode, const TRegion& aRegion);
       
   153 	void WindowAnimRedrawEnd(const MWsWindowTreeNode& aWindowTreeNode);
       
   154 	void SpriteRedrawStart(const MWsWindowTreeNode& aWindowTreeNode, const TRegion& aRegion);
       
   155 	void SpriteRedrawEnd(const MWsWindowTreeNode& aWindowTreeNode);
       
   156 	void SpriteFlash(const MWsWindowTreeNode& aWindowTreeNode, TBool aFlashOn);
       
   157 	void SegmentRedrawStart( const TRegion& /*aRegion */);
       
   158 	void SegmentRedrawEnd( );
       
   159 	
       
   160 public: // from MAlfHintObserver
       
   161     
       
   162     void InsertTagL( TInt aTag, TInt32 aParameter = 0 );
       
   163     void InsertTagL( TInt aTag, TRect aBoundingRect, TInt aLayerId );
       
   164     
       
   165 protected: // New methods
       
   166 
       
   167     /**
       
   168      * C++ constructor
       
   169      */
       
   170     CAlfRenderStage(CWsRenderStage* aNext);
       
   171 
       
   172     /**
       
   173      * ConstructL
       
   174      *
       
   175      * @param aEnv
       
   176      * @param aScreen
       
   177      * @param aScreenNumber
       
   178      */
       
   179     virtual void ConstructL(MWsGraphicDrawerEnvironment* aEnv, MWsScreen* aScreen, TInt aScreenNumber);
       
   180 
       
   181     /**
       
   182      * InitL
       
   183      */
       
   184     virtual void InitL();
       
   185 
       
   186     /**
       
   187      * HasWindowRectChanged
       
   188      *
       
   189      * Temporary function until WServ can provide the same information.
       
   190      * 
       
   191      * @param aId
       
   192      * @param aRect
       
   193      * @return 
       
   194      */
       
   195     TBool HasWindowRectChanged( TUint32 aId, TRect& aRect );
       
   196 
       
   197     /**
       
   198      * DoHandleRedraw
       
   199      *
       
   200      * Handles window drawing related events.
       
   201      *
       
   202      * @param aEvent    Event to be handled
       
   203      */
       
   204     void DoHandleRedrawL( const TWservCrEvent& aEvent );
       
   205 
       
   206     /**
       
   207      * Draws standard text cursor. Client is expected to call commit.
       
   208      * @param aWindowTreeNode window tree node.
       
   209      * @param aExtent extent.
       
   210      * @param aClipRect clip rect.
       
   211 	 * @param aCursorRect cursor rect.
       
   212      */
       
   213     void DoDrawTextCursor( 
       
   214         const MWsWindowTreeNode& aWindowTreeNode, 
       
   215         const TRect& aExtent, 
       
   216         const TRect& aClipRect,
       
   217         const TRect& aCursorRect );
       
   218 
       
   219 protected:
       
   220 	
       
   221     //TTimeStamp iTimeStamp;
       
   222 		
       
   223     const TRegion* iUpdateRegion;
       
   224     
       
   225     /**
       
   226      * Own.
       
   227      */
       
   228     MWsScreen* iScreen;
       
   229         
       
   230     /**
       
   231      * Own.
       
   232      */
       
   233 	CAlfGraphicsContext* iWsGraphicsContext; // MWsGraphicsContext
       
   234 
       
   235     /**
       
   236      * Own.
       
   237      */
       
   238 	CAlfRsSendBuffer* iAlfSendBuffer;
       
   239     
       
   240     /**
       
   241      * Not own.
       
   242      */
       
   243 	MWsGraphicDrawerEnvironment* iEnv;
       
   244     
       
   245     /**
       
   246      * Returns the stream size
       
   247      */
       
   248 	TInt iWindowBufferIndex;
       
   249 
       
   250 	/**
       
   251 	 * @todo
       
   252 	 * @note This is temporary structure for figuring out, if window size or position has changed since previous update.
       
   253 	 *       WServ will provide event about these in the future.
       
   254 	 */
       
   255 	RHashMap<TUint32, TRect> iWindowData;
       
   256 	
       
   257 	/**
       
   258 	 * Fader interface
       
   259 	 * Own.
       
   260 	 */
       
   261 	CAlfFader*  iFader;
       
   262 	
       
   263     TInt iScreenNumber;
       
   264     
       
   265     TBool iDrawingActive;
       
   266     
       
   267     RArray<TInt> iWindowIds;
       
   268 
       
   269     /**
       
   270      * @note Remove this when there is screen device for hw and correct sizes can be asked from there
       
   271      */
       
   272     TBool iNormalOrientation;
       
   273 
       
   274     /** For keeping track of segmentredraws inside windowredraws **/
       
   275     const MWsWindowTreeNode* iWindowDrawingNode;
       
   276     TBool iSegmentRedrawActive;
       
   277     
       
   278 	CWsRenderStage* iNext;
       
   279 private:
       
   280     // Goom connection. Owned.
       
   281     CAlfAsynchGoomSession* iGoomSession;
       
   282     
       
   283     // Current sprite draw node.
       
   284     const MWsWindowTreeNode* iSpriteRedraw;
       
   285     
       
   286     // Enumeration for sprite flash
       
   287     enum TSpriteFlash
       
   288         {
       
   289         // Sprite flash hasn't been set
       
   290         ESpriteFlashUndefined,
       
   291         // Sprite flash set with ETrue parameter
       
   292         ESpriteFlashOn,
       
   293         // Sprite flash set with EFalse parameter
       
   294         ESpriteFlashOff
       
   295         };
       
   296     // Sprite flash setting for iSpriteRedraw
       
   297     TSpriteFlash iSpriteRedrawFlash;
       
   298     
       
   299 	};
       
   300 
       
   301 #endif //__ALFRENDERSTAGE_H__