fontservices/fontstore/tfs/T_IsolatedFontStore.cpp
branchGCC_SURGE
changeset 49 4d76f1414957
parent 44 601ab138ba0b
child 55 336bee5c2d35
equal deleted inserted replaced
38:235ab7462409 49:4d76f1414957
     1 /*
     1 /*
     2 * Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 1995-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    17 
    17 
    18 #include "T_IsolatedFontStore.h"
    18 #include "T_IsolatedFontStore.h"
    19 #include <graphics/openfontrasterizer.h>
    19 #include <graphics/openfontrasterizer.h>
    20 #include <graphics/openfontconstants.h>
    20 #include <graphics/openfontconstants.h>
    21 
    21 
    22 CTIsolatedFontStore::CTIsolatedFontStore()
    22 CTIsolatedFontStore::CTIsolatedFontStore():iIsHeapOwner(ETrue)
    23 	{
    23 	{
    24 	}
    24 	}
       
    25 
       
    26 CTIsolatedFontStore::CTIsolatedFontStore(RHeap* aHeap):iIsHeapOwner(EFalse),iHeap(aHeap)
       
    27     {
       
    28     }
    25 
    29 
    26 CTIsolatedFontStore::~CTIsolatedFontStore()
    30 CTIsolatedFontStore::~CTIsolatedFontStore()
    27 	{
    31 	{
    28 	delete iFs;
    32 	delete iFs;
    29 	if (iHeap)
    33 	if (iIsHeapOwner && iHeap)
    30 		iHeap->Close();
    34 	    {
       
    35 	    iHeap->Close();
       
    36 	    }
    31 	REComSession::FinalClose();
    37 	REComSession::FinalClose();
    32 	}
    38 	}
    33 
    39 
    34 CTIsolatedFontStore* CTIsolatedFontStore::NewLC()
    40 CTIsolatedFontStore* CTIsolatedFontStore::NewLC()
    35 	{
    41 	{
    44 	CTIsolatedFontStore* self=CTIsolatedFontStore::NewLC();
    50 	CTIsolatedFontStore* self=CTIsolatedFontStore::NewLC();
    45 	CleanupStack::Pop(); // self;
    51 	CleanupStack::Pop(); // self;
    46 	return self;
    52 	return self;
    47 	}
    53 	}
    48 
    54 
       
    55 CTIsolatedFontStore* CTIsolatedFontStore::NewLC(RHeap * aHeap)
       
    56     {
       
    57     CTIsolatedFontStore* self = new (ELeave)CTIsolatedFontStore(aHeap);
       
    58     CleanupStack::PushL(self);
       
    59     self->ConstructL();
       
    60     return self;
       
    61     }
       
    62 
       
    63 CTIsolatedFontStore* CTIsolatedFontStore::NewL(RHeap * aHeap)
       
    64     {
       
    65     CTIsolatedFontStore* self=CTIsolatedFontStore::NewLC(aHeap);
       
    66     CleanupStack::Pop(); // self;
       
    67     return self;
       
    68     }
       
    69 
    49 void CTIsolatedFontStore::ConstructL()
    70 void CTIsolatedFontStore::ConstructL()
    50 	{
    71 	{
    51 	iHeap = UserHeap::ChunkHeap(NULL,0x10000,0x10000);
    72     if(iIsHeapOwner)
       
    73         {
       
    74         iHeap = UserHeap::ChunkHeap(NULL,0x10000,0x10000);
       
    75         }	
    52 	iFs = CFontStore::NewL(iHeap);
    76 	iFs = CFontStore::NewL(iHeap);
    53 	}
    77 	}
    54 
    78 
    55 /**
    79 /**
    56 Load all available font rasterizers and install to the instance of CFontStore
    80 Load all available font rasterizers and install to the instance of CFontStore