uiacceltk/hitchcock/ServerCore/Inc/alfhierarchymodel.h
changeset 0 15bf7259bb7c
child 5 433cbbb6a04b
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:   Mapping function handlers
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __ALFHIERARCHYMODEL_H__
       
    20 #define __ALFHIERARCHYMODEL_H__
       
    21 
       
    22 #include <s32mem.h>
       
    23 #include <e32base.h>
       
    24 #include <e32hashtab.h>
       
    25 #include <gdi.h>
       
    26 #include <alfwindowstructs.h>
       
    27 #include "alfstreamerbridge.h"
       
    28 #include <uiacceltk/HuiUtil.h>  // USER_INVARIANT
       
    29 
       
    30 // forward declarations
       
    31 class CAlfStreamerServer;
       
    32 class CFbsBitmap;
       
    33 class TPoint;
       
    34 class TRect;
       
    35 class CAlfWindow;
       
    36 class TRgb;
       
    37 class CFbsBitGc;
       
    38 class CAlfNodeRoot;
       
    39 class CAlfNode;
       
    40 
       
    41 #include <graphics/wsgraphicdrawer.h>
       
    42 #include <graphics/wsgraphicscontext.h>
       
    43 
       
    44 /*
       
    45  * Helper class for hash array
       
    46  */
       
    47 NONSHARABLE_CLASS(CNodeHashStruct)
       
    48         {
       
    49     public:
       
    50         CNodeHashStruct( CAlfNode* aNode ) : iNode( aNode ) { };
       
    51         
       
    52         CAlfNode* iNode;
       
    53         };
       
    54 
       
    55 NONSHARABLE_CLASS(CAlfHierarchyModel) : public CBase, public MAlfBatchObs
       
    56     {
       
    57 
       
    58 
       
    59 public:
       
    60     static CAlfHierarchyModel* NewL(CAlfStreamerServer& aServer);
       
    61     
       
    62     CAlfStreamerServer& Server()
       
    63         {
       
    64         return iServer;
       
    65         }
       
    66      
       
    67     virtual ~CAlfHierarchyModel();
       
    68 
       
    69     void HandleMessageL( const RMessage2& aMessage );
       
    70     
       
    71     void ShareChunkL( const RMessage2& aMessage );
       
    72     
       
    73     void CloseChunk( TInt32 aChunkId );
       
    74     
       
    75     void OpenChunkL( const RMessage2& aMessage );
       
    76 
       
    77     // utils
       
    78     void DoReleaseSemaphor();
       
    79     
       
    80     void RequestPacketEndCallback( TInt aOffset );
       
    81     
       
    82     void RequestFrameEndCallback();
       
    83 
       
    84     RHashMap<TUint32,CNodeHashStruct> iNodeHashArray;
       
    85     
       
    86     CAlfNode* FindNode( TUint32 aWindowId );
       
    87 
       
    88     TInt InsertNode( TUint32 aWindowId, CAlfNode* aNode );
       
    89 
       
    90     TBool RemoveNode( TUint32 aWindowId );
       
    91     
       
    92     void RemoveAllNodes();
       
    93     
       
    94 private:
       
    95     
       
    96     CAlfHierarchyModel(CAlfStreamerServer& aServer):iServer(aServer){};
       
    97 
       
    98     void AppendScreen( TInt aScreenNumber );
       
    99     
       
   100     void RemoveScreen( TInt aScreenNumber );
       
   101     
       
   102     void ConstructL();
       
   103     
       
   104 	void ProcessUnknownNodeDrawingL( RMemReadStream& aStream );
       
   105     
       
   106 protected:
       
   107 
       
   108     void ReadEndMarkerL();
       
   109         
       
   110     
       
   111 private:
       
   112     
       
   113     /**
       
   114      * ReadRectL
       
   115      * Convinience function for reading a TRect from stream
       
   116      *
       
   117      * @since S60 ?S60_version
       
   118      * @param TRect
       
   119      */
       
   120 public:
       
   121     void ReadRectL(TRect& aRect, RMemReadStream* aStream );
       
   122     
       
   123 //    static TInt DoSignal( TAny* aObject );
       
   124     
       
   125 private:
       
   126 
       
   127     /**
       
   128      * ReadRegionL
       
   129      * Convinience function for reading a RRegion from stream
       
   130      *
       
   131      * @since S60 ?S60_version
       
   132      * @param Region  
       
   133      */
       
   134     void ReadRegionL( RMemReadStream* aStream, RRegion& aRegion, TPoint aWindowPos = TPoint(0,0) );
       
   135      
       
   136     void ExecuteDrawCommandsL( CAlfWindow** aWindow, TAny* aPtr, TInt aSize );
       
   137     /**
       
   138      * ExecuteCommandsL
       
   139      * Internalizes the streamed data.
       
   140      *
       
   141      * @since S60 ?S60_version
       
   142      */
       
   143     void ExecuteCommandsL();
       
   144     
       
   145     // Commands from window tree oberver at renderstage
       
   146     void DoNodeCreatedL();
       
   147     void DoNodeReleasedL();
       
   148     void DoNodeActivatedL();
       
   149     void DoNodeExtentChangedL();
       
   150     void DoNodeSiblingOrderChangedL();
       
   151     void DoNodeFlagChangedL();    
       
   152 	void DoNodeFadeCountChangedL();
       
   153 	void DoNodeTransparentRegionChangedL();
       
   154 	void DoNodeLayerAddedL();
       
   155 	void DoNodeLayerExtentChangedL();
       
   156 	void DoNodeLayerUsesAlphaFlagChangedL();
       
   157 	void DoNodeMovedToWindowGroupL();
       
   158 	void DoNodeWindowGroupChainedL();
       
   159 	void DoNodeWindowGroupChainBrokenAfterL();
       
   160 	void DoNodeAttributeChangedL();
       
   161 	void DoNodeDebugTrackL();
       
   162 	void DoNodeFadeAllChildrenL();
       
   163 private: // from bridge
       
   164     
       
   165     virtual void BridgerCallback( TInt aOp, TInt aInt );
       
   166     virtual void BridgerCanceled()
       
   167         {
       
   168         }
       
   169 
       
   170     void SetSynchMessage(const RMessage2* aMsg)
       
   171         {
       
   172         iMessage = *aMsg;
       
   173         }
       
   174 public:
       
   175     
       
   176     /*
       
   177      * Shared chunk handle. Owned by CAlfRenderStage's CAlfSendBuffer
       
   178      */
       
   179 
       
   180 	TUint8* ChunkBase( TUint32 aChunkIndex = 0)
       
   181 		{
       
   182 		if ( aChunkIndex == 0 )
       
   183 		    {
       
   184 		    return iChunk.Base() +  sizeof( TChunkHeader);
       
   185 		    }
       
   186 		else
       
   187 		    {
       
   188 		    return iCacheChunks.Find( aChunkIndex )->Base() +  sizeof( TChunkHeader);
       
   189 		    }
       
   190 		
       
   191 		}
       
   192     
       
   193 	   CAlfNodeRoot* iRootNode;
       
   194     
       
   195 private: // variables
       
   196 
       
   197     RChunk iChunk;
       
   198     
       
   199     RHashMap<TUint32,RChunk> iCacheChunks;
       
   200     
       
   201     TInt32 iChunkInUse;
       
   202         
       
   203 
       
   204     CAlfStreamerServer& iServer;
       
   205 
       
   206     /*
       
   207      * Readstream for the above chunk.
       
   208      */
       
   209     RMemReadStream* iStream;
       
   210 
       
   211     // Todo: debug only
       
   212     TInt iUsedCommands[100];
       
   213 
       
   214     RRegion iUpdateRegion;
       
   215     
       
   216     RMessagePtr2 iMessage;
       
   217     
       
   218     RMessagePtr2 iSpaceNotificationMessage;
       
   219     
       
   220     TBool iWaitingBridgerToComplete;
       
   221     
       
   222     RCriticalSection iSema;
       
   223 
       
   224     CAlfNode* iPreviouslySearchedNode;
       
   225     
       
   226     /*
       
   227      * For debugging the amount of drawn frames
       
   228      */
       
   229     TInt iFrame;
       
   230     
       
   231     TChunkHeader* iChunkHeader;
       
   232     
       
   233     CFbsBitGc* iGc;
       
   234     
       
   235     RArray<RMessagePtr2> iPendingAlfWindowDataMessages;
       
   236     
       
   237     TPoint	iWindowPos;
       
   238     
       
   239     friend class CAlfNode;
       
   240     
       
   241     TInt iScreenNumber;
       
   242     
       
   243     CPeriodic*  iPeriodic;
       
   244     
       
   245     TInt iSpaceNotificationCounter;
       
   246     
       
   247     TBool iBatchAlreadyCommited;
       
   248     
       
   249 	TBool iSpaceNotificationMessageOrphean;
       
   250 	
       
   251 	TInt iPreviousCallbackOffset;
       
   252 	
       
   253 	TInt iSearchNode;
       
   254 	
       
   255 #ifdef ALF_DEBUG_TRACK_DRAWING 
       
   256 	CAlfCommandDebug* iCommandDebugger;
       
   257 #endif	
       
   258     TBool iDidForcedComplete;
       
   259     };
       
   260 
       
   261 #endif