Changeset - r20816:4bee48500f37
[Not reviewed]
master
0 2 0
frosch - 11 years ago 2013-10-13 13:28:06
frosch@openttd.org
(svn r25860) -Fix [FS#5737] (r25570): When clearing font cache, also clear layout cache. (adf88)
2 files changed with 10 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/fontcache.cpp
Show inline comments
 
@@ -75,7 +75,7 @@ public:
 
	virtual SpriteID GetUnicodeGlyph(WChar key);
 
	virtual void SetUnicodeGlyph(WChar key, SpriteID sprite);
 
	virtual void InitializeUnicodeGlyphMap();
 
	virtual void ClearFontCache() {}
 
	virtual void ClearFontCache();
 
	virtual const Sprite *GetGlyph(GlyphID key);
 
	virtual uint GetGlyphWidth(GlyphID key);
 
	virtual bool GetDrawGlyphShadow();
 
@@ -162,6 +162,11 @@ void SpriteFontCache::ClearGlyphToSprite
 
	this->glyph_to_spriteid_map = NULL;
 
}
 

	
 
void SpriteFontCache::ClearFontCache()
 
{
 
	Layouter::ResetFontCache(this->fs);
 
}
 

	
 
const Sprite *SpriteFontCache::GetGlyph(GlyphID key)
 
{
 
	SpriteID sprite = this->GetUnicodeGlyph(key);
 
@@ -392,6 +397,8 @@ void FreeTypeFontCache::ClearFontCache()
 

	
 
	free(this->glyph_to_sprite);
 
	this->glyph_to_sprite = NULL;
 

	
 
	Layouter::ResetFontCache(this->fs);
 
}
 

	
 
FreeTypeFontCache::GlyphEntry *FreeTypeFontCache::GetGlyphPtr(GlyphID key)
src/fontcache.h
Show inline comments
 
@@ -159,7 +159,8 @@ static inline void InitializeUnicodeGlyp
 
	}
 
}
 

	
 
static inline void ClearFontCache() {
 
static inline void ClearFontCache()
 
{
 
	for (FontSize fs = FS_BEGIN; fs < FS_END; fs++) {
 
		FontCache::Get(fs)->ClearFontCache();
 
	}
0 comments (0 inline, 0 general)