author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 18 Aug 2010 11:34:25 +0300 | |
changeset 51 | a7c938434754 |
parent 32 | 8b9155204a54 |
child 57 | 01e38b33e72a |
permissions | -rw-r--r-- |
32 | 1 |
/* |
51
a7c938434754
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
2 |
* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies). |
32 | 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: |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
#ifndef __OPENFONTS_PRIVATE_H__ |
|
20 |
#define __OPENFONTS_PRIVATE_H__ |
|
21 |
||
51
a7c938434754
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
22 |
#include <hextree.h> |
32 | 23 |
#include <e32hashtab.h> |
51
a7c938434754
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
24 |
|
32 | 25 |
class COpenFontShaperCacheEntry; |
26 |
||
27 |
/* MSB is set to indicate a glyph code rather than a unicode value |
|
28 |
This is used for extracting the code value */ |
|
29 |
#define GLYPH_CODE(code) (code & 0x7fffffff) |
|
30 |
||
31 |
/** COpenFontFile owned container for extra data. May be extended without affecting Binary Compatibility. |
|
32 |
||
33 |
@internalComponent |
|
34 |
*/ |
|
35 |
||
36 |
class TOpenFontFileData |
|
37 |
{ |
|
38 |
public: |
|
39 |
CFontStore* iFontStore; // pointer to the CFontStore instance that loaded the COpenFontFile |
|
40 |
}; |
|
41 |
||
42 |
/** |
|
51
a7c938434754
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
43 |
Note: this class must be self-contained, since instances are added to an RHexTree, |
a7c938434754
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
44 |
that is, it must be possible to destroy instances simply with RHeap::Free(). |
32 | 45 |
@internalComponent |
46 |
*/ |
|
47 |
class COpenFontGlyph |
|
48 |
{ |
|
49 |
public: |
|
51
a7c938434754
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
50 |
static COpenFontGlyph* New(RHeap* aHeap, TInt aCode, TInt aGlyphIndex, |
a7c938434754
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
51 |
const TOpenFontCharMetrics& aMetrics, const TDesC8& aBitmap); |
a7c938434754
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
52 |
inline static void Delete(RHeap* aHeap, COpenFontGlyph* aGlyph); |
a7c938434754
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
53 |
inline const TUint8* Bitmap() const; |
32 | 54 |
|
55 |
protected: |
|
51
a7c938434754
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
56 |
COpenFontGlyph(TInt aCode, TInt aGlyphIndex, const TOpenFontCharMetrics& aMetrics) |
a7c938434754
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
57 |
: iCode(aCode), iGlyphIndex(aGlyphIndex), iMetrics(aMetrics), iBitmapOffset(0) {} |
a7c938434754
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
58 |
~COpenFontGlyph() {} |
a7c938434754
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
59 |
void SetBitmap(const TAny* aBitmap); |
a7c938434754
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
60 |
|
a7c938434754
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
61 |
public: |
a7c938434754
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
62 |
const TInt iCode; // the Unicode value of the character |
a7c938434754
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
63 |
const TInt iGlyphIndex; // the glyph index |
a7c938434754
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
64 |
const TOpenFontCharMetrics iMetrics; // the metrics |
a7c938434754
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
65 |
|
32 | 66 |
private: |
67 |
// an offset from this COpenFontGlyph object to a pointer to the run-length-encoded bitmap, |
|
68 |
// calculated as (bitmapPointer)-(this) |
|
51
a7c938434754
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
69 |
TInt iBitmapOffset; |
32 | 70 |
}; |
71 |
||
72 |
/** |
|
51
a7c938434754
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
73 |
* Template for offset implementation of pointer array |
32 | 74 |
@internalComponent |
75 |
*/ |
|
76 |
template<class T> |
|
77 |
class ROffsetArray |
|
78 |
{ |
|
79 |
public: |
|
80 |
ROffsetArray(); |
|
81 |
TInt Create(RHeap* aHeap, TInt aCount); |
|
82 |
void Close(RHeap* aHeap); |
|
83 |
TInt Count() const; |
|
84 |
T* operator[](TInt aIndex) const; |
|
85 |
void SetAt(TInt aIndex, T* aEntry); |
|
86 |
private: |
|
87 |
TInt iOffset; |
|
88 |
TInt iCount; |
|
89 |
}; |
|
90 |
||
91 |
||
92 |
/** |
|
93 |
The per-font glyph cache. For now, just the members that used to be directly in |
|
94 |
COpenFont. Now it is a private class it can be elaborated to do character-to-glyph-index |
|
95 |
mapping when that is needed. |
|
96 |
||
97 |
@internalComponent |
|
98 |
*/ |
|
99 |
class COpenFontGlyphCache |
|
100 |
{ |
|
101 |
public: |
|
51
a7c938434754
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
102 |
COpenFontGlyphCache(RHeap* aHeap) |
a7c938434754
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
103 |
: iGlyphTreeById(aHeap), |
a7c938434754
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
104 |
iGlyphTreeByUnicode(aHeap), |
a7c938434754
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
105 |
iGlyphCacheMemory(0), |
a7c938434754
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
106 |
iShaperCacheSentinel(NULL), |
a7c938434754
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
107 |
iShapingInfoCacheMemory(0), |
a7c938434754
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
108 |
iNumberOfShaperCacheEntries(0) |
a7c938434754
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
109 |
{} |
32 | 110 |
TShapeHeader* SearchShaperCache(TInt aSessionHandle, TFontShapeFunctionParameters*& aParams); |
111 |
TShapeHeader* Insert(TInt aSessionHandle, RHeap* aHeap, CShaper::TInput aInput, TShapeHeader* aShapeHeader, TInt& aAddedBytes); |
|
112 |
TInt DeleteLeastRecentlyUsedEntry(RHeap* aHeap); |
|
113 |
TBool ShaperCacheIsEmpty(); |
|
114 |
||
115 |
public: |
|
51
a7c938434754
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
116 |
RHexTree<COpenFontGlyph> iGlyphTreeById; // a hex tree of glyphs indexed by glyph ID |
a7c938434754
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
117 |
RHexTree<COpenFontGlyph> iGlyphTreeByUnicode; // a hex tree of glyphs indexed by Unicode code point |
32 | 118 |
TInt iGlyphCacheMemory; // memory used by the glyph tree in bytes |
119 |
COpenFontShaperCacheEntry* iShaperCacheSentinel; |
|
120 |
TInt iShapingInfoCacheMemory; |
|
121 |
TInt iNumberOfShaperCacheEntries; |
|
122 |
}; |
|
123 |
||
124 |
/** |
|
125 |
@internalComponent |
|
126 |
*/ |
|
127 |
class COpenFontSessionCacheEntry: public COpenFontGlyph |
|
128 |
{ |
|
129 |
public: |
|
130 |
static COpenFontSessionCacheEntry* New(RHeap* aHeap, const COpenFont* aFont, TInt aCode, TInt aGlyphIndex, |
|
131 |
const TOpenFontCharMetrics& aMetrics, const TDesC8& aBitmap); |
|
51
a7c938434754
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
132 |
inline static void Delete(RHeap* aHeap, COpenFontSessionCacheEntry* aEntry); |
32 | 133 |
inline const COpenFont* Font()const; |
134 |
||
135 |
private: |
|
136 |
inline COpenFontSessionCacheEntry(const COpenFont* aFont, TInt aCode, TInt aGlyphIndex, const TOpenFontCharMetrics& aMetrics); |
|
137 |
~COpenFontSessionCacheEntry(); |
|
138 |
public: |
|
139 |
TInt iLastAccess; // serial number of the last access to the glyph |
|
140 |
||
141 |
private: |
|
142 |
TInt iFontOffset; // offset of the font that contains this glyph, (not owned by this class!) |
|
143 |
}; |
|
144 |
||
145 |
/** |
|
146 |
A glyph cache for a particular session. |
|
147 |
Because session caches are not shared they can shrink as well as grow. |
|
148 |
||
149 |
@internalComponent |
|
150 |
*/ |
|
151 |
class COpenFontSessionCache |
|
152 |
{ |
|
153 |
public: |
|
154 |
static COpenFontSessionCache* NewL(RHeap* aHeap, TInt aSessionHandle, TInt aEntries); |
|
155 |
void Delete(RHeap* aHeap); |
|
156 |
||
157 |
TInt SessionHandle() { return iSessionHandle; } |
|
158 |
const COpenFontGlyph* Glyph(const COpenFont* aFont, TInt aCode, TInt& aIndex); |
|
159 |
void Insert(RHeap* aHeap, COpenFontSessionCacheEntry* aEntry, TInt aIndex); |
|
160 |
||
161 |
private: |
|
162 |
COpenFontSessionCache(TInt aSessionHandle); |
|
163 |
~COpenFontSessionCache(); |
|
164 |
public: |
|
165 |
TInt iSessionHandle; |
|
166 |
TInt iLastAccess; |
|
167 |
ROffsetArray<COpenFontSessionCacheEntry> iEntryArray; |
|
168 |
}; |
|
169 |
||
170 |
||
171 |
class TFontTableGlyphOutlineCacheMemMonitor |
|
172 |
{ |
|
173 |
public: |
|
174 |
TFontTableGlyphOutlineCacheMemMonitor(); |
|
175 |
void Inc(TInt aBytes); |
|
176 |
void Dec(TInt aBytes); |
|
177 |
TInt GetMemUsage(); |
|
178 |
private: |
|
179 |
TInt iBytes; |
|
180 |
}; |
|
181 |
||
182 |
struct TCacheUserInfo { |
|
183 |
TInt iSessionHandle; |
|
184 |
TInt iRefCount; |
|
185 |
TCacheUserInfo(TInt aSessionHandle, TInt aRefCount = 0): |
|
186 |
iSessionHandle(aSessionHandle), iRefCount(aRefCount) { } |
|
187 |
}; |
|
188 |
||
189 |
class CFontTableCache; |
|
190 |
||
191 |
class CFontTableCacheItem |
|
192 |
{ |
|
193 |
friend class CFontTableCache ; |
|
194 |
||
195 |
public: |
|
196 |
CFontTableCacheItem(TUid &aFileUid, const TUint32 aTag, |
|
197 |
TInt aOffset, TInt aLength); |
|
198 |
~CFontTableCacheItem(); |
|
199 |
||
200 |
TInt DecRefCount(TInt aSessionHandle); |
|
201 |
TInt IncRefCount(TInt aSessionHandle); |
|
202 |
||
203 |
TBool HasOutstandingRefCount(); |
|
204 |
TInt FindUser(TInt aSessionHandle, TInt *id); |
|
205 |
||
206 |
#ifdef _DEBUG |
|
207 |
void SetUser(RPointerArray<TCacheUserInfo> users) |
|
208 |
{ |
|
209 |
TInt len = users.Count(); |
|
210 |
for( TInt i = 0; i < len ; i++ ) |
|
211 |
{ |
|
212 |
iUsers.Append(users[i]); |
|
213 |
} |
|
214 |
} |
|
215 |
#endif |
|
216 |
||
217 |
private: |
|
218 |
CFontTableCacheItem(const CFontTableCacheItem &); // disallow copy construction. |
|
219 |
CFontTableCacheItem& operator =(const CFontTableCacheItem &); // disallow assignment. |
|
220 |
||
221 |
TUid iFileUid; |
|
222 |
TUint32 iTag; |
|
223 |
||
224 |
||
225 |
TInt iOffset; |
|
226 |
TInt iLength; |
|
227 |
RPointerArray<TCacheUserInfo> iUsers; |
|
228 |
}; |
|
229 |
||
230 |
||
231 |
class CFontTableCache |
|
232 |
{ |
|
233 |
public: |
|
234 |
CFontTableCache(RHeap* aHeap, TFontTableGlyphOutlineCacheMemMonitor& aMon); |
|
235 |
~CFontTableCache(); |
|
236 |
TInt Append(TUid aFileUid, TUint32 aTag, |
|
237 |
TAny*& aContent, TInt aLength); |
|
238 |
TInt Find(TUid aFileUid, TUint32 aTag, TAny*& aContent, TInt& aLength, TInt* id); |
|
239 |
TInt IncRefCount(TUid FileUid, TUint32 aTag, TInt aSessionHandle); |
|
240 |
TInt DecRefCount(TUid aFileUid, TUint32 aTag, TInt aSessionHandle); |
|
241 |
TBool HasOutstandingRefCount(); |
|
242 |
TBool HasOutstandingRefCountWithUid(TUid aFileUid); |
|
243 |
void CleanupCacheOnFbsSessionTermination(TInt aSessionHandle); |
|
244 |
void CleanupCacheOnOpenFontFileRemoval(COpenFontFile*); |
|
245 |
#ifdef _DEBUG |
|
246 |
void SetFontItem(RPointerArray<CFontTableCacheItem> cacheItems) |
|
247 |
{ |
|
248 |
TInt len = cacheItems.Count(); |
|
249 |
for(TInt i = 0; i < len; i++) |
|
250 |
{ |
|
251 |
iCacheItems.Append(cacheItems[i]); |
|
252 |
} |
|
253 |
} |
|
254 |
#endif |
|
255 |
||
256 |
private: |
|
257 |
CFontTableCache(const CFontTableCache &); // no copy construction. |
|
258 |
CFontTableCache& operator =(const CFontTableCache &); // no assignment. |
|
259 |
#ifdef _DEBUG |
|
260 |
TInt GetCacheState(const char *func); |
|
261 |
#endif |
|
262 |
||
263 |
TFontTableGlyphOutlineCacheMemMonitor &iCacheMemMon; |
|
264 |
RHeap *iHeap; |
|
265 |
RPointerArray<CFontTableCacheItem> iCacheItems; |
|
266 |
}; |
|
267 |
||
268 |
||
269 |
class TUnhintedOutlineCache; |
|
270 |
||
271 |
class TUnhintedOutlineId |
|
272 |
{ |
|
273 |
public: |
|
274 |
TUnhintedOutlineId(TUid aFileUid, TInt aFaceIndex, TUint aId); |
|
275 |
TUid iFileUid; |
|
276 |
TInt iFaceIndex; |
|
277 |
TUint iId; |
|
278 |
}; |
|
279 |
||
280 |
class COutlineCacheItem { |
|
281 |
friend class CUnhintedOutlineCache; |
|
282 |
friend class CHintedOutlineCache; |
|
283 |
||
284 |
public: |
|
285 |
COutlineCacheItem(TInt aOffset, TInt aLength); |
|
286 |
~COutlineCacheItem() ; |
|
287 |
||
288 |
TInt DecRefCount(TInt aSessionHandle); |
|
289 |
TInt IncRefCount(TInt aSessionHandle); |
|
290 |
#ifdef _DEBUG |
|
291 |
void SetUser(RPointerArray<TCacheUserInfo> users) |
|
292 |
{ |
|
293 |
TInt len = users.Count(); |
|
294 |
for( TInt i = 0; i < len ; i++ ) |
|
295 |
{ |
|
296 |
iUsers.Append(users[i]); |
|
297 |
} |
|
298 |
} |
|
299 |
#endif |
|
300 |
||
301 |
private: |
|
302 |
TInt FindUser(TInt aSessionHandle, TInt *id); |
|
303 |
||
304 |
||
305 |
TInt iOffset; |
|
306 |
TInt iLength; |
|
307 |
RPointerArray<TCacheUserInfo> iUsers; |
|
308 |
}; |
|
309 |
||
310 |
class CUnhintedOutlineCache { |
|
311 |
public: |
|
312 |
CUnhintedOutlineCache(RHeap* aHeap, TFontTableGlyphOutlineCacheMemMonitor& aMon); |
|
313 |
TInt Find(const TUnhintedOutlineId &aOutlineId, TAny*& aData, TInt& aLength); |
|
314 |
TInt IncRefCount(const TUnhintedOutlineId& aOutlineId, TInt aSessionHandle); |
|
315 |
TInt DecRefCount(const TUnhintedOutlineId& aOutlineId, TInt aSessionHandle); |
|
316 |
TInt CacheUnhintedOutline(const TUnhintedOutlineId& aOutlineId, |
|
317 |
TAny * const aData, const TInt aLength, TAny*& aOutline, TInt &aLen); |
|
318 |
TInt CleanupCacheOnOpenFontFileRemoval(COpenFontFile* aFontFile); |
|
319 |
TInt CleanupCacheOnFbsSessionTermination(TInt aSessionHandle); |
|
320 |
#ifdef _DEBUG |
|
321 |
TInt GetCacheState(const char *func); |
|
322 |
#endif |
|
323 |
~CUnhintedOutlineCache(); |
|
324 |
||
325 |
#ifdef _DEBUG |
|
326 |
void SetUnHintedItem(TUnhintedOutlineId id, COutlineCacheItem* item) |
|
327 |
{ |
|
328 |
iItemIdMap.Insert(id, item); |
|
329 |
} |
|
330 |
#endif |
|
331 |
||
332 |
private: |
|
333 |
// disallow assignment and copy-construction |
|
334 |
CUnhintedOutlineCache(const CUnhintedOutlineCache &); |
|
335 |
CUnhintedOutlineCache& operator =(const CUnhintedOutlineCache &); |
|
336 |
||
337 |
static TUint32 IdHash(const TUnhintedOutlineId& aOutlineId); |
|
338 |
static TBool IdIdentity(const TUnhintedOutlineId& id1, const TUnhintedOutlineId& id2); |
|
339 |
||
340 |
TFontTableGlyphOutlineCacheMemMonitor& iCacheMemMon; |
|
341 |
RHeap* iHeap; |
|
342 |
RHashMap<TUnhintedOutlineId, COutlineCacheItem*> iItemIdMap; // map the identity to an index in 'iCacheItems'. |
|
343 |
}; |
|
344 |
||
345 |
class CHintedOutlineCache; |
|
346 |
||
347 |
class THintedOutlineId |
|
348 |
{ |
|
349 |
public: |
|
350 |
THintedOutlineId(COpenFont* aFont, TUint aId); |
|
351 |
COpenFont *iFont; |
|
352 |
TUint iId; |
|
353 |
}; |
|
354 |
||
355 |
||
356 |
class CHintedOutlineCache { |
|
357 |
public: |
|
358 |
CHintedOutlineCache(RHeap* aHeap, TFontTableGlyphOutlineCacheMemMonitor& aMon); |
|
359 |
TInt Find(const THintedOutlineId& aOutlineId, TAny*& aData, TInt& aLength); |
|
360 |
TInt IncRefCount(const THintedOutlineId& aOutlineId, TInt aSessionHandle); |
|
361 |
TInt DecRefCount(const THintedOutlineId& aOutlineId, TInt aSessionHandle); |
|
362 |
TInt CacheHintedOutline(const THintedOutlineId& aOutlineId, |
|
363 |
TAny* aData, TInt aLength, TAny*& aOutline, TInt& aLen); |
|
364 |
TInt CleanupCacheOnOpenFontRemoval(COpenFont* aFont); |
|
365 |
TInt CleanupCacheOnFbsSessionTermination(TInt aSessionHandle); |
|
366 |
#ifdef _DEBUG |
|
367 |
TInt GetCacheState(const char *func); |
|
368 |
void SetHintedItem(THintedOutlineId id, COutlineCacheItem* item) |
|
369 |
{ |
|
370 |
iItemIdMap.Insert(id, item); |
|
371 |
} |
|
372 |
RHashMap<THintedOutlineId, COutlineCacheItem*> GetHintedMap() |
|
373 |
{ |
|
374 |
return iItemIdMap; |
|
375 |
} |
|
376 |
#endif |
|
377 |
||
378 |
private: |
|
379 |
// disallow assignment and copy-construction |
|
380 |
CHintedOutlineCache(const CHintedOutlineCache &); |
|
381 |
CHintedOutlineCache& operator =(const CHintedOutlineCache &); |
|
382 |
static TUint32 IdHash(const THintedOutlineId& aOutlineId); |
|
383 |
static TBool IdIdentity(const THintedOutlineId& id1, const THintedOutlineId& id2); |
|
384 |
||
385 |
TFontTableGlyphOutlineCacheMemMonitor& iCacheMemMon; |
|
386 |
RHeap* iHeap; |
|
387 |
RHashMap<THintedOutlineId, COutlineCacheItem*> iItemIdMap; // map the identity to an index in 'iCacheItems'. |
|
388 |
}; |
|
389 |
||
390 |
||
391 |
// inline functions |
|
51
a7c938434754
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
392 |
|
a7c938434754
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
393 |
inline void COpenFontGlyph::Delete(RHeap* aHeap, COpenFontGlyph* aGlyph) |
a7c938434754
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
394 |
{ |
a7c938434754
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
395 |
aHeap->Free(aGlyph); |
a7c938434754
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
396 |
} |
a7c938434754
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
397 |
|
a7c938434754
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
398 |
/** |
a7c938434754
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
399 |
@return A pointer to the bitmap data stored with this glyph, or NULL |
a7c938434754
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
400 |
if no bitmap has been stored with this glyph. |
a7c938434754
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
401 |
*/ |
a7c938434754
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
402 |
inline const TUint8* COpenFontGlyph::Bitmap() const |
a7c938434754
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
403 |
{ |
a7c938434754
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
404 |
if (iBitmapOffset) |
a7c938434754
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
405 |
{ |
a7c938434754
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
406 |
return reinterpret_cast<const TUint8*>(PtrAdd(this, iBitmapOffset)); |
a7c938434754
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
407 |
} |
a7c938434754
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
408 |
return NULL; |
a7c938434754
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
409 |
} |
a7c938434754
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
410 |
|
32 | 411 |
inline COpenFontSessionCacheEntry::COpenFontSessionCacheEntry(const COpenFont* aFont, TInt aCode, TInt aGlyphIndex,const TOpenFontCharMetrics& aMetrics) : |
412 |
COpenFontGlyph(aCode, aGlyphIndex, aMetrics) |
|
413 |
{ |
|
414 |
iFontOffset = aFont ? reinterpret_cast<TInt>(aFont) - reinterpret_cast<TInt>(this) : 0; |
|
415 |
} |
|
416 |
||
51
a7c938434754
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
417 |
inline void COpenFontSessionCacheEntry::Delete(RHeap* aHeap, COpenFontSessionCacheEntry* aEntry) |
a7c938434754
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
418 |
{ |
a7c938434754
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
419 |
COpenFontGlyph::Delete(aHeap, aEntry); |
a7c938434754
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
420 |
} |
32 | 421 |
|
422 |
inline const COpenFont* COpenFontSessionCacheEntry::Font() const |
|
423 |
{ |
|
424 |
if (iFontOffset) |
|
425 |
{ |
|
426 |
return reinterpret_cast<const COpenFont*> (PtrAdd(this, iFontOffset)); |
|
427 |
} |
|
51
a7c938434754
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
428 |
return NULL; |
32 | 429 |
} |
430 |
||
431 |
#endif // __OPENFONTSPRIVATE_H__ |