Kaydet (Commit) ac39aba9 authored tarafından Jan-Marek Glogowski's avatar Jan-Marek Glogowski Kaydeden (comit) Noel Grandin

tdf#120204 drop simple glyph cache

Master has a new shared LRU glyph cache, but that is much more
new code. So simply drop the current cache implementation.

Change-Id: Ib73f3680f3d6357b1c9d2b07db521867b3742843
Reviewed-on: https://gerrit.libreoffice.org/61961
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 67c65aa2
...@@ -58,11 +58,6 @@ ...@@ -58,11 +58,6 @@
using namespace vcl; using namespace vcl;
// GetGlyphOutlineW() seems to be a little slow, and doesn't seem to do its own caching (tested on Windows10).
// TODO include the font as part of the cache key, then we won't need to clear it on font change
// The cache limit is set by the rough number of characters needed to read your average Asian newspaper.
static o3tl::lru_map<sal_GlyphId, tools::Rectangle> g_BoundRectCache(3000);
static const int MAXFONTHEIGHT = 2048; static const int MAXFONTHEIGHT = 2048;
inline FIXED FixedFromDouble( double d ) inline FIXED FixedFromDouble( double d )
...@@ -853,8 +848,6 @@ HFONT WinSalGraphics::ImplDoSetFont(FontSelectPattern const * i_pFont, ...@@ -853,8 +848,6 @@ HFONT WinSalGraphics::ImplDoSetFont(FontSelectPattern const * i_pFont,
float& o_rFontScale, float& o_rFontScale,
HFONT& o_rOldFont) HFONT& o_rOldFont)
{ {
// clear the cache on font change
g_BoundRectCache.clear();
HFONT hNewFont = nullptr; HFONT hNewFont = nullptr;
LOGFONTW aLogFont; LOGFONTW aLogFont;
...@@ -1387,13 +1380,6 @@ void WinSalGraphics::ClearDevFontCache() ...@@ -1387,13 +1380,6 @@ void WinSalGraphics::ClearDevFontCache()
bool WinSalGraphics::GetGlyphBoundRect(const GlyphItem& rGlyph, tools::Rectangle& rRect) bool WinSalGraphics::GetGlyphBoundRect(const GlyphItem& rGlyph, tools::Rectangle& rRect)
{ {
auto it = g_BoundRectCache.find(rGlyph.maGlyphId);
if (it != g_BoundRectCache.end())
{
rRect = it->second;
return true;
}
WinFontInstance* pFont = mpWinFontEntry[rGlyph.mnFallbackLevel]; WinFontInstance* pFont = mpWinFontEntry[rGlyph.mnFallbackLevel];
HFONT hNewFont = pFont ? pFont->GetHFONT() : mhFonts[rGlyph.mnFallbackLevel]; HFONT hNewFont = pFont ? pFont->GetHFONT() : mhFonts[rGlyph.mnFallbackLevel];
float fFontScale = pFont ? pFont->GetScale() : mfFontScale[rGlyph.mnFallbackLevel]; float fFontScale = pFont ? pFont->GetScale() : mfFontScale[rGlyph.mnFallbackLevel];
...@@ -1427,8 +1413,6 @@ bool WinSalGraphics::GetGlyphBoundRect(const GlyphItem& rGlyph, tools::Rectangle ...@@ -1427,8 +1413,6 @@ bool WinSalGraphics::GetGlyphBoundRect(const GlyphItem& rGlyph, tools::Rectangle
rRect.SetTop(static_cast<int>( fFontScale * rRect.Top() )); rRect.SetTop(static_cast<int>( fFontScale * rRect.Top() ));
rRect.SetBottom(static_cast<int>( fFontScale * rRect.Bottom() ) + 1); rRect.SetBottom(static_cast<int>( fFontScale * rRect.Bottom() ) + 1);
g_BoundRectCache.insert({rGlyph.maGlyphId, rRect});
return true; return true;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment