summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorIvo Hinkelmann <ihi@openoffice.org>2006-11-14 14:23:47 +0000
committerIvo Hinkelmann <ihi@openoffice.org>2006-11-14 14:23:47 +0000
commitf6c8e313778cc20bbbf82b5efb0b04ce1549dc29 (patch)
tree816caf69e7a59f1a28214497bc8548c6e841e117 /vcl
parent259b21359aeb7ebc836bf45566d385c40b09f216 (diff)
INTEGRATION: CWS aw024 (1.36.32); FILE MERGED
2006/11/10 05:40:53 aw 1.36.32.4: RESYNC: (1.38-1.39); FILE MERGED 2006/09/22 03:17:50 aw 1.36.32.3: RESYNC: (1.37-1.38); FILE MERGED 2006/08/03 17:23:07 aw 1.36.32.2: RESYNC: (1.36-1.37); FILE MERGED 2006/07/20 15:50:40 thb 1.36.32.1: #i66849# Join from CWS xralpha; OutDev::DrawTransparent() now uses drawAlphaRect(), if polygon is rectangular; fixed order of fast bail-out & outdev state modification in DrawTransparent; added DrawAlphaBitmap() mirror wrapper for xralpha join
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/glyphs/glyphcache.cxx44
1 files changed, 19 insertions, 25 deletions
diff --git a/vcl/source/glyphs/glyphcache.cxx b/vcl/source/glyphs/glyphcache.cxx
index 15a2435b2bba..a159edd489a7 100644
--- a/vcl/source/glyphs/glyphcache.cxx
+++ b/vcl/source/glyphs/glyphcache.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: glyphcache.cxx,v $
*
- * $Revision: 1.39 $
+ * $Revision: 1.40 $
*
- * last change: $Author: obo $ $Date: 2006-10-13 08:32:06 $
+ * last change: $Author: ihi $ $Date: 2006-11-14 15:23:47 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -54,14 +54,18 @@
// GlyphCache
// =======================================================================
-GlyphCache::GlyphCache( ULONG nMaxSize )
-: mnMaxSize(nMaxSize),
+static GlyphCache* pInstance = NULL;
+
+GlyphCache::GlyphCache( GlyphCachePeer& rPeer )
+: mrPeer( rPeer ),
+ mnMaxSize( 1500000 ),
mnBytesUsed(sizeof(GlyphCache)),
mnLruIndex(0),
mnGlyphCount(0),
mpCurrentGCFont(NULL),
mpFtManager(NULL)
{
+ pInstance = this;
mpFtManager = new FreetypeManager;
}
@@ -127,28 +131,18 @@ bool GlyphCache::IFSD_Equal::operator()( const ImplFontSelectData& rA, const Imp
GlyphCache& GlyphCache::GetInstance()
{
- static GlyphCache aGlyphCache( 1500000 );
- return aGlyphCache;
+ return *pInstance;
}
// -----------------------------------------------------------------------
-void GlyphCache::EnsureInstance( GlyphCachePeer& rPeer, bool bInitFonts )
+void GlyphCache::LoadFonts()
{
- GlyphCache& rGlyphCache = GetInstance();
- if( rGlyphCache.mpPeer == &rPeer )
- return;
-
- rGlyphCache.mpPeer = &rPeer;
-
- if( bInitFonts )
- {
- if( const char* pFontPath = ::getenv( "SAL_FONTPATH_PRIVATE" ) )
- rGlyphCache.AddFontPath( String::CreateFromAscii( pFontPath ) );
- const String& rFontPath = Application::GetFontPath();
- if( rFontPath.Len() > 0 )
- rGlyphCache.AddFontPath( rFontPath );
- }
+ if( const char* pFontPath = ::getenv( "SAL_FONTPATH_PRIVATE" ) )
+ AddFontPath( String::CreateFromAscii( pFontPath ) );
+ const String& rFontPath = Application::GetFontPath();
+ if( rFontPath.Len() > 0 )
+ AddFontPath( rFontPath );
}
// -----------------------------------------------------------------------
@@ -259,7 +253,7 @@ void GlyphCache::UncacheFont( ServerFont& rServerFont )
// The caching algorithm needs a non-const object
ServerFont* pFont = const_cast<ServerFont*>( &rServerFont );
if( (pFont->Release() <= 0)
- && (mnMaxSize <= (mnBytesUsed + mpPeer->GetByteCount())) )
+ && (mnMaxSize <= (mnBytesUsed + mrPeer.GetByteCount())) )
{
mpCurrentGCFont = pFont;
GarbageCollect();
@@ -318,7 +312,7 @@ void GlyphCache::GarbageCollect()
mpCurrentGCFont = NULL;
const ImplFontSelectData& rIFSD = pServerFont->GetFontSelData();
maFontList.erase( rIFSD );
- mpPeer->RemovingFont( *pServerFont );
+ mrPeer.RemovingFont( *pServerFont );
mnBytesUsed -= pServerFont->GetByteCount();
// remove font from list of garbage collected fonts
@@ -354,7 +348,7 @@ inline void GlyphCache::AddedGlyph( ServerFont& rServerFont, GlyphData& rGlyphDa
void GlyphCache::GrowNotify()
{
- if( (mnBytesUsed + mpPeer->GetByteCount()) > mnMaxSize )
+ if( (mnBytesUsed + mrPeer.GetByteCount()) > mnMaxSize )
GarbageCollect();
}
@@ -362,7 +356,7 @@ void GlyphCache::GrowNotify()
inline void GlyphCache::RemovingGlyph( ServerFont& rSF, GlyphData& rGD, int nGlyphIndex )
{
- mpPeer->RemovingGlyph( rSF, rGD, nGlyphIndex );
+ mrPeer.RemovingGlyph( rSF, rGD, nGlyphIndex );
mnBytesUsed -= sizeof( GlyphData );
--mnGlyphCount;
}