windowing/windowserver/nga/remotegc/DrawableCache.h
changeset 0 5d03bc08d59c
equal deleted inserted replaced
-1:000000000000 0:5d03bc08d59c
       
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #ifndef __DRAWABLECACHE_H__
       
    17 #define __DRAWABLECACHE_H__
       
    18 
       
    19 #include <e32cmn.h>
       
    20 #include <graphics/sgresource.h>
       
    21 
       
    22 #include "W32STD.H"
       
    23 
       
    24 /**
       
    25 @file
       
    26 @internalComponent
       
    27 Provides functionality which is used by RemoteGc.
       
    28 */
       
    29 
       
    30 class RWsDrawableSource;
       
    31 class MWsDrawableSourceProvider;
       
    32 class CGraphicsResourceWrapperFactory;
       
    33 class CGraphicsResourceWrapper;
       
    34 
       
    35 /**
       
    36 @internalComponent
       
    37 */
       
    38 NONSHARABLE_CLASS(CDrawableCacheBase): public CBase
       
    39 	{
       
    40 public:
       
    41 	virtual TInt UseL(const TSgDrawableId& aDrawableId, TInt aScreenNumber) = 0;
       
    42 	const TAny* Resolve(const TSgDrawableId& aDrawableId, TInt aScreenNumber) const;
       
    43 protected:
       
    44 	class TCacheEntry
       
    45 		{
       
    46 	public:
       
    47 		TCacheEntry(const TSgDrawableId& aDrawableId, TInt aScreenNumber)
       
    48 			: iDrawableId(aDrawableId), iScreenNumber(aScreenNumber), iCachedItem(NULL)
       
    49 			{}
       
    50 	public:
       
    51 		TSgDrawableId iDrawableId;
       
    52 		TInt iScreenNumber;
       
    53 		TAny* iCachedItem;
       
    54 		};
       
    55 protected:
       
    56 	static TInt Compare(const TCacheEntry &aFirstEntry, const TCacheEntry &aSecondEntry);
       
    57 protected:
       
    58 	RArray<TCacheEntry> iCachedItems;
       
    59 	};
       
    60 
       
    61 /**
       
    62 @internalComponent
       
    63 */
       
    64 NONSHARABLE_CLASS(CWindowDrawableCache): public CDrawableCacheBase
       
    65 	{
       
    66 public:
       
    67 	CWindowDrawableCache(RWsSession& aSession);
       
    68 	~CWindowDrawableCache();
       
    69 	TInt UseL(const TSgDrawableId& aDrawableId, TInt aScreenNumber);
       
    70 private:
       
    71 	RWsSession& iWsSession;
       
    72 	CGraphicsResourceWrapperFactory* iGrwFactory;
       
    73 	CGraphicsResourceWrapper* iGraphicsResource;
       
    74 	};
       
    75 
       
    76 /**
       
    77 @internalComponent
       
    78 */
       
    79 NONSHARABLE_CLASS(CRenderStageDrawableCache): public CDrawableCacheBase
       
    80 	{
       
    81 public:
       
    82 	CRenderStageDrawableCache(MWsDrawableSourceProvider* aDrawResource);
       
    83 	~CRenderStageDrawableCache();
       
    84 	TInt UseL(const TSgDrawableId& aDrawableId, TInt aScreenNumber);
       
    85 private:
       
    86 	MWsDrawableSourceProvider* iDrawResource;
       
    87 	};
       
    88 
       
    89 #endif //__DRAWABLECACHE_H__