1 // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 1995-2010 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
3 // This component and the accompanying materials are made available |
4 // under the terms of "Eclipse Public License v1.0" |
4 // under the terms of "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
11 // Contributors: |
11 // Contributors: |
12 // |
12 // |
13 // Description: |
13 // Description: |
14 // |
14 // |
15 |
15 |
16 #ifndef __FBSERV_H__ |
16 #ifndef SERVER_H |
17 #define __FBSERV_H__ |
17 #define SERVER_H |
18 |
18 |
19 #include <e32base.h> |
19 #include <e32base.h> |
20 #include <f32file.h> |
20 #include <f32file.h> |
21 #include <fbs.h> |
21 #include <fbs.h> |
|
22 #include <sgresource/sgimage.h> |
22 #include "UTILS.H" |
23 #include "UTILS.H" |
23 #include "FBSMBMC.H" |
24 #include "FBSMBMC.H" |
24 #include "fbsmessage.h" |
25 #include "FbsMessage.H" |
|
26 #include "glyphatlas.h" |
25 |
27 |
26 class CFbTop; |
28 class CFbTop; |
27 class CFbsBackgroundCompression; |
29 class CFbsBackgroundCompression; |
28 class CFbsBackgroundCompressionQueueElement; |
30 class CFbsBackgroundCompressionQueueElement; |
29 class TOpenFontGlyphData; |
31 class TOpenFontGlyphData; |
30 |
32 |
|
33 |
31 NONSHARABLE_CLASS(CFontObject): public CObject |
34 NONSHARABLE_CLASS(CFontObject): public CObject |
32 /** |
35 /** |
33 @internalComponent |
36 @internalComponent |
34 */ |
37 */ |
35 { |
38 { |
36 public: |
39 public: |
37 CFontObject(CFontStore* aFontStore); |
40 CFontObject(CFontStore* aFontStore, CGlyphAtlas* aGlyphAtlas); |
38 ~CFontObject(); |
41 ~CFontObject(); |
39 public: |
42 public: |
40 CBitmapFont* iAddressPointer; |
43 CBitmapFont* iAddressPointer; |
41 CFontStore* iFontStore; |
44 CFontStore* iFontStore; |
42 TInt iHeightInTwips; |
45 TInt iHeightInTwips; |
|
46 CGlyphAtlas* iGlyphAtlas; |
43 }; |
47 }; |
44 |
48 |
45 NONSHARABLE_CLASS(CBitmapObject): public CObject |
49 NONSHARABLE_CLASS(CBitmapObject): public CObject |
46 /** |
50 /** |
47 Provides reference counting facilities for bitmaps managed by CFbTop. |
51 Provides reference counting facilities for bitmaps managed by CFbTop. |
111 void ProcMessage(const RMessage2& aMessage, TInt aSession); |
115 void ProcMessage(const RMessage2& aMessage, TInt aSession); |
112 #endif |
116 #endif |
113 CFbTop* TopLevelStore(); |
117 CFbTop* TopLevelStore(); |
114 |
118 |
115 private: |
119 private: |
|
120 void ConstructL(); |
116 void GetHeapSizesL(const RMessage2& aMessage); |
121 void GetHeapSizesL(const RMessage2& aMessage); |
117 TInt HandleMesgTypefaceSupport(const RMessage2& aMessage, TBool& aClientPanicRequired); |
122 TInt HandleMesgTypefaceSupport(const RMessage2& aMessage, TBool& aClientPanicRequired); |
118 TInt HandleMesgFontHeight(const RMessage2& aMessage, TBool aInTwips); |
123 TInt HandleMesgFontHeight(const RMessage2& aMessage, TBool aInTwips); |
119 |
124 |
120 protected: |
125 protected: |
169 void AddFontFileIndexL(TUid aId); |
174 void AddFontFileIndexL(TUid aId); |
170 void RemoveFontFileIndex(TUid aId); |
175 void RemoveFontFileIndex(TUid aId); |
171 void Disconnect(const RMessage2 &aMessage); |
176 void Disconnect(const RMessage2 &aMessage); |
172 #ifdef _DEBUG |
177 #ifdef _DEBUG |
173 void ProcMemMessage (const RMessage2& aMessage); |
178 void ProcMemMessage (const RMessage2& aMessage); |
|
179 void ProcAtlasMessage (const RMessage2& aMessage); |
174 #endif |
180 #endif |
175 private: |
181 private: |
|
182 void ConstructL(); |
176 CFbClient(RHeap* aHeap); |
183 CFbClient(RHeap* aHeap); |
177 TInt HandleMesgFontDuplicate(const RMessage2& aMessage, TBool& aPanicRequired); |
184 TInt HandleMesgFontDuplicate(const RMessage2& aMessage, TBool& aPanicRequired); |
178 TInt HandleMesgGetNearestFont(const RMessage2& aMessage, TBool& aPanicRequired); |
185 TInt HandleMesgGetNearestFont(const RMessage2& aMessage, TBool& aPanicRequired); |
179 TInt HandleMesgGetFontById(const RMessage2& aMessage, TBool& aPanicRequired); |
186 TInt HandleMesgGetFontById(const RMessage2& aMessage, TBool& aPanicRequired); |
180 TInt CopyFontInfoIntoReturnMessage(const RMessage2& aMessage, TBool& aPanicRequired, CFontObject* aFontObj, TInt iWritePosition); |
187 TInt CopyFontInfoIntoReturnMessage(const RMessage2& aMessage, TBool& aPanicRequired, CFontObject* aFontObj, TInt iWritePosition); |
183 TInt HandleMesgRasterize(const RMessage2& aMessage, TBool& aPanicRequired); |
190 TInt HandleMesgRasterize(const RMessage2& aMessage, TBool& aPanicRequired); |
184 TInt HandleMesgFaceAttrib(const RMessage2& aMessage, TBool& aPanicRequired); |
191 TInt HandleMesgFaceAttrib(const RMessage2& aMessage, TBool& aPanicRequired); |
185 TInt HandleMesgHasCharacter(const RMessage2& aMessage, TBool& aPanicRequired); |
192 TInt HandleMesgHasCharacter(const RMessage2& aMessage, TBool& aPanicRequired); |
186 TInt HandleMesgShapeText(const RMessage2& aMessage, TBool& aPanicRequired); |
193 TInt HandleMesgShapeText(const RMessage2& aMessage, TBool& aPanicRequired); |
187 TInt HandleMesgShapeDelete(const RMessage2& aMessage, TBool& aPanicRequired); |
194 TInt HandleMesgShapeDelete(const RMessage2& aMessage, TBool& aPanicRequired); |
|
195 TInt HandleMesgGetFontTable(const RMessage2& aMessage, TBool& aPanicRequired); |
|
196 TInt HandleMesgGetGlyphOutline(const RMessage2& aMessage, TBool& aPanicRequired); |
|
197 TInt HandleMesgReleaseGlyphOutline(const RMessage2& aMessage, TBool& aPanicRequired); |
|
198 TInt HandleMesgReleaseFontTable(const RMessage2& aMessage, TBool& aPanicRequired); |
|
199 TInt HandleMesgGetGlyphs(const RMessage2& aMessage, TBool& aPanicRequired); |
|
200 TInt HandleMesgGetGlyphMetrics(const RMessage2& aMessage, TBool& aPanicRequired); |
|
201 TInt HandleMesgOogmStatus(const RMessage2& aMessage); |
|
202 void HandleMesgGlyphCacheMetrics(const RMessage2& aMessage); |
188 |
203 |
189 protected: |
204 protected: |
190 TUint iConnectionHandle; |
205 TUint iConnectionHandle; |
191 CObjectIx* iIx; |
206 CObjectIx* iIx; |
192 TInt iResourceCount; |
207 TInt iResourceCount; |
196 TInt iSessionHandle; // used to identify client-specific glyph caches for the new font system |
211 TInt iSessionHandle; // used to identify client-specific glyph caches for the new font system |
197 TFbClientHelper* iHelper; // used to notify client of any bitmap becoming dirty |
212 TFbClientHelper* iHelper; // used to notify client of any bitmap becoming dirty |
198 |
213 |
199 private: |
214 private: |
200 RBuf16 iTextToShape; // buffer used to hold incoming text that needs shaping |
215 RBuf16 iTextToShape; // buffer used to hold incoming text that needs shaping |
|
216 RArray<RSgImage> iGlyphImagesInTransit; // last glyph images retrieved from glyph atlas |
201 #ifdef _DEBUG |
217 #ifdef _DEBUG |
202 TBool iOwnHeapCheck; //for the process heap - current state |
218 TBool iOwnHeapCheck; //for the process heap - current state |
203 TBool iHeapCheck; //for iHeap - current state |
219 TBool iHeapCheck; //for iHeap - current state |
204 TBool iOwnHeapCheckFlip; //for the process heap - to switch the current state |
220 TBool iOwnHeapCheckFlip; //for the process heap - to switch the current state |
205 TBool iHeapCheckFlip; //for iHeap - used to switch the current state |
221 TBool iHeapCheckFlip; //for iHeap - used to switch the current state |
265 CBitmapObject* LoadBitmapL(const TDesC& aFilename, TInt32 aId, TUint aFileOffset,RFile* aFile, TInt aSessionHandle); |
282 CBitmapObject* LoadBitmapL(const TDesC& aFilename, TInt32 aId, TUint aFileOffset,RFile* aFile, TInt aSessionHandle); |
266 CSharedBitmapObject* ShareBitmapL(TDes& aFilename, TInt32 aId, TUint aFileOffset,RFile* aFile, TInt aSessionHandle); |
283 CSharedBitmapObject* ShareBitmapL(TDes& aFilename, TInt32 aId, TUint aFileOffset,RFile* aFile, TInt aSessionHandle); |
267 TInt GetCleanBitmap(CBitmapObject*& aBmpObjPtr); |
284 TInt GetCleanBitmap(CBitmapObject*& aBmpObjPtr); |
268 CBitmapObject* FindBitmap(TInt aHandle); |
285 CBitmapObject* FindBitmap(TInt aHandle); |
269 TBool ValidFontHandle(TInt aHandle); |
286 TBool ValidFontHandle(TInt aHandle); |
270 TBool ValidBitmapFont(TInt aHandle); |
|
271 CFontStore* FontStore() const; |
287 CFontStore* FontStore() const; |
272 RHeap* Heap() const; |
288 RHeap* Heap() const; |
273 CChunkPile* Pile() const; |
289 CChunkPile* Pile() const; |
274 TInt HeapBase() const; |
290 TInt HeapBase() const; |
275 void SetFontNameAliasL(const RMessage2& aMessage); |
291 void SetFontNameAliasL(const RMessage2& aMessage); |
281 inline RFs& FileSession(); |
297 inline RFs& FileSession(); |
282 void AddClientHelper(TFbClientHelper& aHelper); |
298 void AddClientHelper(TFbClientHelper& aHelper); |
283 void NotifyDirtyBitmap(CBitmapObject& aBmpObj, CFbClient* aClient); |
299 void NotifyDirtyBitmap(CBitmapObject& aBmpObj, CFbClient* aClient); |
284 TInt BitmapConUniqueID() const; |
300 TInt BitmapConUniqueID() const; |
285 TInt FontConUniqueID() const; |
301 TInt FontConUniqueID() const; |
|
302 CGlyphAtlas* GlyphAtlas() const; |
286 private: |
303 private: |
287 CFbTop(); |
304 CFbTop(); |
288 void ConstructL(); |
305 void ConstructL(); |
289 CBitwiseBitmap* DoLoadBitmapLC(const TDesC& aFilename, TInt32 aId, TUint aFileOffset, RFile* aFile, TInt aSessionHandle); |
306 CBitwiseBitmap* DoLoadBitmapLC(const TDesC& aFilename, TInt32 aId, TUint aFileOffset, RFile* aFile, TInt aSessionHandle); |
290 void LoadOpenFontLibraries(); |
307 void LoadOpenFontLibraries(); |
291 void SafeInstallOfRasterizerL(TUid aInterfaceImplUid); |
308 void SafeInstallOfRasterizerL(TUid aInterfaceImplUid); |
292 TInt FindFontNameAlias(const TDesC& aAlias); |
309 TInt FindFontNameAlias(const TDesC& aAlias); |
293 void LoadShaperFactories(); |
310 void LoadShaperFactories(); |
294 void SafeInstallOfShaperFactoryL(TUid aInterfaceImplUid); |
311 void SafeInstallOfShaperFactoryL(TUid aInterfaceImplUid); |
295 TInt CreateFontObjectFromFont(CFontObject*& aFontObjPtr, CFont* aFont); |
312 TInt GetFontObjectFromFont(CFontObject*& aFontObjPtr, CFont* aFont); |
296 TInt GetNearestNonAliasedFont(CFont*& aFont, TFbsMessage aMessage, const TFontSpec& aFontSpec, TInt aMaxHeight); |
313 TInt GetNearestNonAliasedFont(CFont*& aFont, TFbsMessage aMessage, const TFontSpec& aFontSpec, TInt aMaxHeight); |
297 private: |
314 private: |
298 RFs iFilesys; |
315 RFs iFilesys; |
299 CFontStore* iFontStore; |
316 CFontStore* iFontStore; |
300 CObjectCon* iBitmapCon; |
317 CObjectCon* iBitmapCon; |
312 TLanguage iDefaultLanguageForMetrics; |
329 TLanguage iDefaultLanguageForMetrics; |
313 CFbsBackgroundCompression* iBackgroundCompression; |
330 CFbsBackgroundCompression* iBackgroundCompression; |
314 TBuf<KMaxTypefaceNameLength> iSystemDefaultFontTypefaceName; |
331 TBuf<KMaxTypefaceNameLength> iSystemDefaultFontTypefaceName; |
315 TDblQue<TFbClientHelper> iClientHelpers; |
332 TDblQue<TFbClientHelper> iClientHelpers; |
316 TInt64 iNextAvailableSerialNumber; |
333 TInt64 iNextAvailableSerialNumber; |
|
334 CGlyphAtlas* iGlyphAtlas; |
317 }; |
335 }; |
318 |
336 |
319 inline CBitwiseBitmap* CBitmapObject::Address() const |
337 inline CBitwiseBitmap* CBitmapObject::Address() const |
320 { |
338 { |
321 return iAddressPointer; |
339 return iAddressPointer; |