|
1 // Copyright (c) 1998-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 __UTILS_H__ |
|
17 #define __UTILS_H__ |
|
18 |
|
19 #include <e32std.h> |
|
20 #include <gdi.h> |
|
21 #include <fntstore.h> |
|
22 #include <bitmap.h> |
|
23 |
|
24 |
|
25 |
|
26 /** |
|
27 @internalComponent |
|
28 */ |
|
29 _LIT(KFBSERVPanicCategory,"FBSERV"); |
|
30 _LIT(KFBSERVGlobalThreadName,"!Fontbitmapserver"); |
|
31 _LIT(KFBSERVSharedChunkName,"FbsSharedChunk"); |
|
32 _LIT(KFBSERVLargeChunkName,"FbsLargeChunk"); |
|
33 #ifdef SYMBIAN_DEBUG_FBS_LOCKHEAP |
|
34 _LIT(KFBSERVDebugMutexName,"FbsDebugMutex"); |
|
35 #endif |
|
36 |
|
37 /** |
|
38 @internalComponent |
|
39 */ |
|
40 const TUid KUidCFbsBitmapCreation={0x0009A2C}; |
|
41 /** |
|
42 @internalComponent |
|
43 */ |
|
44 enum TFbsPanic |
|
45 { |
|
46 EFbsPanicNoConnection=1, |
|
47 EFbsPanicBadConnection, |
|
48 EFbsPanicUnknownMessage, |
|
49 EFbsPanicActiveSchedulerError, |
|
50 EFbsPanicStartupFailed, |
|
51 EFbsTypefaceStoreError, |
|
52 EFbsFontCreateFailed, |
|
53 EFbsFontAddressViolation, |
|
54 EFbsBitmapInvalidFormat, |
|
55 EFbsBitmapInvalidMode, |
|
56 EFbsBitmapInvalidCompression, |
|
57 EFbsBitmapDecompressionError, |
|
58 EFbsPanicChunkError, |
|
59 EFbsColor256UtilError, |
|
60 EFbsHardwareBitmapError, |
|
61 EFbsNotSupportedForCompression, |
|
62 EFbsBitmapAlignment, |
|
63 EFbsBitmapInvalidScanLinePtr, |
|
64 EFbsBitmapInvalidMode2, |
|
65 EFbsBitmapInvalidMode3, |
|
66 EFbsBitmapSwappingImpossible, |
|
67 EFbsPanicBadHeapLock, |
|
68 EFbsShaperNotYetCalled, |
|
69 EFbsShaperInvalidArguments, |
|
70 EFbsInvalidCompressionThreshold, |
|
71 EFbsTypefaceIndexOutOfRange, |
|
72 EFbsPanicBitmapDataCopy, |
|
73 EFbsPanicBitmapReadOnly |
|
74 }; |
|
75 |
|
76 class TScanLine |
|
77 /** |
|
78 @internalComponent |
|
79 */ |
|
80 { |
|
81 public: |
|
82 TPoint iPoint; |
|
83 TInt iLength; |
|
84 TDisplayMode iDispMode; |
|
85 }; |
|
86 |
|
87 class TBmpSpec |
|
88 /** |
|
89 @internalComponent |
|
90 */ |
|
91 { |
|
92 public: |
|
93 TSize iSizeInPixels; |
|
94 TDisplayMode iDispMode; |
|
95 TInt iHandle; |
|
96 TInt iServerHandle; |
|
97 TInt iAddressOffset; |
|
98 }; |
|
99 |
|
100 class TBmpHandles |
|
101 /** |
|
102 @internalComponent |
|
103 */ |
|
104 { |
|
105 public: |
|
106 TInt iHandle; |
|
107 TInt iServerHandle; |
|
108 TInt iAddressOffset; |
|
109 }; |
|
110 |
|
111 class TFontInfo |
|
112 /** |
|
113 @internalComponent |
|
114 */ |
|
115 { |
|
116 public: |
|
117 TInt iHandle; |
|
118 TInt iAddressOffset; |
|
119 TInt iServerHandle; |
|
120 }; |
|
121 |
|
122 class TSizeInfo |
|
123 /** |
|
124 @internalComponent |
|
125 */ |
|
126 { |
|
127 public: |
|
128 TSizeInfo(){} |
|
129 TSizeInfo(TInt aMaxHeight,TSize aDevSize):iMaxHeight(aMaxHeight),iDevSize(aDevSize) {} |
|
130 |
|
131 TInt iMaxHeight; |
|
132 TSize iDevSize; |
|
133 }; |
|
134 |
|
135 class TIntParcel |
|
136 /** |
|
137 @internalComponent |
|
138 */ |
|
139 { |
|
140 public: |
|
141 TInt iInt; |
|
142 }; |
|
143 |
|
144 class TLoadBitmapArg |
|
145 /** |
|
146 @internalComponent |
|
147 */ |
|
148 { |
|
149 public: |
|
150 TInt iBitmapId; |
|
151 TInt iShareIfLoaded; |
|
152 TInt iFileOffset; |
|
153 }; |
|
154 |
|
155 |
|
156 IMPORT_C extern const TInt KFbServLargeChunkGrowByShifter; |
|
157 IMPORT_C extern const TInt KFbServLargeChunkSizeShifter; |
|
158 IMPORT_C extern const TInt KFbServLargeChunkMinPhysicalSize; |
|
159 IMPORT_C extern const TInt KFbServLargeChunkMinVirtualSize; |
|
160 IMPORT_C extern const TInt KFbServLargeChunkMaxVirtualSize; |
|
161 |
|
162 |
|
163 class CChunkPile : public CBase |
|
164 /** |
|
165 @internalComponent |
|
166 */ |
|
167 { |
|
168 public: |
|
169 IMPORT_C ~CChunkPile(); |
|
170 IMPORT_C static CChunkPile* NewL(const RChunk& aChunk); |
|
171 IMPORT_C TUint8* Alloc(TInt aSize); |
|
172 IMPORT_C void Free(TAny* aCell); |
|
173 IMPORT_C TUint8* ChunkBase() const; |
|
174 IMPORT_C static TInt VirtualSize(); |
|
175 private: |
|
176 CChunkPile(const RChunk& aChunk); |
|
177 void ConstructL(); |
|
178 TInt DoAlloc(TUint8*& aCell, TInt aSize, RPointerArray<TUint8>& aCells, RArray<TInt>& aFreeCellLinks, TBool aLarge); |
|
179 void DoFree(TUint8* aCell, RPointerArray<TUint8>& aCells, RArray<TInt>& aFreeCellLinks, TBool aLarge); |
|
180 TInt GrowSmallSection(TInt aSize, TInt aLastFreeCell); |
|
181 void ShrinkSmallSection(TInt aShrinkBy); |
|
182 private: |
|
183 RChunk iChunk; |
|
184 TInt iPageSize, iPageMask; |
|
185 RPointerArray<TUint8> iSmallCells; // last address is not a cell but the top of the small section |
|
186 RArray<TInt> iFreeSmallCellLinks; // index of Nth free small cell is element 0 + element 1 + ... + element N-1 |
|
187 TInt iLargeSectionBottom; // boundary between small & large sections |
|
188 RPointerArray<TUint8> iLargeCells; // last address is not a cell but the top of the large section |
|
189 RArray<TInt> iFreeLargeCellLinks; // index of Nth free large cell is element 0 + element 1 + ... + element N-1 |
|
190 RCriticalSection iLock; |
|
191 }; |
|
192 |
|
193 /** |
|
194 Used to pass sizes of FBServs default heap, heap for large bitmaps, and heap for small bitmaps. |
|
195 |
|
196 @internalComponent |
|
197 @test |
|
198 */ |
|
199 struct THeapSizes |
|
200 { |
|
201 TInt iDefault; |
|
202 TInt iBig; |
|
203 TInt iSmall; |
|
204 }; |
|
205 |
|
206 /** |
|
207 Used when the EFbsMessRasterize message is sent from client to server. Allows pointers to items |
|
208 created on the shared FBServ heap to be passed from the server to the client as offsets from the |
|
209 heap base. Valid pointers are recreated client side using these offsets combined with the client's |
|
210 heap base. |
|
211 |
|
212 @internalComponent |
|
213 */ |
|
214 struct TRasterizeParams |
|
215 { |
|
216 TInt iMetricsOffset; |
|
217 TInt iBitmapPointerOffset; |
|
218 }; |
|
219 |
|
220 IMPORT_C extern const TInt KFbServWritableDataPagingMode; |
|
221 |
|
222 /** |
|
223 Used to specify the writable data paging mode of fbserv. |
|
224 This may be set using the patchable constant KFbServWritableDataPagingMode at rom-build time via the definitions: |
|
225 SYMBIAN_GRAPHICS_FBSERV_PAGEDATA -request that fbserv writable data is paged. |
|
226 SYMBIAN_GRAPHICS_FBSERV_UNPAGEDDATA -request that fbserv writable data is unpaged. |
|
227 SYMBIAN_GRAPHICS_FBSERV_PAGE_BITMAP_DATA_ONLY -request that only bitmap data is paged. |
|
228 SYMBIAN_GRAPHICS_FBSERV_PAGE_BITMAP_DATA_AND_SHARED_HEAP_ONLY -request that only bitmap data and shared heap are paged. |
|
229 @internalComponent |
|
230 */ |
|
231 enum TFbsWritableDataPagingMode |
|
232 { |
|
233 EFbsWdpDefault=0x00, //No change to the rom-build writable data paging configuration (nothing was specified). |
|
234 EFbsWdpPagedData=0x01, //SYMBIAN_GRAPHICS_FBSERV_PAGEDATA was specified. |
|
235 EFbsWdpUnpagedData=0x02, //SYMBIAN_GRAPHICS_FBSERV_UNPAGEDDATA was specified. |
|
236 EFbsWdpPageBitmapDataChunkOnly=0x03, //SYMBIAN_GRAPHICS_FBSERV_PAGE_BITMAP_DATA_ONLY was specified. |
|
237 EFbsWdpPageBitmapDataAndSharedHeapChunksOnly=0x04, //SYMBIAN_GRAPHICS_FBSERV_PAGE_BITMAP_DATA_AND_SHARED_HEAP_ONLY was specified. |
|
238 }; |
|
239 |
|
240 #endif |
|
241 |
|
242 |