fbs/fontandbitmapserver/sfbs/SERVER.H
branchRCL_3
changeset 164 25ffed67c7ef
parent 163 bbf46f59e123
equal deleted inserted replaced
163:bbf46f59e123 164:25ffed67c7ef
     1 // Copyright (c) 1995-2010 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 1995-2009 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 SERVER_H
    16 #ifndef __FBSERV_H__
    17 #define SERVER_H
    17 #define __FBSERV_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>
       
    23 #include "UTILS.H"
    22 #include "UTILS.H"
    24 #include "FBSMBMC.H"
    23 #include "FBSMBMC.H"
    25 #include "FbsMessage.H"
    24 #include "fbsmessage.h"
    26 #include "glyphatlas.h"
       
    27 
    25 
    28 class CFbTop;
    26 class CFbTop;
    29 class CFbsBackgroundCompression;
    27 class CFbsBackgroundCompression;
    30 class CFbsBackgroundCompressionQueueElement;
    28 class CFbsBackgroundCompressionQueueElement;
    31 class TOpenFontGlyphData;
    29 class TOpenFontGlyphData;
    32 
    30 
    33 
       
    34 NONSHARABLE_CLASS(CFontObject): public CObject
    31 NONSHARABLE_CLASS(CFontObject): public CObject
    35 /**
    32 /**
    36 @internalComponent
    33 @internalComponent
    37 */
    34 */
    38 	{
    35 	{
    39 public:
    36 public:
    40 	CFontObject(CFontStore* aFontStore, CGlyphAtlas* aGlyphAtlas);
    37 	CFontObject(CFontStore* aFontStore);
    41 	~CFontObject();
    38 	~CFontObject();
    42 public:
    39 public:
    43 	CBitmapFont* iAddressPointer;
    40 	CBitmapFont* iAddressPointer;
    44 	CFontStore* iFontStore;
    41 	CFontStore* iFontStore;
    45 	TInt iHeightInTwips;
    42 	TInt iHeightInTwips;
    46 	CGlyphAtlas* iGlyphAtlas;
       
    47 	};
    43 	};
    48 
    44 
    49 NONSHARABLE_CLASS(CBitmapObject): public CObject
    45 NONSHARABLE_CLASS(CBitmapObject): public CObject
    50 /**
    46 /**
    51 Provides reference counting facilities for bitmaps managed by CFbTop.
    47 Provides reference counting facilities for bitmaps managed by CFbTop.
   115 	void ProcMessage(const RMessage2& aMessage, TInt aSession);
   111 	void ProcMessage(const RMessage2& aMessage, TInt aSession);
   116 #endif	
   112 #endif	
   117 	CFbTop* TopLevelStore();
   113 	CFbTop* TopLevelStore();
   118 
   114 
   119 private:
   115 private:
   120 	void ConstructL();
       
   121 	void GetHeapSizesL(const RMessage2& aMessage);
   116 	void GetHeapSizesL(const RMessage2& aMessage);
   122 	TInt HandleMesgTypefaceSupport(const RMessage2& aMessage, TBool& aClientPanicRequired);
   117 	TInt HandleMesgTypefaceSupport(const RMessage2& aMessage, TBool& aClientPanicRequired);
   123 	TInt HandleMesgFontHeight(const RMessage2& aMessage, TBool aInTwips);
   118 	TInt HandleMesgFontHeight(const RMessage2& aMessage, TBool aInTwips);
   124 
   119 
   125 protected:
   120 protected:
   174 	void AddFontFileIndexL(TUid aId);
   169 	void AddFontFileIndexL(TUid aId);
   175 	void RemoveFontFileIndex(TUid aId);
   170 	void RemoveFontFileIndex(TUid aId);
   176 	void Disconnect(const RMessage2 &aMessage);
   171 	void Disconnect(const RMessage2 &aMessage);
   177 #ifdef _DEBUG
   172 #ifdef _DEBUG
   178 	void ProcMemMessage (const RMessage2& aMessage);
   173 	void ProcMemMessage (const RMessage2& aMessage);
   179 	void ProcAtlasMessage (const RMessage2& aMessage);
       
   180 #endif	
   174 #endif	
   181 private:
   175 private:
   182 	void ConstructL();
       
   183 	CFbClient(RHeap* aHeap);
   176 	CFbClient(RHeap* aHeap);
   184 	TInt HandleMesgFontDuplicate(const RMessage2& aMessage, TBool& aPanicRequired);
   177 	TInt HandleMesgFontDuplicate(const RMessage2& aMessage, TBool& aPanicRequired);
   185 	TInt HandleMesgGetNearestFont(const RMessage2& aMessage, TBool& aPanicRequired);
   178 	TInt HandleMesgGetNearestFont(const RMessage2& aMessage, TBool& aPanicRequired);
   186 	TInt HandleMesgGetFontById(const RMessage2& aMessage, TBool& aPanicRequired);
   179 	TInt HandleMesgGetFontById(const RMessage2& aMessage, TBool& aPanicRequired);
   187 	TInt CopyFontInfoIntoReturnMessage(const RMessage2& aMessage, TBool& aPanicRequired, CFontObject* aFontObj, TInt iWritePosition);
   180 	TInt CopyFontInfoIntoReturnMessage(const RMessage2& aMessage, TBool& aPanicRequired, CFontObject* aFontObj, TInt iWritePosition);
   190 	TInt HandleMesgRasterize(const RMessage2& aMessage, TBool& aPanicRequired);
   183 	TInt HandleMesgRasterize(const RMessage2& aMessage, TBool& aPanicRequired);
   191 	TInt HandleMesgFaceAttrib(const RMessage2& aMessage, TBool& aPanicRequired);
   184 	TInt HandleMesgFaceAttrib(const RMessage2& aMessage, TBool& aPanicRequired);
   192 	TInt HandleMesgHasCharacter(const RMessage2& aMessage, TBool& aPanicRequired);
   185 	TInt HandleMesgHasCharacter(const RMessage2& aMessage, TBool& aPanicRequired);
   193 	TInt HandleMesgShapeText(const RMessage2& aMessage, TBool& aPanicRequired);
   186 	TInt HandleMesgShapeText(const RMessage2& aMessage, TBool& aPanicRequired);
   194 	TInt HandleMesgShapeDelete(const RMessage2& aMessage, TBool& aPanicRequired);
   187 	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);
       
   203 
   188 
   204 protected:
   189 protected:
   205 	TUint iConnectionHandle;
   190 	TUint iConnectionHandle;
   206 	CObjectIx* iIx;
   191 	CObjectIx* iIx;
   207 	TInt iResourceCount;
   192 	TInt iResourceCount;
   211 	TInt iSessionHandle;					// used to identify client-specific glyph caches for the new font system
   196 	TInt iSessionHandle;					// used to identify client-specific glyph caches for the new font system
   212 	TFbClientHelper* iHelper;				// used to notify client of any bitmap becoming dirty
   197 	TFbClientHelper* iHelper;				// used to notify client of any bitmap becoming dirty
   213 
   198 
   214 private:
   199 private:
   215 	RBuf16 iTextToShape;						// buffer used to hold incoming text that needs shaping
   200 	RBuf16 iTextToShape;						// buffer used to hold incoming text that needs shaping
   216 	RArray<RSgImage> iGlyphImagesInTransit;	// last glyph images retrieved from glyph atlas
       
   217 #ifdef _DEBUG	
   201 #ifdef _DEBUG	
   218 	TBool iOwnHeapCheck; //for the process heap - current state
   202 	TBool iOwnHeapCheck; //for the process heap - current state
   219 	TBool iHeapCheck;	//for iHeap - current state
   203 	TBool iHeapCheck;	//for iHeap - current state
   220 	TBool iOwnHeapCheckFlip; //for the process heap - to switch the current state
   204 	TBool iOwnHeapCheckFlip; //for the process heap - to switch the current state
   221 	TBool iHeapCheckFlip;	//for iHeap - used to switch the current state
   205 	TBool iHeapCheckFlip;	//for iHeap - used to switch the current state
   260 	TInt iMask;
   244 	TInt iMask;
   261 	};
   245 	};
   262 
   246 
   263 
   247 
   264 IMPORT_C extern const TInt KFbServSharedHeapMaxSize;
   248 IMPORT_C extern const TInt KFbServSharedHeapMaxSize;
   265 IMPORT_C extern const TInt KFbServGlyphAtlasCacheLimit;
       
   266 
   249 
   267 
   250 
   268 NONSHARABLE_CLASS(CFbTop): public CBase
   251 NONSHARABLE_CLASS(CFbTop): public CBase
   269 /**
   252 /**
   270 @internalComponent
   253 @internalComponent
   282 	CBitmapObject* LoadBitmapL(const TDesC& aFilename, TInt32 aId, TUint aFileOffset,RFile* aFile, TInt aSessionHandle);
   265 	CBitmapObject* LoadBitmapL(const TDesC& aFilename, TInt32 aId, TUint aFileOffset,RFile* aFile, TInt aSessionHandle);
   283 	CSharedBitmapObject* ShareBitmapL(TDes& aFilename, TInt32 aId, TUint aFileOffset,RFile* aFile, TInt aSessionHandle);
   266 	CSharedBitmapObject* ShareBitmapL(TDes& aFilename, TInt32 aId, TUint aFileOffset,RFile* aFile, TInt aSessionHandle);
   284 	TInt GetCleanBitmap(CBitmapObject*& aBmpObjPtr);
   267 	TInt GetCleanBitmap(CBitmapObject*& aBmpObjPtr);
   285 	CBitmapObject* FindBitmap(TInt aHandle);
   268 	CBitmapObject* FindBitmap(TInt aHandle);
   286 	TBool ValidFontHandle(TInt aHandle);
   269 	TBool ValidFontHandle(TInt aHandle);
       
   270 	TBool ValidBitmapFont(TInt aHandle);
   287 	CFontStore* FontStore() const;
   271 	CFontStore* FontStore() const;
   288 	RHeap* Heap() const;
   272 	RHeap* Heap() const;
   289 	CChunkPile* Pile() const;
   273 	CChunkPile* Pile() const;
   290 	TInt HeapBase() const;
   274 	TInt HeapBase() const;
   291 	void SetFontNameAliasL(const RMessage2& aMessage);
   275 	void SetFontNameAliasL(const RMessage2& aMessage);
   297 	inline RFs& FileSession();
   281 	inline RFs& FileSession();
   298 	void AddClientHelper(TFbClientHelper& aHelper);
   282 	void AddClientHelper(TFbClientHelper& aHelper);
   299 	void NotifyDirtyBitmap(CBitmapObject& aBmpObj, CFbClient* aClient);
   283 	void NotifyDirtyBitmap(CBitmapObject& aBmpObj, CFbClient* aClient);
   300 	TInt BitmapConUniqueID() const;
   284 	TInt BitmapConUniqueID() const;
   301 	TInt FontConUniqueID() const;
   285 	TInt FontConUniqueID() const;
   302 	CGlyphAtlas* GlyphAtlas() const;
       
   303 private:
   286 private:
   304 	CFbTop();
   287 	CFbTop();
   305 	void ConstructL();
   288 	void ConstructL();
   306 	CBitwiseBitmap* DoLoadBitmapLC(const TDesC& aFilename, TInt32 aId, TUint aFileOffset, RFile* aFile, TInt aSessionHandle);
   289 	CBitwiseBitmap* DoLoadBitmapLC(const TDesC& aFilename, TInt32 aId, TUint aFileOffset, RFile* aFile, TInt aSessionHandle);
   307 	void LoadOpenFontLibraries();
   290 	void LoadOpenFontLibraries();
   308 	void SafeInstallOfRasterizerL(TUid aInterfaceImplUid);
   291 	void SafeInstallOfRasterizerL(TUid aInterfaceImplUid);
   309 	TInt FindFontNameAlias(const TDesC& aAlias);
   292 	TInt FindFontNameAlias(const TDesC& aAlias);
   310 	void LoadShaperFactories();
   293 	void LoadShaperFactories();
   311 	void SafeInstallOfShaperFactoryL(TUid aInterfaceImplUid);
   294 	void SafeInstallOfShaperFactoryL(TUid aInterfaceImplUid);
   312 	TInt GetFontObjectFromFont(CFontObject*& aFontObjPtr, CFont* aFont);
   295 	TInt CreateFontObjectFromFont(CFontObject*& aFontObjPtr, CFont* aFont);
   313 	TInt GetNearestNonAliasedFont(CFont*& aFont, TFbsMessage aMessage, const TFontSpec&	aFontSpec, TInt	aMaxHeight);
   296 	TInt GetNearestNonAliasedFont(CFont*& aFont, TFbsMessage aMessage, const TFontSpec&	aFontSpec, TInt	aMaxHeight);
   314 private:
   297 private:
   315 	RFs iFilesys;
   298 	RFs iFilesys;
   316 	CFontStore* iFontStore;
   299 	CFontStore* iFontStore;
   317 	CObjectCon* iBitmapCon;
   300 	CObjectCon* iBitmapCon;
   329 	TLanguage iDefaultLanguageForMetrics;
   312 	TLanguage iDefaultLanguageForMetrics;
   330 	CFbsBackgroundCompression* iBackgroundCompression;
   313 	CFbsBackgroundCompression* iBackgroundCompression;
   331 	TBuf<KMaxTypefaceNameLength> iSystemDefaultFontTypefaceName;
   314 	TBuf<KMaxTypefaceNameLength> iSystemDefaultFontTypefaceName;
   332 	TDblQue<TFbClientHelper> iClientHelpers;
   315 	TDblQue<TFbClientHelper> iClientHelpers;
   333 	TInt64 iNextAvailableSerialNumber;
   316 	TInt64 iNextAvailableSerialNumber;
   334 	CGlyphAtlas* iGlyphAtlas;
       
   335 	};
   317 	};
   336 
   318 
   337 inline CBitwiseBitmap* CBitmapObject::Address() const
   319 inline CBitwiseBitmap* CBitmapObject::Address() const
   338 	{
   320 	{
   339 	return iAddressPointer;
   321 	return iAddressPointer;
   372 inline RFs& CFbTop::FileSession()
   354 inline RFs& CFbTop::FileSession()
   373 	{
   355 	{
   374 	return iFilesys;
   356 	return iFilesys;
   375 	}
   357 	}
   376 
   358 
   377 #endif // SERVER_H
   359 #endif
   378 
   360