Update contrib.
1 // Copyright (c) 2007-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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #ifndef VGIMAGECACHE_H_
17 #define VGIMAGECACHE_H_
21 @internalComponent Reference implementation of Open VG hardware accelerated DirectGDI adaptation.
24 #include <VG/openvg.h>
25 #include <e32hashtab.h>
26 #include <graphics/directgdiextensioninterfaces.h>
30 A class for managing a cache of VGImages.
31 Each VGImage has a CFbsBitmap associated with it.
32 The CFbsBitmap's serial number is used to retrieve VGImages from the cache
33 as these are unique to the bitmap for the lifetime of the system.
35 NONSHARABLE_CLASS(CVgImageCache): public CBase, public MVgImageCache
38 CVgImageCache(TInt aMaxCacheSize);
40 TBool AddImage(const CFbsBitmap& aBitmap, VGImage& aImage, const TPoint& aOrigin);
41 VGImage GetVgImageFromBitmap(const CFbsBitmap& aBitmap, const TPoint& aOrigin);
43 //MVgImageCache commands
44 TBool IsInCache(TInt64 aSerialNumber); /**< @internalTechnology*/
45 TInt TouchCount(TInt64 aSerialNumber); /**< @internalTechnology*/
46 TInt NumEntries() const; /**< @internalTechnology*/
47 void GetOrderedCacheEntries(TInt64& aSerialNumberList, TInt aListSize); /**< @internalTechnology*/
48 TInt CacheSizeInBytes() const; /**< @internalTechnology*/
49 TInt MaxCacheSize() const; /**< @internalTechnology*/
50 void ResetCache(); /**< @internalTechnology*/
51 TInt SetMaxCacheSize(TInt aMaxCacheSize); /**< @internalTechnology*/
54 NONSHARABLE_CLASS(CVgImageCacheItem): public CBase
61 VGImage iImage; /**< VGImage created from CFbsBitmap.*/
62 TInt64 iSerialNumber; /**< Bitmap ID used to select VGImage.*/
63 TInt iImageSizeInBytes;
64 TInt iTouchCount; /**< Touch count of CFbsBitmap when VGImage was stored.*/
65 TPoint iOrigin; /**< Origin used to tile image when created.*/
67 void DeleteItem(CVgImageCacheItem* aItem);
68 static TUint32 Hash(const TInt64& aKey);
71 RHashMap<TInt64, CVgImageCacheItem*> iCacheItemMap; /**< Maps bitmap's unique identifier to a cache item.*/
72 TDblQue<CVgImageCacheItem> iVgImageCache; /**< Least-recently used ordered queue (most-recently used at head).*/
73 TInt iCacheSizeInBytes;
74 TInt iMaxCacheSizeInBytes;
75 TInt iNumMatchMisses; /**< Number of unsuccessful matches when retrieving VGImage from cache.*/
76 TInt iNumMatchTries; /**< Number of attempts to retrieve VGImage from cache.*/
79 #endif /*VGIMAGECACHE_H_*/