--- a/charconvfw/charconvplugins/group/EucJpDirectmap.mmp Mon Jul 12 14:38:26 2010 +0800
+++ b/charconvfw/charconvplugins/group/EucJpDirectmap.mmp Mon Jul 12 15:26:00 2010 +0800
@@ -18,13 +18,6 @@
*
*/
-
-
-
-
-#ifdef EKA2
-///////////////////////////////////////////////////////////////
-
TARGET EucJpDirectmap.dll
TARGETTYPE PLUGIN
CAPABILITY All -Tcb
@@ -61,46 +54,3 @@
end
SMPSAFE
-
-///////////////////////////////////////////////////////////////
-#else // Not EKA2
-///////////////////////////////////////////////////////////////
-// 2.8 Code
-target EucJpDirectmap.CPL
-targetpath /system/charconv
-targettype dll
-uid 0x1000601a 0x101F86A6
-VENDORID 0x70000001
-
-SOURCEPATH ../src/plugins
-
-USERINCLUDE ../inc
-USERINCLUDE ../src/inc
-USERINCLUDE ../src/shared
-source EucJpDirectmap.CPP
-
-library euser.lib
-library convutils.lib
-library jisx0201_2.lib
-library jisx0208_2.lib
-library jisx0212.lib
-library CnvShiftJisDirectmap.lib
-
-SOURCEPATH ../resource
-start resource EucJpDirectmap.RSS
-lang sc
-end
-
-#if defined(ARMCC)
-deffile /epoc32/include/def/EABI/CONVPLUG.DEF
-#elif defined(WINSCW)
-deffile /epoc32/release/winscw/CONVPLUG.DEF
-#elif defined(WINS)
-deffile /epoc32/release/wins/CONVPLUG.DEF
-#else
-deffile /epoc32/release/marm/CONVPLUG.DEF
-#endif
-
-CAPABILITY CAP_GENERAL_DLL
-///////////////////////////////////////////////////////////////
-#endif
--- a/charconvfw/charconvplugins/group/ShiftJisDirectmap.mmp Mon Jul 12 14:38:26 2010 +0800
+++ b/charconvfw/charconvplugins/group/ShiftJisDirectmap.mmp Mon Jul 12 15:26:00 2010 +0800
@@ -18,11 +18,6 @@
*
*/
-
-
-#ifdef EKA2
-///////////////////////////////////////////////////////////////
-// 3.0 Code
TARGET ShiftJisDirectmap.dll
TARGETTYPE PLUGIN
CAPABILITY All -Tcb
@@ -60,42 +55,3 @@
SMPSAFE
-///////////////////////////////////////////////////////////////
-#else // Not EKA2
-///////////////////////////////////////////////////////////////
-// 2.8 Code
-target ShiftJisDirectmap.CPL
-targetpath /system/charconv
-targettype dll
-uid 0x1000601a 0x101F8691
-
-SOURCEPATH ../src/plugins
-USERINCLUDE ../inc
-source ShiftJisDirectmap.CPP
-
-library euser.lib
-//use CnvShiftJis::ReplacementForUnconvertibleUnicodeCharacters()
-//library shiftjis_kddiau_shared.lib
-library convutils.lib
-library jisx0201_2.lib
-library jisx0208_2.lib
-library CnvShiftJisDirectmap.lib
-
-SOURCEPATH ../resource
-start resource ShiftJisDirectmap.RSS
-lang sc
-end
-
-#if defined(ARMCC)
-deffile /epoc32/include/def/EABI/CONVPLUG.DEF
-#elif defined(WINSCW)
-deffile /epoc32/release/winscw/CONVPLUG.DEF
-#elif defined(WINS)
-deffile /epoc32/release/wins/CONVPLUG.DEF
-#else
-deffile /epoc32/release/marm/CONVPLUG.DEF
-#endif
-
-CAPABILITY CAP_GENERAL_DLL
-///////////////////////////////////////////////////////////////
-#endif
--- a/fontservices/fontstore/inc/FNTSTORE.H Mon Jul 12 14:38:26 2010 +0800
+++ b/fontservices/fontstore/inc/FNTSTORE.H Mon Jul 12 15:26:00 2010 +0800
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 1995-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -39,19 +39,6 @@
*/
const TInt KMaxLinkedTypefaceGroups = 12;
-/** Defines the maximun number of threads that may tranverse the COpenFontSessionCacheList (read-only)
- @publishedAll
- @released
- */
-const TInt KSessionCacheSemaphoreCount = 12;
-
-/** Defines the name of the semaphore which is used to exclude threads that may tranverse
- * the COpenFontSessionCacheList (read-only) with FBserv.
- @publishedAll
- @released
- */
-_LIT(KSessionCacheSemaphoreName,"FBSSessionCacheSemaphore");
-
class CLinkedTypefaceSpecification;
class TLinkedTypefaceSpecificationArgs;
class CFbClient;
@@ -446,7 +433,7 @@
TInt iOpenFontShaperCacheMemUsage;
TInt iNumberOfShaperCaches;
RPointerArray<CTypefaceSupportInfo> iOpenFontTypefaceSupportList;
- RArray<RHandleBase> *iHandleArray;
+ TAny* iUnused;
TAny* iUnused2;
TUint32 iUniqueFontIdCount;
};
--- a/fontservices/fontstore/inc/OPENFONT.H Mon Jul 12 14:38:26 2010 +0800
+++ b/fontservices/fontstore/inc/OPENFONT.H Mon Jul 12 15:26:00 2010 +0800
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 1998-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -39,7 +39,6 @@
class COpenFontFile;
class COpenFontGlyph;
class COpenFontGlyphCache;
-class COpenFontGlyphTreeEntry;
class COpenFontPositioner;
class COpenFontSessionCache;
class COpenFontSessionCacheList;
@@ -251,7 +250,6 @@
// is actually of size iBitmapBufferSize.
};
-class COpenFontGlyph;
/**
Open Font System font abstract base class.
@@ -341,14 +339,6 @@
TInt GetFontTable(TUint32 aTag, TAny*& aTableContent, TInt& aLength);
TInt GetGlyphOutline(TUint aCode, TBool aHinted, TAny*& aOutline, TInt& aLength);
-protected:
- /** WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases.
- */
- TInt PointerToThisOffset(const TAny* aAny);
- /** WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases.
- */
- TAny* ThisOffsetToPointer(const TInt aOffset);
-
protected:
RHeap* iHeap;
TOpenFontMetrics iMetrics;
@@ -380,16 +370,11 @@
TInt iFontLineGap;
private:
const COpenFontGlyph* Glyph(TInt aSessionHandle,TInt aCode) const;
-protected:
-
- /** WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases.
- */
- const COpenFontGlyph* FontCacheGlyph(TInt aCode,TInt*& aNode);
+
const COpenFontGlyph* FontCacheGlyph(TInt aCode);
void SetGlyphCache(COpenFontGlyphCache* aGlyphCache);
-private:
const COpenFontGlyph* SessionCacheGlyph(RHeap* aHeap,TInt aSessionHandle,TInt aCode,
COpenFontSessionCache*& aCache,TInt& aIndex,TBool aCreate) const;
void RasterizeHelperL(TInt aCode,TOpenFontGlyphData* aGlyphData,TOpenFontGlyphData*& aTempGlyphData);
@@ -406,14 +391,10 @@
TInt iFileOffset;
TInt iFaceIndex; // index of the face in the font file
-protected:
- /**
- WARNING: Compatibility is not guaranteed in future releases. Please use the provided APIs only.
- Offset from the address of this font of the per-font glyph cache which is owned by the font
- @internalTechnology
- */
+
+ // Offset from the address of this font of the per-font glyph cache which is owned by the font
TInt iGlyphCacheOffset;
-private:
+
// Offset from the address of this font of the list of per-session glyph
// caches which are owned by CFontStore
TInt iSessionCacheListOffset;
--- a/fontservices/fontstore/inc/openfontsprivate.h Mon Jul 12 14:38:26 2010 +0800
+++ b/fontservices/fontstore/inc/openfontsprivate.h Mon Jul 12 15:26:00 2010 +0800
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -19,7 +19,9 @@
#ifndef __OPENFONTS_PRIVATE_H__
#define __OPENFONTS_PRIVATE_H__
+#include <hextree.h>
#include <e32hashtab.h>
+
class COpenFontShaperCacheEntry;
/* MSB is set to indicate a glyph code rather than a unicode value
@@ -38,70 +40,37 @@
};
/**
+ Note: this class must be self-contained, since instances are added to an RHexTree,
+ that is, it must be possible to destroy instances simply with RHeap::Free().
@internalComponent
*/
class COpenFontGlyph
{
public:
- COpenFontGlyph(TInt aCode, TInt aGlyphIndex, const TOpenFontCharMetrics& aMetrics):
- iCode(aCode), iGlyphIndex(aGlyphIndex), iMetrics(aMetrics), iBitmapOffset(0) { }
-
- static COpenFontGlyph* NewL(RHeap* aHeap, TInt aCode, TInt aGlyphIndex,
- const TOpenFontCharMetrics& aMetrics, const TDesC8& aBitmap);
-
- static void Delete(RHeap* aHeap, COpenFontGlyph* aGlyph);
- TUint8* Bitmap() const;
-
- TInt iCode; // the Unicode value of the character
- TInt iGlyphIndex; // the glyph index
- TOpenFontCharMetrics iMetrics; // the metrics
+ static COpenFontGlyph* New(RHeap* aHeap, TInt aCode, TInt aGlyphIndex,
+ const TOpenFontCharMetrics& aMetrics, const TDesC8& aBitmap);
+ inline static void Delete(RHeap* aHeap, COpenFontGlyph* aGlyph);
+ inline const TUint8* Bitmap() const;
protected:
- TBool SetBitmap(RHeap* aHeap, const TDesC8& aBitmap);
- ~COpenFontGlyph();
-
+ COpenFontGlyph(TInt aCode, TInt aGlyphIndex, const TOpenFontCharMetrics& aMetrics)
+ : iCode(aCode), iGlyphIndex(aGlyphIndex), iMetrics(aMetrics), iBitmapOffset(0) {}
+ ~COpenFontGlyph() {}
+ void SetBitmap(const TAny* aBitmap);
+
+public:
+ const TInt iCode; // the Unicode value of the character
+ const TInt iGlyphIndex; // the glyph index
+ const TOpenFontCharMetrics iMetrics; // the metrics
+
private:
// an offset from this COpenFontGlyph object to a pointer to the run-length-encoded bitmap,
// calculated as (bitmapPointer)-(this)
- TInt iBitmapOffset;
- };
-/**
- Binary tree of glyphs. Each glyph can have left and right child nodes which are added
- depending on the value of their glyph code relative to the parent's glyph code.
-
- @internalComponent
- */
-class COpenFontGlyphTreeEntry: public COpenFontGlyph
- {
- friend class COpenFont;
-
-public:
- static COpenFontGlyphTreeEntry* New(RHeap* aHeap, TInt aCode, TInt aGlyphIndex,
- const TOpenFontCharMetrics& aMetrics, const TDesC8& aBitmap);
-
-private:
- /** The left COpenFontGlyphTreeEntry from this entry. Represented by an offset from the
- current heap base. Use COpenFont::ThisOffsetToPointer() to convert to a valid
- COpenFontGlyphTreeEntry pointer. */
- TInt iLeftOffset;
- /** The right COpenFontGlyphTreeEntry from this entry. Represented by an offset from the
- current heap base. Use COpenFont::ThisOffsetToPointer() to convert to a valid
- COpenFontGlyphTreeEntry pointer. */
- TInt iRightOffset;
- /** Pointer to next glyph that was added to the glyph cache. This enables
- non-recursive deletion of the cache. This is only ever accessed from server
- process, so can be a direct pointer, not an offset. */
- COpenFontGlyphTreeEntry* iNext;
-
-private:
- COpenFontGlyphTreeEntry(TInt aCode, TInt aGlyphIndex, const TOpenFontCharMetrics& aMetrics)
- : COpenFontGlyph(aCode, aGlyphIndex, aMetrics), iLeftOffset(0), iRightOffset(0),iNext(NULL){}
-
- ~COpenFontGlyphTreeEntry();
+ TInt iBitmapOffset;
};
/**
- * Template for offset implementation of pointer to pointer
+ * Template for offset implementation of pointer array
@internalComponent
*/
template<class T>
@@ -130,16 +99,23 @@
class COpenFontGlyphCache
{
public:
- COpenFontGlyphCache(): iGlyphTreeOffset(0), iGlyphCacheMemory(0),iGlyphList(NULL),iShaperCacheSentinel(NULL), iShapingInfoCacheMemory(0), iNumberOfShaperCacheEntries(0) { }
+ COpenFontGlyphCache(RHeap* aHeap)
+ : iGlyphTreeById(aHeap),
+ iGlyphTreeByUnicode(aHeap),
+ iGlyphCacheMemory(0),
+ iShaperCacheSentinel(NULL),
+ iShapingInfoCacheMemory(0),
+ iNumberOfShaperCacheEntries(0)
+ {}
TShapeHeader* SearchShaperCache(TInt aSessionHandle, TFontShapeFunctionParameters*& aParams);
TShapeHeader* Insert(TInt aSessionHandle, RHeap* aHeap, CShaper::TInput aInput, TShapeHeader* aShapeHeader, TInt& aAddedBytes);
TInt DeleteLeastRecentlyUsedEntry(RHeap* aHeap);
TBool ShaperCacheIsEmpty();
public:
- TInt iGlyphTreeOffset; // an offset to root of the glyph cache; a binary tree
+ RHexTree<COpenFontGlyph> iGlyphTreeById; // a hex tree of glyphs indexed by glyph ID
+ RHexTree<COpenFontGlyph> iGlyphTreeByUnicode; // a hex tree of glyphs indexed by Unicode code point
TInt iGlyphCacheMemory; // memory used by the glyph tree in bytes
- COpenFontGlyphTreeEntry* iGlyphList; // the glyphs, organized as a list
COpenFontShaperCacheEntry* iShaperCacheSentinel;
TInt iShapingInfoCacheMemory;
TInt iNumberOfShaperCacheEntries;
@@ -148,12 +124,12 @@
/**
@internalComponent
*/
-
class COpenFontSessionCacheEntry: public COpenFontGlyph
{
public:
static COpenFontSessionCacheEntry* New(RHeap* aHeap, const COpenFont* aFont, TInt aCode, TInt aGlyphIndex,
const TOpenFontCharMetrics& aMetrics, const TDesC8& aBitmap);
+ inline static void Delete(RHeap* aHeap, COpenFontSessionCacheEntry* aEntry);
inline const COpenFont* Font()const;
private:
@@ -191,25 +167,6 @@
ROffsetArray<COpenFontSessionCacheEntry> iEntryArray;
};
-/**
- @internalComponent
- */
-class COpenFontSessionCacheListItem
- {
-public:
- COpenFontSessionCacheListItem(COpenFontSessionCache* aCache);
-
- COpenFontSessionCacheListItem* Next();
- void SetNext(COpenFontSessionCacheListItem* aNext);
- COpenFontSessionCache* Cache();
-
- void Delete(RHeap* aHeap);
-private:
- ~COpenFontSessionCacheListItem();
-private:
- TInt iNextOffset;
- TInt iCacheOffset;
- };
class TFontTableGlyphOutlineCacheMemMonitor
{
@@ -432,12 +389,35 @@
// inline functions
+
+inline void COpenFontGlyph::Delete(RHeap* aHeap, COpenFontGlyph* aGlyph)
+ {
+ aHeap->Free(aGlyph);
+ }
+
+/**
+@return A pointer to the bitmap data stored with this glyph, or NULL
+if no bitmap has been stored with this glyph.
+ */
+inline const TUint8* COpenFontGlyph::Bitmap() const
+ {
+ if (iBitmapOffset)
+ {
+ return reinterpret_cast<const TUint8*>(PtrAdd(this, iBitmapOffset));
+ }
+ return NULL;
+ }
+
inline COpenFontSessionCacheEntry::COpenFontSessionCacheEntry(const COpenFont* aFont, TInt aCode, TInt aGlyphIndex,const TOpenFontCharMetrics& aMetrics) :
COpenFontGlyph(aCode, aGlyphIndex, aMetrics)
{
iFontOffset = aFont ? reinterpret_cast<TInt>(aFont) - reinterpret_cast<TInt>(this) : 0;
}
+inline void COpenFontSessionCacheEntry::Delete(RHeap* aHeap, COpenFontSessionCacheEntry* aEntry)
+ {
+ COpenFontGlyph::Delete(aHeap, aEntry);
+ }
inline const COpenFont* COpenFontSessionCacheEntry::Font() const
{
@@ -445,10 +425,7 @@
{
return reinterpret_cast<const COpenFont*> (PtrAdd(this, iFontOffset));
}
- else
- {
- return NULL;
- }
+ return NULL;
}
#endif // __OPENFONTSPRIVATE_H__
--- a/fontservices/fontstore/src/FNTSTD.H Mon Jul 12 14:38:26 2010 +0800
+++ b/fontservices/fontstore/src/FNTSTD.H Mon Jul 12 15:26:00 2010 +0800
@@ -52,7 +52,7 @@
// COpenFontSessionCacheList is placed here rather than openfont.cpp because it is used in fntstore.cpp as well.
-class COpenFontSessionCacheListItem;
+class COpenFontSessionCache;
class COpenFont;
class COpenFontSessionCacheList
@@ -62,20 +62,21 @@
{
public:
inline COpenFontSessionCacheList();
+ TInt AddCache(COpenFontSessionCache* aCache);
+ COpenFontSessionCache* FindCache(TInt aSessionHandle) const;
void Delete(RHeap* aHeap);
void DeleteCache(RHeap* aHeap,TInt aSessionHandle);
-
- COpenFontSessionCacheListItem* Start();
- void SetStart(COpenFontSessionCacheListItem* aItem);
-
void DeleteFontGlyphs(RHeap* aHeap,const COpenFont* aFont);
-
- TInt iStartOffset;
+private:
+ enum { EMaxNumCaches = 256 };
+private:
+ TInt iSessionHandleArray[EMaxNumCaches];
+ TInt iCacheOffsetArray[EMaxNumCaches];
};
-inline COpenFontSessionCacheList::COpenFontSessionCacheList():
- iStartOffset(0)
+inline COpenFontSessionCacheList::COpenFontSessionCacheList()
{
+ Mem::FillZ(this, sizeof(COpenFontSessionCacheList));
}
/**
--- a/fontservices/fontstore/src/FNTSTORE.CPP Mon Jul 12 14:38:26 2010 +0800
+++ b/fontservices/fontstore/src/FNTSTORE.CPP Mon Jul 12 15:26:00 2010 +0800
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 1995-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -80,7 +80,7 @@
Array stored in Twips as that is the only form of the value currently used.
@internalComponent
-*/
+*/
#define POINTSIZE_IN_TWIPS(p) ((p) * 20)
const TInt gOpenFontSizeInTwipsArray[] =
{
@@ -207,7 +207,7 @@
{
if (aAny && aHeapBase)
{
- return (TInt)aAny - (TInt)aHeapBase;
+ return reinterpret_cast<TInt>(aAny) - reinterpret_cast<TInt>(aHeapBase);
}
return 0;
}
@@ -219,15 +219,16 @@
@return A pointer relative to the passed heap base.
@see PointerToOffset()
*/
-LOCAL_C TAny* OffsetToPointer(const TInt aOffset, TUint8* aHeapBase)
+LOCAL_C TAny* OffsetToPointer(TInt aOffset, TUint8* aHeapBase)
{
if (aOffset && aHeapBase)
{
- return (TAny*)(aOffset + (TInt)aHeapBase);
+ return reinterpret_cast<TAny*>(aOffset + reinterpret_cast<TInt>(aHeapBase));
}
return NULL;
}
+
// CTypefaceSupportInfo
CTypefaceSupportInfo::CTypefaceSupportInfo()
{
@@ -548,11 +549,11 @@
{
// Set iOpenFont to be the offset of aOpenFont from the address of CBitmapFont.
// In order to be able to identify iOpenFont as an offset instead of a pointer,
- // bitwise or the offset with 1. Pointers will always be byte aligned (and therefore even).
+ // bitwise or the offset with 1. Pointers will always be word aligned (and therefore even).
if (aOpenFont)
{
+ __ASSERT_DEBUG(!(reinterpret_cast<TInt>(aOpenFont) & 1), Panic(EFntPointerNotByteAligned));
iOpenFont = reinterpret_cast<COpenFont*>((reinterpret_cast<TInt>(aOpenFont) - reinterpret_cast<TInt>(this)) | 1);
- __ASSERT_DEBUG((reinterpret_cast<TInt>(iOpenFont) & 1),Panic(EFntPointerNotByteAligned));
}
else
{
@@ -2247,27 +2248,7 @@
TMachineInfoV1Buf machineInfoBuffer;
User::LeaveIfError(UserHal::MachineInfo(machineInfoBuffer));
-
- //Create Handles which may be used by Fntstore
- iHandleArray = new(ELeave) RArray<RHandleBase>();
-
- RSemaphore SessionCacheSem;
- TInt ret = SessionCacheSem.CreateGlobal(KSessionCacheSemaphoreName,KSessionCacheSemaphoreCount);
- if(ret == KErrAlreadyExists)
- {
- User::LeaveIfError(SessionCacheSem.OpenGlobal(KSessionCacheSemaphoreName));
- }
- else
- {
- User::LeaveIfError(ret);
- }
- ret = iHandleArray->Append(SessionCacheSem);
- if(ret != KErrNone)
- {
- SessionCacheSem.Close();
- User::Leave(ret);
- }
-
+
const TSize twipSize = machineInfoBuffer().iPhysicalScreenSize;
const TSize pixelSize = machineInfoBuffer().iDisplaySizeInPixels;
@@ -2316,15 +2297,6 @@
iOpenFontSessionCacheList->Delete(iHeap);
iHeap->Free(iOpenFontSessionCacheList);
}
- if (iHandleArray)
- {
- for (TInt i = 0; i < iHandleArray->Count(); i++)
- {
- (*iHandleArray)[i].Close();
- }
- iHandleArray->Close();
- delete iHandleArray;
- }
iFs.Close();
delete iFontTableCache;
--- a/fontservices/fontstore/src/OPENFONT.CPP Mon Jul 12 14:38:26 2010 +0800
+++ b/fontservices/fontstore/src/OPENFONT.CPP Mon Jul 12 15:26:00 2010 +0800
@@ -389,7 +389,7 @@
{
return NULL;
}
- new (glyphCache) COpenFontGlyphCache;
+ new (glyphCache) COpenFontGlyphCache(iHeap);
SetGlyphCache(glyphCache);
}
// If there is no sentinel present, i.e. new cache
@@ -532,12 +532,8 @@
COpenFontGlyphCache* glyphCache = GetGlyphCache();
if (glyphCache != NULL)
{
- COpenFontGlyphTreeEntry* next = NULL;
- for (COpenFontGlyphTreeEntry* g = glyphCache->iGlyphList; g != NULL; g = next)
- {
- next = g->iNext;
- COpenFontGlyph::Delete(iHeap, g);
- }
+ glyphCache->iGlyphTreeById.ResetAndDestroy();
+ glyphCache->iGlyphTreeByUnicode.ResetAndDestroy();
// Delete the shaper cache as well
if (glyphCache->iShaperCacheSentinel)
@@ -573,19 +569,6 @@
}
}
-COpenFontGlyph::~COpenFontGlyph()
- {
- }
-
-void COpenFontGlyph::Delete(RHeap* aHeap, COpenFontGlyph* aGlyph)
- {
- if (aGlyph != NULL)
- {
- aHeap->Free(aGlyph->Bitmap());
- aHeap->Free(aGlyph);
- }
- }
-
EXPORT_C void COpenFont::operator delete(TAny *aFont)
{
if(aFont != NULL)
@@ -624,21 +607,12 @@
{
return EFalse;
}
- new(glyphCache) COpenFontGlyphCache;
+ new(glyphCache) COpenFontGlyphCache(iHeap);
SetGlyphCache(glyphCache);
}
// Look in the Font Cache
- TInt* nodeInsertPtr = NULL;
- const COpenFontGlyph* g = FontCacheGlyph(aCode, nodeInsertPtr);
-
- // If it is not found there look in the session cache.
- COpenFontSessionCache* cache = NULL;
- TInt index = 0;
- if (g == NULL)
- {
- g = SessionCacheGlyph(iHeap, aSessionHandle, aCode, cache, index, EFalse);
- }
+ const COpenFontGlyph* g = FontCacheGlyph(aCode);
// If it has already been rasterized return it.
if (g != NULL)
@@ -664,57 +638,48 @@
TBool glyph_data_valid = ETrue;
const TOpenFontGlyphData* cur_glyph_data = temp_glyph_data ? temp_glyph_data : aGlyphData;
- const COpenFontGlyph* new_glyph = NULL;
+ COpenFontGlyph* new_glyph = NULL;
// If the maximum per-font cache memory will not be exceeded, put the glyph into the font cache.
- TInt bytes = sizeof(COpenFontGlyphTreeEntry) + cur_glyph_data->BytesNeeded();
+ TInt bytes = sizeof(COpenFontGlyph) + cur_glyph_data->BytesNeeded();
if(glyphCache != NULL && bytes + glyphCache->iGlyphCacheMemory <= KMaxGlyphCacheMemory)
{
- COpenFontGlyphTreeEntry* new_entry = COpenFontGlyphTreeEntry::New(iHeap, aCode, cur_glyph_data->GlyphIndex(), *cur_glyph_data->Metrics(), cur_glyph_data->Bitmap());
- new_glyph=new_entry;
- if (new_entry != NULL)
+ new_glyph = COpenFontGlyph::New(iHeap, aCode, cur_glyph_data->GlyphIndex(), *cur_glyph_data->Metrics(), cur_glyph_data->Bitmap());
+ if (new_glyph != NULL)
{
- // Add the glyph to a leaf node using the nodeInsertPtr that was returned by FontCacheGlyph()
- // This is the first node if the glyph cache is empty. This updates the cache atomically.
- *nodeInsertPtr = PointerToThisOffset(new_entry);
-
- // If new_entry is not the first in the cache, set the previous
- // entry to link to this so that a linked-list of entries can be
- // maintained to simplify deletion.
- COpenFontGlyphTreeEntry* tree = static_cast<COpenFontGlyphTreeEntry*> (ThisOffsetToPointer(glyphCache->iGlyphTreeOffset));
- __ASSERT_DEBUG(tree != NULL, User::Invariant());
- if (new_entry != tree)
- {
- while (tree->iNext != NULL)
- {
- tree = tree->iNext;
- }
- tree->iNext = new_entry;
- }
- else
- {
- // First entry in tree, initialise iGlyphList
- glyphCache->iGlyphList = new_entry;
- }
-
- glyphCache->iGlyphCacheMemory += bytes;
- }//if (new_entry)
+ if ((aCode & 0x80000000) != 0)
+ {
+ error = glyphCache->iGlyphTreeById.SetAt(aCode & 0x7FFFFFFF, new_glyph);
+ }
+ else
+ {
+ error = glyphCache->iGlyphTreeByUnicode.SetAt(aCode, new_glyph);
+ }
+ if (error == KErrNone)
+ {
+ glyphCache->iGlyphCacheMemory += bytes;
+ }
+ else
+ {
+ iHeap->Free(new_glyph);
+ new_glyph = NULL;
+ }
+ }
}
+ // Otherwise put the glyph into the per-session cache.
else
{
- error = KErrGeneral;
- }
-
- // Otherwise put the glyph into the per-session cache.
- if (error != KErrNone)
- {
- // If the session cache is not yet known find it or create one.
- if (cache == NULL)
- {
- SessionCacheGlyph(iHeap, aSessionHandle, aCode, cache, index, TRUE);
- }
+ // Look in the session cache. Do not expect to find the glyph here
+ // since the session cache has already been searched client-side.
+ // However, SessionCacheGlyph() is called so that the session cache is
+ // created if needed and an index is found where the new glyph will be
+ // placed when added to the session cache.
+ COpenFontSessionCache* cache = NULL;
+ TInt index = 0;
+ (void)SessionCacheGlyph(iHeap, aSessionHandle, aCode, cache, index, ETrue);
if (cache == NULL)
{
+ iHeap->Free(temp_glyph_data);
return EFalse;
}
@@ -877,39 +842,6 @@
return ret;
}
-/** Given the passed pointer aAny, return an offset from it to the "this" pointer
-of this COpenFont object.
-@param aAny A pointer to an object that exists on the shared heap, i.e. the same heap
-that this CCOpenFont object was created on.
-@return An offset relative to the "this" pointer for this object, this offset can
-be converted back to a pointer using ThisOffsetToPointer().
-@see ThisOffsetToPointer().
-@internalComponent
- */
-TInt COpenFont::PointerToThisOffset(const TAny* aAny)
- {
- if (aAny != NULL)
- {
- return ((TInt)aAny - (TInt)this);
- }
- return 0;
- }
-
-/** Given the passed passed offset aThisOffset, convert it to a pointer relative to
-the "this" pointer for this object.
-@param aThisOffset An offset that was generated using PointerToThisOffset().
-@return A pointer that has been created by adding (this+aThisOffset).
-@see PointerToThisOffset().
-@internalComponent
- */
-TAny* COpenFont::ThisOffsetToPointer(const TInt aThisOffset)
- {
- if (aThisOffset)
- {
- return (TAny*)((TInt)this + aThisOffset);
- }
- return NULL;
- }
/**
A constructor initialised with a TCharacterMetrics object.
@@ -1018,86 +950,17 @@
@return A pointer to the requested glyph if it was found in the glyph cache, NULL if it was not found.
*/
const COpenFontGlyph* COpenFont::FontCacheGlyph(TInt aCode)
- {
+ {
if (COpenFontGlyphCache* glyphCache = GetGlyphCache())
- {
- COpenFontGlyphTreeEntry* node = NULL;
- if (glyphCache->iGlyphTreeOffset)
- {
- node = static_cast<COpenFontGlyphTreeEntry*>(ThisOffsetToPointer(glyphCache->iGlyphTreeOffset));
- }
-
- while (node != NULL)
+ {
+ if ((aCode & 0x80000000) != 0)
{
- TInt code = node->iCode;
- if(code == aCode)
- {
- // Found the glyph
- return node;
- }
- else if(code > aCode)
- {
- node = static_cast<COpenFontGlyphTreeEntry*>(ThisOffsetToPointer(node->iLeftOffset));
- }
- else
- {
- node = static_cast<COpenFontGlyphTreeEntry*>(ThisOffsetToPointer(node->iRightOffset));
- }
- }
- }
- // No glyph found
- return NULL;
- }
-
-/**
-Retrieve glyph data from the per-font glyph cache.
-If it is not found return NULL and place the address of the node pointer
-to receive a new glyph in aNodeInsertPtr.
-If the cache hasn't been created, then return NULL.
-Previous versions of this function created the cache, but as this function can potentially
-run in the context of threads other than FBSERV the alloc could panic if iHeap's chunk had to
-be resized - this is not allowed by the kernel.
-The cache is now created in COpenFont::Rasterize which can only be called within the context of FBSERV
-@param aCode The code for the glpyh to look for in the cache
-@param aNodeInsertPtr Returns a pointer to a final empty left or right leaf node
-in the glpyh tree where the searched for glyph can be inserted if necessary.
-@return A pointer to the requested glyph if it was found in the glyph cache, NULL if it was not found.
-*/
-const COpenFontGlyph* COpenFont::FontCacheGlyph(TInt aCode, TInt*& aNodeInsertPtr)
- {
- aNodeInsertPtr = NULL;
-
- if (COpenFontGlyphCache* glyphCache = GetGlyphCache())
- {
- COpenFontGlyphTreeEntry* node = NULL;
- if (glyphCache->iGlyphTreeOffset)
- {
- node = static_cast<COpenFontGlyphTreeEntry*> (ThisOffsetToPointer(glyphCache->iGlyphTreeOffset));
- }
- else
- {
- aNodeInsertPtr = &glyphCache->iGlyphTreeOffset;
- }
-
- while (node != NULL)
+ return glyphCache->iGlyphTreeById.At(aCode & 0x7FFFFFFF);
+ }
+ else
{
- TInt code = node->iCode;
- if(code == aCode)
- {
- // Found the glyph
- return node;
- }
- else if(code > aCode)
- {
- aNodeInsertPtr = &node->iLeftOffset;
- node = static_cast<COpenFontGlyphTreeEntry*>(ThisOffsetToPointer(node->iLeftOffset));
- }
- else
- {
- aNodeInsertPtr = &node->iRightOffset;
- node = static_cast<COpenFontGlyphTreeEntry*>(ThisOffsetToPointer(node->iRightOffset));
- }
- }
+ return glyphCache->iGlyphTreeByUnicode.At(aCode);
+ }
}
// No glyph found
@@ -1131,34 +994,12 @@
TInt& aIndex, TBool aCreate) const
{
aIndex = 0;
- COpenFontSessionCacheListItem* prev = NULL;
-
- COpenFontSessionCacheList* cachelist = const_cast<COpenFont*>(this)->SessionCacheList();
- RSemaphore sem;
- if(KErrNone != sem.OpenGlobal(KSessionCacheSemaphoreName))
- {
- RDebug::Print(_L("COpenFont::SessionCacheGlyphe() can't open SessionCacheSemaphore"));
- return NULL;
- }
- sem.Wait();
- COpenFontSessionCacheListItem* cacheListStart=cachelist->Start();
- if(cacheListStart != NULL)
+ COpenFontSessionCacheList* cacheList = SessionCacheList();
+ aCache = cacheList->FindCache(aSessionHandle);
+ if (aCache != NULL)
{
- for (COpenFontSessionCacheListItem* p = cacheListStart; p; p = p->Next())
- {
- COpenFontSessionCache* cache=p->Cache();
- if (cache->iSessionHandle == aSessionHandle)
- {
- aCache = cache;
- sem.Signal();
- sem.Close();
- return aCache->Glyph(this,aCode,aIndex);
- }
- prev = p;
- }
+ return aCache->Glyph(this, aCode, aIndex);
}
- sem.Signal();
- sem.Close();
if (aCreate)
{
@@ -1167,25 +1008,13 @@
if ((!error) && new_cache != NULL)
{
- COpenFontSessionCacheListItem* new_item = (COpenFontSessionCacheListItem*)aHeap->Alloc(sizeof(COpenFontSessionCacheListItem));
- if (new_item == NULL)
+ if (cacheList->AddCache(new_cache) != KErrNone)
{
new_cache->Delete(aHeap);
aHeap->Free(new_cache);
return NULL;
}
- new(new_item) COpenFontSessionCacheListItem(new_cache);
-
- if (prev != NULL)
- {
- prev->SetNext(new_item);
- }
- else
- {
- cachelist->SetStart(new_item);
- }
-
aCache = new_cache;
aIndex = GLYPH_CODE(aCode) % KSessionCacheEntries;
}
@@ -1222,68 +1051,35 @@
Create a glyph data object on the shared heap, given the code, metrics and the data bytes.
The data is copied; ownership remains with the caller.
*/
-COpenFontGlyph* COpenFontGlyph::NewL(RHeap* aHeap, TInt aCode, TInt aGlyphIndex, const TOpenFontCharMetrics& aMetrics, const TDesC8& aBitmap)
+COpenFontGlyph* COpenFontGlyph::New(RHeap* aHeap, TInt aCode, TInt aGlyphIndex, const TOpenFontCharMetrics& aMetrics, const TDesC8& aBitmap)
{
- COpenFontGlyph* glyph = (COpenFontGlyph*)aHeap->AllocL(sizeof(COpenFontGlyph));
- new(glyph) COpenFontGlyph(aCode, aGlyphIndex, aMetrics);
- if (!glyph->SetBitmap(aHeap, aBitmap))
- {
- aHeap->Free(glyph);
- User::Leave(KErrNoMemory);
- }
+ COpenFontGlyph* glyph = (COpenFontGlyph*)aHeap->Alloc(sizeof(COpenFontGlyph) + aBitmap.Size());
+ if (glyph == NULL)
+ {
+ return NULL;
+ }
+ new(glyph) COpenFontGlyph(aCode, aGlyphIndex, aMetrics);
+ glyph->SetBitmap(glyph + 1);
+ Mem::Copy(glyph + 1, aBitmap.Ptr(), aBitmap.Size());
return glyph;
- }
-
-COpenFontGlyphTreeEntry* COpenFontGlyphTreeEntry::New(RHeap* aHeap, TInt aCode, TInt aGlyphIndex, const TOpenFontCharMetrics& aMetrics, const TDesC8& aBitmap)
- {
- COpenFontGlyphTreeEntry* entry = (COpenFontGlyphTreeEntry*)aHeap->Alloc(sizeof(COpenFontGlyphTreeEntry));
- if (entry == NULL)
- return NULL;
- new(entry) COpenFontGlyphTreeEntry(aCode, aGlyphIndex, aMetrics);
- if (!entry->SetBitmap(aHeap, aBitmap))
- {
- aHeap->Free(entry);
- entry = NULL;
- }
- return entry;
}
COpenFontSessionCacheEntry* COpenFontSessionCacheEntry::New(RHeap* aHeap, const COpenFont* aFont, TInt aCode, TInt aGlyphIndex, const TOpenFontCharMetrics& aMetrics, const TDesC8& aBitmap)
{
- COpenFontSessionCacheEntry* entry = (COpenFontSessionCacheEntry*)aHeap->Alloc(sizeof(COpenFontSessionCacheEntry));
+ COpenFontSessionCacheEntry* entry = (COpenFontSessionCacheEntry*)aHeap->Alloc(sizeof(COpenFontSessionCacheEntry) + aBitmap.Size());
if (entry == NULL)
+ {
return NULL;
+ }
new(entry) COpenFontSessionCacheEntry(aFont, aCode, aGlyphIndex, aMetrics);
- if (!entry->SetBitmap(aHeap, aBitmap))
- {
- aHeap->Free(entry);
- entry = NULL;
- }
+ entry->SetBitmap(entry + 1);
+ Mem::Copy(entry + 1, aBitmap.Ptr(), aBitmap.Size());
return entry;
}
-/**
-@return A pointer to the run-length-encoded bitmap stored with this glyph, or NULL
-if no bitmap has been stored with this glyph.
- */
-TUint8* COpenFontGlyph::Bitmap() const
+void COpenFontGlyph::SetBitmap(const TAny* aBitmap)
{
- if (iBitmapOffset)
- {
- return reinterpret_cast<TUint8*>(reinterpret_cast<TInt>(this) + iBitmapOffset);
- }
- return NULL;
- }
-
-TBool COpenFontGlyph::SetBitmap(RHeap* aHeap, const TDesC8& aBitmap)
- {
- TUint8* bitmap = (TUint8*)aHeap->Alloc(aBitmap.Length());
- if (bitmap == NULL)
- return EFalse;
- Mem::Copy(bitmap, aBitmap.Ptr(), aBitmap.Length());
- aHeap->Free(Bitmap());
- iBitmapOffset = reinterpret_cast<TInt>(bitmap) - reinterpret_cast<TInt>(this);
- return ETrue;
+ iBitmapOffset = reinterpret_cast<TInt>(aBitmap) - reinterpret_cast<TInt>(this);
}
COpenFontSessionCache* COpenFontSessionCache::NewL(RHeap* aHeap, TInt aSessionHandle, TInt aEntries)
@@ -1301,17 +1097,16 @@
void COpenFontSessionCache::Delete(RHeap* aHeap)
{
- TInt entries = iEntryArray.Count();
- for (TInt i = 0; i < entries; ++i)
+ TInt numEntries = iEntryArray.Count();
+ for (TInt i = 0; i < numEntries; ++i)
{
- COpenFontSessionCacheEntry* e = iEntryArray[i];
- if (e != NULL)
+ COpenFontSessionCacheEntry* entry = iEntryArray[i];
+ if (entry != NULL)
{
- COpenFont* font=const_cast<COpenFont*>(e->Font());
+ COpenFont* font=const_cast<COpenFont*>(entry->Font());
if (font != NULL)
font->DecrementCachedRefCount(iSessionHandle,NULL,ETrue);
- aHeap->Free(e->Bitmap());
- aHeap->Free(e);
+ COpenFontSessionCacheEntry::Delete(aHeap, entry);
}
}
iEntryArray.Close(aHeap);
@@ -1322,28 +1117,28 @@
aIndex = -1;
TInt oldest = KMaxTInt;
TInt oldest_index = 0;
- TInt entries = iEntryArray.Count();
- TInt index = GLYPH_CODE(aCode) % entries; // simple hash function to shorten searches
- for (TInt i = 0; i < entries; ++i, ++index)
+ TInt numEntries = iEntryArray.Count();
+ TInt index = GLYPH_CODE(aCode) % numEntries; // simple hash function to shorten searches
+ for (TInt i = 0; i < numEntries; ++i, ++index)
{
- if (index >= entries)
+ if (index >= numEntries)
index = 0;
- COpenFontSessionCacheEntry* e = iEntryArray[index];
- if (e == NULL)
+ COpenFontSessionCacheEntry* entry = iEntryArray[index];
+ if (entry == NULL)
{
if (aIndex == -1)
aIndex = index;
}
else
{
- if (e->Font() == aFont && e->iCode == aCode)
+ if (entry->Font() == aFont && entry->iCode == aCode)
{
- e->iLastAccess = iLastAccess++;
- return e;
+ entry->iLastAccess = iLastAccess++;
+ return entry;
}
- if (e->iLastAccess < oldest)
+ if (entry->iLastAccess < oldest)
{
- oldest = e->iLastAccess;
+ oldest = entry->iLastAccess;
oldest_index = index;
}
}
@@ -1357,8 +1152,10 @@
void COpenFontSessionCache::Insert(RHeap* aHeap, COpenFontSessionCacheEntry* aEntry, TInt aIndex)
{
if (aIndex < 0 || aIndex >= iEntryArray.Count())
+ {
Panic(EFntSessionCacheIndexOutOfRange);
- COpenFontGlyph::Delete(aHeap, iEntryArray[aIndex]);
+ }
+ COpenFontSessionCacheEntry::Delete(aHeap, iEntryArray[aIndex]);
iEntryArray.SetAt(aIndex, aEntry);
aEntry->iLastAccess = iLastAccess++;
}
@@ -1369,123 +1166,34 @@
{
}
-/*COpenFontSessionCacheListItem*/
-COpenFontSessionCacheListItem::COpenFontSessionCacheListItem(COpenFontSessionCache* aCache):
- iNextOffset(NULL)
+TInt COpenFontSessionCacheList::AddCache(COpenFontSessionCache* aCache)
{
- if(aCache != NULL)
- {
- iCacheOffset = reinterpret_cast<TInt>(aCache) - reinterpret_cast<TInt>(this);
- }
- else
- {
- iCacheOffset = NULL;
- }
- }
-
-COpenFontSessionCacheListItem::~COpenFontSessionCacheListItem()
- {
+ for (TInt index = 0; index < EMaxNumCaches; ++index)
+ {
+ if (iSessionHandleArray[index] == 0)
+ {
+ iSessionHandleArray[index] = aCache->SessionHandle();
+ iCacheOffsetArray[index] = reinterpret_cast<TInt>(aCache) - reinterpret_cast<TInt>(this);
+ return KErrNone;
+ }
+ }
+ return KErrNoMemory;
}
-/** Delete a COpenFontSessionCacheListItem from the passed heap.
-
-@param aHeap The heap to delete the COpenFontSessionCacheListItem from.
- */
-void COpenFontSessionCacheListItem::Delete(RHeap* aHeap)
+COpenFontSessionCache* COpenFontSessionCacheList::FindCache(TInt aSessionHandle) const
{
- COpenFontSessionCache* cache = Cache();
- if (cache != NULL)
- {
- cache->Delete(aHeap);
- aHeap->Free(cache);
- }
- iCacheOffset=NULL;
- iNextOffset=NULL;
- }
-
-/** Get the next item to this cache list item.
-
-@return A pointer to the next item to this one in the session cache, or NULL
-if there is no next item.
- */
-COpenFontSessionCacheListItem* COpenFontSessionCacheListItem::Next()
- {
- if(iNextOffset)
- {
- COpenFontSessionCacheListItem* next = reinterpret_cast<COpenFontSessionCacheListItem*>(reinterpret_cast<TInt>(this) + iNextOffset);
- return next;
- }
- else
+ if (aSessionHandle == 0)
{
return NULL;
}
- }
-
-/** Sets the next item to this in the session cache.
-
-@param aNext Set this cache list item as the next item to this one in the session cache list.
- */
-void COpenFontSessionCacheListItem::SetNext(COpenFontSessionCacheListItem* aNext)
- {
- if(aNext != NULL)
- {
- iNextOffset = reinterpret_cast<TInt>(aNext) - reinterpret_cast<TInt>(this);
- }
- else
+ for (TInt index = 0; index < EMaxNumCaches; ++index)
{
- iNextOffset = NULL;
- }
- }
-
-/** Get a pointer to the session cache that this cache list item is in.
-
-@return A pointer to the session cache that this cache list item is part of.
- */
-COpenFontSessionCache* COpenFontSessionCacheListItem::Cache()
- {
- if(iCacheOffset)
- {
- COpenFontSessionCache* cache = reinterpret_cast<COpenFontSessionCache*>(reinterpret_cast<TInt>(this) + iCacheOffset);
- return cache;
- }
- else
- {
- return NULL;
+ if (iSessionHandleArray[index] == aSessionHandle)
+ {
+ return reinterpret_cast<COpenFontSessionCache*>(reinterpret_cast<TInt>(this) + iCacheOffsetArray[index]);
+ }
}
- }
-
-/** Get a pointer to the first item in the session cache.
-
-@return A pointer to the first item in the session cache.
- */
-COpenFontSessionCacheListItem* COpenFontSessionCacheList::Start()
- {
- if(iStartOffset)
- {
- COpenFontSessionCacheListItem* start = reinterpret_cast<COpenFontSessionCacheListItem*>(reinterpret_cast<TInt>(this) + iStartOffset);
- return start;
- }
- else
- {
- return NULL;
- }
-
- }
-
-/** Set the passed item as the first item in the session cache.
-
-@param aItem An item to be added to the session cache
- */
-void COpenFontSessionCacheList::SetStart(COpenFontSessionCacheListItem* aItem)
- {
- if(aItem != NULL)
- {
- iStartOffset = reinterpret_cast<TInt>(aItem) - reinterpret_cast<TInt>(this);
- }
- else
- {
- iStartOffset = 0;
- }
+ return NULL;
}
/** Delete all the items in the session cache if the current cache session handle
@@ -1496,46 +1204,22 @@
*/
void COpenFontSessionCacheList::DeleteCache(RHeap* aHeap, TInt aSessionHandle)
{
- RSemaphore sem;
- if (KErrNone != sem.OpenGlobal(KSessionCacheSemaphoreName))
- {
- RDebug::Print(_L("COpenFontSessionCacheList::DeleteCache() can't open SessionCacheSemaphore"));
- return;
+ if (aSessionHandle == 0)
+ {
+ return;
+ }
+ for (TInt index = 0; index < EMaxNumCaches; ++index)
+ {
+ if (iSessionHandleArray[index] == aSessionHandle)
+ {
+ COpenFontSessionCache* cache = reinterpret_cast<COpenFontSessionCache*>(PtrAdd(this, iCacheOffsetArray[index]));
+ cache->Delete(aHeap);
+ aHeap->Free(cache);
+ iSessionHandleArray[index] = 0;
+ iCacheOffsetArray[index] = 0;
+ return;
+ }
}
-
- COpenFontSessionCacheListItem* prev = NULL;
- for (COpenFontSessionCacheListItem* curr = Start(); curr; prev = curr, curr
- = curr->Next())
- {
- COpenFontSessionCache* cache = curr->Cache();
- if (cache != NULL && cache->iSessionHandle == aSessionHandle)
- {
- for (TInt i = 0; i < KSessionCacheSemaphoreCount; i++)
- {
- //coverity[lock]
- //coverity[double_lock]
- sem.Wait();
- }
-
- if (curr == Start())
- {
- SetStart(curr->Next());
- }
- else
- {
- __ASSERT_DEBUG(prev != NULL, User::Invariant());
- prev->SetNext(curr->Next());
- }
-
- curr->Delete(aHeap);
- aHeap->Free(curr);
-
- sem.Signal(KSessionCacheSemaphoreCount);
- sem.Close();
- return;
- }
- }
- sem.Close();
}
/** Delete all the items in the current session cache.
@@ -1544,32 +1228,16 @@
*/
void COpenFontSessionCacheList::Delete(RHeap* aHeap)
{
- RSemaphore sem;
- if(KErrNone != sem.OpenGlobal(KSessionCacheSemaphoreName))
- {
- RDebug::Print(_L("COpenFontSessionCacheList::Delete() can't open SessionCacheSemaphore"));
- return;
- }
-
- COpenFontSessionCacheListItem* cur = Start();
- COpenFontSessionCacheListItem* next = NULL;
-
- for(TInt i=0; i<KSessionCacheSemaphoreCount; i++)
- {
- //coverity[lock]
- //coverity[double_lock]
- sem.Wait();
- }
-
- while (cur != NULL)
+ for (TInt index = 0; index < EMaxNumCaches; ++index)
{
- next = cur->Next();
- cur->Delete(aHeap);
- aHeap->Free(cur);
- cur = next;
+ if (iCacheOffsetArray[index] != 0)
+ {
+ COpenFontSessionCache* cache = reinterpret_cast<COpenFontSessionCache*>(PtrAdd(this, iCacheOffsetArray[index]));
+ cache->Delete(aHeap);
+ aHeap->Free(cache);
+ }
}
- sem.Signal(KSessionCacheSemaphoreCount);
- sem.Close();
+ Mem::FillZ(this, sizeof(COpenFontSessionCacheList));
}
/**
@@ -1577,32 +1245,23 @@
*/
void COpenFontSessionCacheList::DeleteFontGlyphs(RHeap* aHeap, const COpenFont* aFont)
{
- RSemaphore sem;
- if(KErrNone != sem.OpenGlobal(KSessionCacheSemaphoreName))
- {
- RDebug::Print(_L("COpenFontSessionCacheList::DeleteFontGlyphs can't global open SessionCacheSemaphore"));
- return;
+ for (TInt index = 0; index < EMaxNumCaches; ++index)
+ {
+ if (iCacheOffsetArray[index] != 0)
+ {
+ COpenFontSessionCache* cache = reinterpret_cast<COpenFontSessionCache*>(PtrAdd(this, iCacheOffsetArray[index]));
+ TInt numEntries = cache->iEntryArray.Count();
+ for (TInt i = 0; i < numEntries; ++i)
+ {
+ COpenFontSessionCacheEntry* entry = cache->iEntryArray[i];
+ if (entry != NULL && entry->Font() == aFont)
+ {
+ COpenFontSessionCacheEntry::Delete(aHeap, entry);
+ cache->iEntryArray.SetAt(i, NULL);
+ }
+ }
+ }
}
- sem.Wait();
- for (COpenFontSessionCacheListItem* p = Start(); p; p = p->Next())
- {
- COpenFontSessionCache* cache = p->Cache();
- if (cache != NULL)
- {
- TInt entries = cache->iEntryArray.Count();
- for (TInt i = 0; i < entries; ++i)
- {
- COpenFontSessionCacheEntry* e = cache->iEntryArray[i];
- if (e != NULL && e->Font() == aFont)
- {
- COpenFontSessionCacheEntry::Delete(aHeap, e);
- cache->iEntryArray.SetAt(i, NULL);
- }
- }
- } //if(cache != NULL)
- }
- sem.Signal();
- sem.Close();
}
/**
--- a/fontservices/fontstore/tfs/scripts/fntstoretest_T_All.script Mon Jul 12 14:38:26 2010 +0800
+++ b/fontservices/fontstore/tfs/scripts/fntstoretest_T_All.script Mon Jul 12 15:26:00 2010 +0800
@@ -20,7 +20,6 @@
//
LOAD_SUITE TFntStoreServer
RUN_TEST_STEP 300 TFntStoreServer TFnt
-RUN_TEST_STEP 300 TFntStoreServer TCache
RUN_TEST_STEP 100 TFntStoreServer TFntMem
RUN_TEST_STEP 100 TFntStoreServer TFontBitmap
RUN_TEST_STEP 100 TFntStoreServer TFsOpen
--- a/localisation/localesupport/mmpfiles/COLTAB.MMP Mon Jul 12 14:38:26 2010 +0800
+++ b/localisation/localesupport/mmpfiles/COLTAB.MMP Mon Jul 12 15:26:00 2010 +0800
@@ -20,8 +20,6 @@
SOURCEPATH ../coltab
SOURCE coltab.cpp
-//SYSTEMINCLUDE /epoc32/include
-
VENDORID 0x70000001
SMPSAFE
\ No newline at end of file
--- a/textandlocutils/inlinetext/group/InlineText.mmp Mon Jul 12 14:38:26 2010 +0800
+++ b/textandlocutils/inlinetext/group/InlineText.mmp Mon Jul 12 15:26:00 2010 +0800
@@ -38,14 +38,6 @@
USERINCLUDE ../inc
OS_LAYER_SYSTEMINCLUDE_SYMBIAN
-//#ifdef RD_ALF_IN_PLATFORM
-//#include <platform_paths.hrh>
-//MW_LAYER_SYSTEMINCLUDE
-//#else
-//SYSTEMINCLUDE /epoc32/include
-//SYSTEMINCLUDE /epoc32/include/oem
-//#endif
-
LIBRARY euser.lib
LIBRARY efsrv.lib
LIBRARY tagma.lib
--- a/textrendering/textformatting/tbox/LAYEMU.CPP Mon Jul 12 14:38:26 2010 +0800
+++ b/textrendering/textformatting/tbox/LAYEMU.CPP Mon Jul 12 15:26:00 2010 +0800
@@ -1547,7 +1547,7 @@
if(IsFormattingBand() && (iText->EndChar() <= aEndDocPos && iText->EndChar() < iSource->DocumentLength()))
{
- param.iEndChar = aEndDocPos;
+ param.iEndChar = Min(aEndDocPos+1,iSource->DocumentLength());
iText->ExtendFormattingDownwardsL(param);
}
else
--- a/textrendering/textformatting/test/data/TCustomWrap.rss Mon Jul 12 14:38:26 2010 +0800
+++ b/textrendering/textformatting/test/data/TCustomWrap.rss Mon Jul 12 15:26:00 2010 +0800
@@ -19,7 +19,7 @@
NAME WRAP
#include "TCustomWrap.hrh"
-#include <techview/eikon.rh>
+#include <eikon.rh>
#include <uiklafgt/eikcore.rsg>
RESOURCE RSS_SIGNATURE { }
--- a/textrendering/textformatting/test/data/TTranspEditor.rss Mon Jul 12 14:38:26 2010 +0800
+++ b/textrendering/textformatting/test/data/TTranspEditor.rss Mon Jul 12 15:26:00 2010 +0800
@@ -19,7 +19,7 @@
NAME WRAP
#include "TTranspEditor.hrh"
-#include <techview/eikon.rh>
+#include <eikon.rh>
#include <uiklafgt/eikcore.rsg>
RESOURCE RSS_SIGNATURE { }
--- a/textrendering/textformatting/test/group/TCustomWrap.mmp Mon Jul 12 14:38:26 2010 +0800
+++ b/textrendering/textformatting/test/group/TCustomWrap.mmp Mon Jul 12 15:26:00 2010 +0800
@@ -29,8 +29,6 @@
userinclude ../data
userinclude ../../inc
APP_LAYER_SYSTEMINCLUDE_SYMBIAN
-SYSTEMINCLUDE /epoc32/include/techview
-SYSTEMINCLUDE /epoc32/include/platform/app/techview
START RESOURCE ../data/TCustomWrap.rss
HEADER
--- a/textrendering/textformatting/test/group/TForm18030.mmp Mon Jul 12 14:38:26 2010 +0800
+++ b/textrendering/textformatting/test/group/TForm18030.mmp Mon Jul 12 15:26:00 2010 +0800
@@ -28,8 +28,6 @@
SOURCE TForm18030_AppView.cpp
USERINCLUDE ../src/TForm18030
APP_LAYER_SYSTEMINCLUDE_SYMBIAN
-SYSTEMINCLUDE /epoc32/include/techview
-SYSTEMINCLUDE /epoc32/include/platform/app/techview
START RESOURCE TForm18030.rss
HEADER
--- a/textrendering/textformatting/test/group/TTranspEditor.mmp Mon Jul 12 14:38:26 2010 +0800
+++ b/textrendering/textformatting/test/group/TTranspEditor.mmp Mon Jul 12 15:26:00 2010 +0800
@@ -25,8 +25,6 @@
UID 0x100039CE 0x13579ACE
APP_LAYER_SYSTEMINCLUDE_SYMBIAN
-SYSTEMINCLUDE /epoc32/include/techview
-SYSTEMINCLUDE /epoc32/include/platform/app/techview
USERINCLUDE ../../inc
userinclude ../data