sl@0
|
1 |
// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
#ifndef VGIMAGECACHE_H_
|
sl@0
|
17 |
#define VGIMAGECACHE_H_
|
sl@0
|
18 |
|
sl@0
|
19 |
/**
|
sl@0
|
20 |
@file
|
sl@0
|
21 |
@internalComponent Reference implementation of Open VG hardware accelerated DirectGDI adaptation.
|
sl@0
|
22 |
*/
|
sl@0
|
23 |
#include <fbs.h>
|
sl@0
|
24 |
#include <VG/openvg.h>
|
sl@0
|
25 |
#include <e32hashtab.h>
|
sl@0
|
26 |
#include <graphics/directgdiextensioninterfaces.h>
|
sl@0
|
27 |
|
sl@0
|
28 |
|
sl@0
|
29 |
/**
|
sl@0
|
30 |
A class for managing a cache of VGImages.
|
sl@0
|
31 |
Each VGImage has a CFbsBitmap associated with it.
|
sl@0
|
32 |
The CFbsBitmap's serial number is used to retrieve VGImages from the cache
|
sl@0
|
33 |
as these are unique to the bitmap for the lifetime of the system.
|
sl@0
|
34 |
*/
|
sl@0
|
35 |
NONSHARABLE_CLASS(CVgImageCache): public CBase, public MVgImageCache
|
sl@0
|
36 |
{
|
sl@0
|
37 |
public:
|
sl@0
|
38 |
CVgImageCache(TInt aMaxCacheSize);
|
sl@0
|
39 |
~CVgImageCache();
|
sl@0
|
40 |
TBool AddImage(const CFbsBitmap& aBitmap, VGImage& aImage, const TPoint& aOrigin);
|
sl@0
|
41 |
VGImage GetVgImageFromBitmap(const CFbsBitmap& aBitmap, const TPoint& aOrigin);
|
sl@0
|
42 |
|
sl@0
|
43 |
//MVgImageCache commands
|
sl@0
|
44 |
TBool IsInCache(TInt64 aSerialNumber); /**< @internalTechnology*/
|
sl@0
|
45 |
TInt TouchCount(TInt64 aSerialNumber); /**< @internalTechnology*/
|
sl@0
|
46 |
TInt NumEntries() const; /**< @internalTechnology*/
|
sl@0
|
47 |
void GetOrderedCacheEntries(TInt64& aSerialNumberList, TInt aListSize); /**< @internalTechnology*/
|
sl@0
|
48 |
TInt CacheSizeInBytes() const; /**< @internalTechnology*/
|
sl@0
|
49 |
TInt MaxCacheSize() const; /**< @internalTechnology*/
|
sl@0
|
50 |
void ResetCache(); /**< @internalTechnology*/
|
sl@0
|
51 |
TInt SetMaxCacheSize(TInt aMaxCacheSize); /**< @internalTechnology*/
|
sl@0
|
52 |
|
sl@0
|
53 |
private:
|
sl@0
|
54 |
NONSHARABLE_CLASS(CVgImageCacheItem): public CBase
|
sl@0
|
55 |
{
|
sl@0
|
56 |
public:
|
sl@0
|
57 |
CVgImageCacheItem();
|
sl@0
|
58 |
~CVgImageCacheItem();
|
sl@0
|
59 |
|
sl@0
|
60 |
TDblQueLink iLink;
|
sl@0
|
61 |
VGImage iImage; /**< VGImage created from CFbsBitmap.*/
|
sl@0
|
62 |
TInt64 iSerialNumber; /**< Bitmap ID used to select VGImage.*/
|
sl@0
|
63 |
TInt iImageSizeInBytes;
|
sl@0
|
64 |
TInt iTouchCount; /**< Touch count of CFbsBitmap when VGImage was stored.*/
|
sl@0
|
65 |
TPoint iOrigin; /**< Origin used to tile image when created.*/
|
sl@0
|
66 |
};
|
sl@0
|
67 |
void DeleteItem(CVgImageCacheItem* aItem);
|
sl@0
|
68 |
static TUint32 Hash(const TInt64& aKey);
|
sl@0
|
69 |
|
sl@0
|
70 |
private:
|
sl@0
|
71 |
RHashMap<TInt64, CVgImageCacheItem*> iCacheItemMap; /**< Maps bitmap's unique identifier to a cache item.*/
|
sl@0
|
72 |
TDblQue<CVgImageCacheItem> iVgImageCache; /**< Least-recently used ordered queue (most-recently used at head).*/
|
sl@0
|
73 |
TInt iCacheSizeInBytes;
|
sl@0
|
74 |
TInt iMaxCacheSizeInBytes;
|
sl@0
|
75 |
TInt iNumMatchMisses; /**< Number of unsuccessful matches when retrieving VGImage from cache.*/
|
sl@0
|
76 |
TInt iNumMatchTries; /**< Number of attempts to retrieve VGImage from cache.*/
|
sl@0
|
77 |
};
|
sl@0
|
78 |
|
sl@0
|
79 |
#endif /*VGIMAGECACHE_H_*/
|