First public contribution.
1 // Copyright (c) 1998-2010 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.
23 #include <sgresource/sgimage.h>
30 _LIT(KFBSERVPanicCategory,"FBSERV");
31 _LIT(KFBSERVGlobalThreadName,"!Fontbitmapserver");
32 _LIT(KFBSERVSharedChunkName,"FbsSharedChunk");
33 _LIT(KFBSERVLargeChunkName,"FbsLargeChunk");
34 #ifdef SYMBIAN_DEBUG_FBS_LOCKHEAP
35 _LIT(KFBSERVDebugMutexName,"FbsDebugMutex");
41 const TUid KUidCFbsBitmapCreation={0x0009A2C};
47 EFbsPanicNoConnection = 1,
48 EFbsPanicBadConnection = 2,
49 EFbsPanicUnknownMessage = 3,
50 EFbsPanicActiveSchedulerError = 4,
51 EFbsPanicStartupFailed = 5,
52 EFbsTypefaceStoreError = 6,
53 EFbsFontCreateFailed = 7,
54 EFbsFontAddressViolation = 8,
55 EFbsBitmapInvalidFormat = 9,
56 EFbsBitmapInvalidMode = 10,
57 EFbsBitmapInvalidCompression = 11,
58 EFbsBitmapDecompressionError = 12,
59 EFbsPanicChunkError = 13,
60 EFbsColor256UtilError = 14,
61 EFbsHardwareBitmapError = 15,
62 EFbsNotSupportedForCompression = 16,
63 EFbsBitmapAlignment = 17,
64 EFbsBitmapInvalidScanLinePtr = 18,
65 EFbsBitmapInvalidMode2 = 19,
66 EFbsBitmapInvalidMode3 = 20,
67 EFbsBitmapSwappingImpossible = 21,
68 EFbsPanicBadHeapLock = 22,
69 EFbsShaperNotYetCalled = 23,
70 EFbsShaperInvalidArguments = 24,
71 EFbsInvalidCompressionThreshold = 25,
72 EFbsTypefaceIndexOutOfRange = 26,
73 EFbsPanicBitmapDataCopy = 27,
74 EFbsPanicBitmapReadOnly = 28,
75 EFbsPanicFontNullHandle = 29,
76 EFbsPanicGlyphDataIteratorClosed = 31,
77 EFbsPanicGlyphMetricsArrayOutOfBounds = 32,
78 EFbsPanicGlyphDataIteratorIndexOutOfRange = 33,
79 EFbsPanicInvalidBitmapType = 35,
80 EFbsPanicGlyphAtlasInconsistentState = 36,
81 EFbsPanicGlyphDataIteratorFailedToOpenImage = 37,
82 EFbsPanicGlyphDataIteratorInvalidState = 39,
83 EFbsPanicGlyphMetricsArrayInvalidState = 40,
94 TDisplayMode iDispMode;
104 TDisplayMode iDispMode;
139 TSizeInfo(TInt aMaxHeight,TSize aDevSize):iMaxHeight(aMaxHeight),iDevSize(aDevSize) {}
166 IMPORT_C extern const TInt KFbServLargeChunkGrowByShifter;
167 IMPORT_C extern const TInt KFbServLargeChunkSizeShifter;
168 IMPORT_C extern const TInt KFbServLargeChunkMinPhysicalSize;
169 IMPORT_C extern const TInt KFbServLargeChunkMinVirtualSize;
170 IMPORT_C extern const TInt KFbServLargeChunkMaxVirtualSize;
173 class CChunkPile : public CBase
179 IMPORT_C ~CChunkPile();
180 IMPORT_C static CChunkPile* NewL(const RChunk& aChunk);
181 IMPORT_C TUint8* Alloc(TInt aSize);
182 IMPORT_C void Free(TAny* aCell);
183 IMPORT_C TUint8* ChunkBase() const;
184 IMPORT_C static TInt VirtualSize();
186 CChunkPile(const RChunk& aChunk);
188 TInt DoAlloc(TUint8*& aCell, TInt aSize, RPointerArray<TUint8>& aCells, RArray<TInt>& aFreeCellLinks, TBool aLarge);
189 void DoFree(TUint8* aCell, RPointerArray<TUint8>& aCells, RArray<TInt>& aFreeCellLinks, TBool aLarge);
190 TInt GrowSmallSection(TInt aSize, TInt aLastFreeCell);
191 void ShrinkSmallSection(TInt aShrinkBy);
196 RPointerArray<TUint8> iSmallCells; // last address is not a cell but the top of the small section
197 RArray<TInt> iFreeSmallCellLinks; // index of Nth free small cell is element 0 + element 1 + ... + element N-1
198 TInt iLargeSectionBottom; // boundary between small & large sections
199 RPointerArray<TUint8> iLargeCells; // last address is not a cell but the top of the large section
200 RArray<TInt> iFreeLargeCellLinks; // index of Nth free large cell is element 0 + element 1 + ... + element N-1
201 RCriticalSection iLock;
205 Used to pass sizes of FBServs default heap, heap for large bitmaps, and heap for small bitmaps.
218 Used when the EFbsMessRasterize message is sent from client to server. Allows pointers to items
219 created on the shared FBServ heap to be passed from the server to the client as offsets from the
220 heap base. Valid pointers are recreated client side using these offsets combined with the client's
225 struct TRasterizeParams
228 TInt iBitmapPointerOffset;
231 IMPORT_C extern const TInt KFbServWritableDataPagingMode;
234 Used to specify the writable data paging mode of fbserv.
235 This may be set using the patchable constant KFbServWritableDataPagingMode at rom-build time via the definitions:
236 SYMBIAN_GRAPHICS_FBSERV_PAGEDATA -request that fbserv writable data is paged.
237 SYMBIAN_GRAPHICS_FBSERV_UNPAGEDDATA -request that fbserv writable data is unpaged.
238 SYMBIAN_GRAPHICS_FBSERV_PAGE_BITMAP_DATA_ONLY -request that only bitmap data is paged.
239 SYMBIAN_GRAPHICS_FBSERV_PAGE_BITMAP_DATA_AND_SHARED_HEAP_ONLY -request that only bitmap data and shared heap are paged.
242 enum TFbsWritableDataPagingMode
244 EFbsWdpDefault=0x00, //No change to the rom-build writable data paging configuration (nothing was specified).
245 EFbsWdpPagedData=0x01, //SYMBIAN_GRAPHICS_FBSERV_PAGEDATA was specified.
246 EFbsWdpUnpagedData=0x02, //SYMBIAN_GRAPHICS_FBSERV_UNPAGEDDATA was specified.
247 EFbsWdpPageBitmapDataChunkOnly=0x03, //SYMBIAN_GRAPHICS_FBSERV_PAGE_BITMAP_DATA_ONLY was specified.
248 EFbsWdpPageBitmapDataAndSharedHeapChunksOnly=0x04, //SYMBIAN_GRAPHICS_FBSERV_PAGE_BITMAP_DATA_AND_SHARED_HEAP_ONLY was specified.
253 Structure used to pass parameters from FBS client to FBS server.
254 Used when opening/closing an outline iterator.
257 class TFBSGlyphOutlineParam
266 Structure used to pass font table/glyph outlines from FBS to FBS client.
267 Used when opening an font table or an outline iterator.
278 Maximum number of glyphs to be sent to server/received from client at a time,
279 when retrieval of glyphs is necessary for implementation of RFbsGlyphDataIterator.
281 const TInt KMaxGlyphBatchSize = 8;
284 Maximum number of TOpenFontCharMetrics structures to be sent to server/received
285 from client at a time, when retrieval of glyph metrics is necessary for
286 implementation of RFbsGlyphMetricsArray.
288 const TInt KMaxMetricsBatchSize = 16;
291 Used by RFbsGlyphDataIterator for client/server communication of glyph info.
292 Contains all the data necessary to retrieve a glyph from server and recreate
293 glyph in client process.
296 class TGlyphImageInfo
299 inline TGlyphImageInfo() : iImageId(KSgNullDrawableId), iPosX(0), iPosY(0) {}
301 TSgDrawableId iImageId;
304 TOpenFontCharMetrics iMetrics;
308 Used by CGlyphDataIteratorImpl. It is a container to group the
309 metadata and the image data of an individual glyph recevied from the
310 server, all together. A collection of these is stored in the font,
311 received from the server in batches.
314 struct TGlyphBatchItem
318 TGlyphImageInfo iInfo;
322 Implementor class of RFbsGlyphDataIterator. This class contains all
323 state information and contains much of the implementation of the
327 NONSHARABLE_CLASS(CGlyphDataIteratorImpl) : public CBase
330 CGlyphDataIteratorImpl(TInt aFbsFontHandle, const TUint* aGlyphCodes, TInt aCount);
331 ~CGlyphDataIteratorImpl();
334 void UpdateGlyphRect();
335 TInt UpdateGlyphBatch(TInt aIndex);
338 TSglQue<TGlyphBatchItem> iGlyphBatch; // Linked-list of the current batch of received glyphs.
339 const TUint* iGlyphDataIterCodes; // An array of glyph codes
340 TInt iGlyphDataIterCodeCount; // The number of glyph codes in the array
341 TInt iGlyphDataIterCodeIndex; // The index of the current glyph code in the array
342 TRect iGlyphDataIterRect; // The current glyph rectangle.
343 TInt iFbsFontHandle; // The Font Handle the iterator was opened with