sl@0: /* sl@0: * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * SHAPERCACHE.CPP sl@0: * sl@0: */ sl@0: sl@0: sl@0: #include sl@0: #include sl@0: #include "FNTSTD.H" sl@0: #include sl@0: sl@0: const TInt KMaxShaperSesssionCacheMemory = 64*1024; sl@0: sl@0: //class to store the handle the handle-reference count sl@0: class THandleCount sl@0: { sl@0: public: sl@0: THandleCount(TInt aSessionHandle) sl@0: :iSessionHandle(aSessionHandle),iRefCount(1),iNext(NULL){} sl@0: public: sl@0: TInt iSessionHandle; sl@0: TInt iRefCount; sl@0: THandleCount* iNext; sl@0: }; sl@0: sl@0: /******************** SHAPER CACHE CLASSES*************************************/ sl@0: class COpenFontShaperCacheEntry: public CBase sl@0: { sl@0: public: sl@0: static COpenFontShaperCacheEntry* New(RHeap* aHeap, CShaper::TInput aInput, TShapeHeader* aShapeHeader); sl@0: static COpenFontShaperCacheEntry* New(RHeap* aHeap); sl@0: static void Delete (RHeap* aHeap, COpenFontShaperCacheEntry* aCache); sl@0: TBool IsSentinel(){return iShapeHeader==NULL;} sl@0: TInt IncRefCount(TInt aSessionHandle); sl@0: TInt DecRefCount(TInt aSessionHandle,TBool aReset=EFalse); sl@0: private: sl@0: COpenFontShaperCacheEntry(RHeap* aHeap,CShaper::TInput aInput) sl@0: :iStart(aInput.iStart),iEnd(aInput.iEnd),iScript(aInput.iScript), iHeap(aHeap){} sl@0: COpenFontShaperCacheEntry(){} sl@0: TInt Construct(CShaper::TInput aInput,TShapeHeader* aShapeHeader); sl@0: public: sl@0: COpenFontShaperCacheEntry* iPrevious; // pointer to previous node in tree sl@0: COpenFontShaperCacheEntry* iNext; // pointer to next shaping info node in the list sl@0: sl@0: /** The shaped information that is cached */ sl@0: TShapeHeader* iShapeHeader; sl@0: /** Input information */ sl@0: TUint16* iText; sl@0: TInt iStart; sl@0: TInt iEnd; sl@0: TInt iScript; sl@0: /** pointer to a private heap for allocating the handle-refcount array*/ sl@0: RHeap* iHeap; sl@0: /** linked list of THandleCount to store the handle-refcount information */ sl@0: THandleCount* iHandleRefList; sl@0: TInt iHandleRefCount; sl@0: }; sl@0: sl@0: /***********************SHAPER CACHE ENDS HERE********************************/ sl@0: