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); |
187 TInt HandleMesgShapeDelete(const RMessage2& aMessage, TBool& aPanicRequired); |
194 TInt HandleMesgShapeDelete(const RMessage2& aMessage, TBool& aPanicRequired); |
188 TInt HandleMesgGetFontTable(const RMessage2& aMessage, TBool& aPanicRequired); |
195 TInt HandleMesgGetFontTable(const RMessage2& aMessage, TBool& aPanicRequired); |
189 TInt HandleMesgGetGlyphOutline(const RMessage2& aMessage, TBool& aPanicRequired); |
196 TInt HandleMesgGetGlyphOutline(const RMessage2& aMessage, TBool& aPanicRequired); |
190 TInt HandleMesgReleaseGlyphOutline(const RMessage2& aMessage, TBool& aPanicRequired); |
197 TInt HandleMesgReleaseGlyphOutline(const RMessage2& aMessage, TBool& aPanicRequired); |
191 TInt HandleMesgReleaseFontTable(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); |
192 |
203 |
193 protected: |
204 protected: |
194 TUint iConnectionHandle; |
205 TUint iConnectionHandle; |
195 CObjectIx* iIx; |
206 CObjectIx* iIx; |
196 TInt iResourceCount; |
207 TInt iResourceCount; |
200 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 |
201 TFbClientHelper* iHelper; // used to notify client of any bitmap becoming dirty |
212 TFbClientHelper* iHelper; // used to notify client of any bitmap becoming dirty |
202 |
213 |
203 private: |
214 private: |
204 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 |
205 #ifdef _DEBUG |
217 #ifdef _DEBUG |
206 TBool iOwnHeapCheck; //for the process heap - current state |
218 TBool iOwnHeapCheck; //for the process heap - current state |
207 TBool iHeapCheck; //for iHeap - current state |
219 TBool iHeapCheck; //for iHeap - current state |
208 TBool iOwnHeapCheckFlip; //for the process heap - to switch the current state |
220 TBool iOwnHeapCheckFlip; //for the process heap - to switch the current state |
209 TBool iHeapCheckFlip; //for iHeap - used to switch the current state |
221 TBool iHeapCheckFlip; //for iHeap - used to switch the current state |
269 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); |
270 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); |
271 TInt GetCleanBitmap(CBitmapObject*& aBmpObjPtr); |
284 TInt GetCleanBitmap(CBitmapObject*& aBmpObjPtr); |
272 CBitmapObject* FindBitmap(TInt aHandle); |
285 CBitmapObject* FindBitmap(TInt aHandle); |
273 TBool ValidFontHandle(TInt aHandle); |
286 TBool ValidFontHandle(TInt aHandle); |
274 TBool ValidBitmapFont(TInt aHandle); |
|
275 CFontStore* FontStore() const; |
287 CFontStore* FontStore() const; |
276 RHeap* Heap() const; |
288 RHeap* Heap() const; |
277 CChunkPile* Pile() const; |
289 CChunkPile* Pile() const; |
278 TInt HeapBase() const; |
290 TInt HeapBase() const; |
279 void SetFontNameAliasL(const RMessage2& aMessage); |
291 void SetFontNameAliasL(const RMessage2& aMessage); |
285 inline RFs& FileSession(); |
297 inline RFs& FileSession(); |
286 void AddClientHelper(TFbClientHelper& aHelper); |
298 void AddClientHelper(TFbClientHelper& aHelper); |
287 void NotifyDirtyBitmap(CBitmapObject& aBmpObj, CFbClient* aClient); |
299 void NotifyDirtyBitmap(CBitmapObject& aBmpObj, CFbClient* aClient); |
288 TInt BitmapConUniqueID() const; |
300 TInt BitmapConUniqueID() const; |
289 TInt FontConUniqueID() const; |
301 TInt FontConUniqueID() const; |
|
302 CGlyphAtlas* GlyphAtlas() const; |
290 private: |
303 private: |
291 CFbTop(); |
304 CFbTop(); |
292 void ConstructL(); |
305 void ConstructL(); |
293 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); |
294 void LoadOpenFontLibraries(); |
307 void LoadOpenFontLibraries(); |
295 void SafeInstallOfRasterizerL(TUid aInterfaceImplUid); |
308 void SafeInstallOfRasterizerL(TUid aInterfaceImplUid); |
296 TInt FindFontNameAlias(const TDesC& aAlias); |
309 TInt FindFontNameAlias(const TDesC& aAlias); |
297 void LoadShaperFactories(); |
310 void LoadShaperFactories(); |
298 void SafeInstallOfShaperFactoryL(TUid aInterfaceImplUid); |
311 void SafeInstallOfShaperFactoryL(TUid aInterfaceImplUid); |
299 TInt CreateFontObjectFromFont(CFontObject*& aFontObjPtr, CFont* aFont); |
312 TInt GetFontObjectFromFont(CFontObject*& aFontObjPtr, CFont* aFont); |
300 TInt GetNearestNonAliasedFont(CFont*& aFont, TFbsMessage aMessage, const TFontSpec& aFontSpec, TInt aMaxHeight); |
313 TInt GetNearestNonAliasedFont(CFont*& aFont, TFbsMessage aMessage, const TFontSpec& aFontSpec, TInt aMaxHeight); |
301 private: |
314 private: |
302 RFs iFilesys; |
315 RFs iFilesys; |
303 CFontStore* iFontStore; |
316 CFontStore* iFontStore; |
304 CObjectCon* iBitmapCon; |
317 CObjectCon* iBitmapCon; |
316 TLanguage iDefaultLanguageForMetrics; |
329 TLanguage iDefaultLanguageForMetrics; |
317 CFbsBackgroundCompression* iBackgroundCompression; |
330 CFbsBackgroundCompression* iBackgroundCompression; |
318 TBuf<KMaxTypefaceNameLength> iSystemDefaultFontTypefaceName; |
331 TBuf<KMaxTypefaceNameLength> iSystemDefaultFontTypefaceName; |
319 TDblQue<TFbClientHelper> iClientHelpers; |
332 TDblQue<TFbClientHelper> iClientHelpers; |
320 TInt64 iNextAvailableSerialNumber; |
333 TInt64 iNextAvailableSerialNumber; |
|
334 CGlyphAtlas* iGlyphAtlas; |
321 }; |
335 }; |
322 |
336 |
323 inline CBitwiseBitmap* CBitmapObject::Address() const |
337 inline CBitwiseBitmap* CBitmapObject::Address() const |
324 { |
338 { |
325 return iAddressPointer; |
339 return iAddressPointer; |