os/textandloc/fontservices/fontstore/src/ShaperCache.H
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
/*
sl@0
     2
* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     3
* All rights reserved.
sl@0
     4
* This component and the accompanying materials are made available
sl@0
     5
* under the terms of "Eclipse Public License v1.0"
sl@0
     6
* which accompanies this distribution, and is available
sl@0
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     8
*
sl@0
     9
* Initial Contributors:
sl@0
    10
* Nokia Corporation - initial contribution.
sl@0
    11
*
sl@0
    12
* Contributors:
sl@0
    13
*
sl@0
    14
* Description: 
sl@0
    15
* SHAPERCACHE.CPP
sl@0
    16
*
sl@0
    17
*/
sl@0
    18
sl@0
    19
sl@0
    20
#include <fntstore.h>
sl@0
    21
#include <gdi.h>
sl@0
    22
#include "FNTSTD.H"
sl@0
    23
#include <graphics/shapeimpl.h>
sl@0
    24
sl@0
    25
const TInt KMaxShaperSesssionCacheMemory = 64*1024;
sl@0
    26
sl@0
    27
//class to store the handle the handle-reference count
sl@0
    28
class THandleCount
sl@0
    29
	{
sl@0
    30
public:
sl@0
    31
	THandleCount(TInt aSessionHandle)
sl@0
    32
	:iSessionHandle(aSessionHandle),iRefCount(1),iNext(NULL){}	
sl@0
    33
public:
sl@0
    34
	TInt iSessionHandle;
sl@0
    35
	TInt iRefCount;
sl@0
    36
	THandleCount* iNext;	
sl@0
    37
	};
sl@0
    38
sl@0
    39
/******************** SHAPER CACHE CLASSES*************************************/	
sl@0
    40
class COpenFontShaperCacheEntry: public CBase
sl@0
    41
	{
sl@0
    42
public:
sl@0
    43
	static COpenFontShaperCacheEntry* New(RHeap* aHeap, CShaper::TInput aInput, TShapeHeader* aShapeHeader);
sl@0
    44
	static COpenFontShaperCacheEntry* New(RHeap* aHeap);
sl@0
    45
	static void Delete (RHeap* aHeap, COpenFontShaperCacheEntry* aCache);	
sl@0
    46
	TBool IsSentinel(){return iShapeHeader==NULL;}
sl@0
    47
	TInt IncRefCount(TInt aSessionHandle);
sl@0
    48
	TInt DecRefCount(TInt aSessionHandle,TBool aReset=EFalse);	
sl@0
    49
private:
sl@0
    50
	COpenFontShaperCacheEntry(RHeap* aHeap,CShaper::TInput aInput)
sl@0
    51
	:iStart(aInput.iStart),iEnd(aInput.iEnd),iScript(aInput.iScript), iHeap(aHeap){}
sl@0
    52
	COpenFontShaperCacheEntry(){}
sl@0
    53
	TInt Construct(CShaper::TInput aInput,TShapeHeader* aShapeHeader);
sl@0
    54
public:
sl@0
    55
	COpenFontShaperCacheEntry* iPrevious;	// pointer to previous node in tree
sl@0
    56
	COpenFontShaperCacheEntry* iNext;		// pointer to next shaping info node in the list
sl@0
    57
sl@0
    58
	/** The shaped information that is cached */
sl@0
    59
	TShapeHeader* iShapeHeader;
sl@0
    60
	/** Input information */
sl@0
    61
	TUint16* iText;
sl@0
    62
	TInt iStart;
sl@0
    63
	TInt iEnd;
sl@0
    64
	TInt iScript;
sl@0
    65
	/** pointer to a private heap for allocating the handle-refcount array*/
sl@0
    66
	RHeap* iHeap;
sl@0
    67
	/** linked list of THandleCount to store the handle-refcount information */
sl@0
    68
	THandleCount* iHandleRefList;
sl@0
    69
	TInt iHandleRefCount;
sl@0
    70
	};
sl@0
    71
	
sl@0
    72
/***********************SHAPER CACHE ENDS HERE********************************/
sl@0
    73