|
1 /* |
|
2 * Copyright (c) 2007-2009 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: |
|
15 * SHAPERCACHE.CPP |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #include <fntstore.h> |
|
21 #include <gdi.h> |
|
22 #include "FNTSTD.H" |
|
23 #include <graphics/shapeimpl.h> |
|
24 |
|
25 const TInt KMaxShaperSesssionCacheMemory = 64*1024; |
|
26 |
|
27 //class to store the handle the handle-reference count |
|
28 class THandleCount |
|
29 { |
|
30 public: |
|
31 THandleCount(TInt aSessionHandle) |
|
32 :iSessionHandle(aSessionHandle),iRefCount(1),iNext(NULL){} |
|
33 public: |
|
34 TInt iSessionHandle; |
|
35 TInt iRefCount; |
|
36 THandleCount* iNext; |
|
37 }; |
|
38 |
|
39 /******************** SHAPER CACHE CLASSES*************************************/ |
|
40 class COpenFontShaperCacheEntry: public CBase |
|
41 { |
|
42 public: |
|
43 static COpenFontShaperCacheEntry* New(RHeap* aHeap, CShaper::TInput aInput, TShapeHeader* aShapeHeader); |
|
44 static COpenFontShaperCacheEntry* New(RHeap* aHeap); |
|
45 static void Delete (RHeap* aHeap, COpenFontShaperCacheEntry* aCache); |
|
46 TBool IsSentinel(){return iShapeHeader==NULL;} |
|
47 TInt IncRefCount(TInt aSessionHandle); |
|
48 TInt DecRefCount(TInt aSessionHandle,TBool aReset=EFalse); |
|
49 private: |
|
50 COpenFontShaperCacheEntry(RHeap* aHeap,CShaper::TInput aInput) |
|
51 :iStart(aInput.iStart),iEnd(aInput.iEnd),iScript(aInput.iScript), iHeap(aHeap){} |
|
52 COpenFontShaperCacheEntry(){} |
|
53 TInt Construct(CShaper::TInput aInput,TShapeHeader* aShapeHeader); |
|
54 public: |
|
55 COpenFontShaperCacheEntry* iPrevious; // pointer to previous node in tree |
|
56 COpenFontShaperCacheEntry* iNext; // pointer to next shaping info node in the list |
|
57 |
|
58 /** The shaped information that is cached */ |
|
59 TShapeHeader* iShapeHeader; |
|
60 /** Input information */ |
|
61 TUint16* iText; |
|
62 TInt iStart; |
|
63 TInt iEnd; |
|
64 TInt iScript; |
|
65 /** pointer to a private heap for allocating the handle-refcount array*/ |
|
66 RHeap* iHeap; |
|
67 /** linked list of THandleCount to store the handle-refcount information */ |
|
68 THandleCount* iHandleRefList; |
|
69 TInt iHandleRefCount; |
|
70 }; |
|
71 |
|
72 /***********************SHAPER CACHE ENDS HERE********************************/ |
|
73 |