diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2018-10-04 13:25:06 +0000 |
---|---|---|
committer | Jan-Marek Glogowski <glogow@fbihome.de> | 2018-10-06 20:13:28 +0200 |
commit | dd36db168c658ebe588396255ad61363cc4ea7af (patch) | |
tree | eb69c3c23b1ff05474ba075514d037ffe96f4bd4 /vcl/inc | |
parent | 2f182faaf08542e381a1aee4544b47c4cd7c0b92 (diff) |
UNX use font cache based glyph rect cache
Drop the special / duplicate glyph rect bound cache implementation
for Freetype fonts. The GlyphCache class now looks a lot like the
ImplFontCache class.
The lru handling for Freetype fonts is based on the byte / memory
size, including the glyth bound-rect caching. Using the new common
cache is effectivly removing the bound-rects from this accounting,
so the garbage collection won't free them anymore.
Change-Id: Ie53226596ee2287e1059a74885f52c3d64bbccaa
Reviewed-on: https://gerrit.libreoffice.org/61377
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'vcl/inc')
-rw-r--r-- | vcl/inc/unx/glyphcache.hxx | 35 |
1 files changed, 1 insertions, 34 deletions
diff --git a/vcl/inc/unx/glyphcache.hxx b/vcl/inc/unx/glyphcache.hxx index 446acc2944af..9fe3bd3dc7cf 100644 --- a/vcl/inc/unx/glyphcache.hxx +++ b/vcl/inc/unx/glyphcache.hxx @@ -41,7 +41,6 @@ class FreetypeFont; class FreetypeFontInstance; class FreetypeFontInfo; -class GlyphData; class FontConfigFontOptions; class PhysicalFontCollection; class FreetypeFont; @@ -71,13 +70,6 @@ public: void ClearFontOptions(); private: - friend class FreetypeFont; - // used by FreetypeFont class only - void AddedGlyph( GlyphData& ); - void RemovingGlyph(); - void UsingGlyph( GlyphData const & ); - -private: void InitFreetype(); void GarbageCollect(); FreetypeFont* CreateFont(LogicalFontInstance* pLogicalFont); @@ -92,32 +84,12 @@ private: FontList maFontList; static constexpr sal_uLong gnMaxSize = 1500000; // max overall cache size in bytes mutable sal_uLong mnBytesUsed; - mutable long mnLruIndex; - mutable int mnGlyphCount; FreetypeFont* mpCurrentGCFont; FontInfoList m_aFontInfoList; sal_IntPtr m_nMaxFontId; }; -class GlyphData -{ -public: - GlyphData() : mnLruValue(0) {} - - const tools::Rectangle& GetBoundRect() const { return maBoundRect; } - void SetBoundRect(tools::Rectangle r) { maBoundRect = r; } - - void SetLruValue( int n ) const { mnLruValue = n; } - long GetLruValue() const { return mnLruValue;} - -private: - tools::Rectangle maBoundRect; - - // used by GlyphCache for cache LRU algorithm - mutable long mnLruValue; -}; - class VCL_DLLPUBLIC FreetypeFont final { public: @@ -139,7 +111,7 @@ public: const FontCharMapRef GetFontCharMap() const; bool GetFontCapabilities(vcl::FontCapabilities &) const; - const tools::Rectangle& GetGlyphBoundRect(const GlyphItem& rGlyph); + bool GetGlyphBoundRect(const GlyphItem&, tools::Rectangle&); bool GetGlyphOutline(const GlyphItem& rGlyph, basegfx::B2DPolyPolygon&) const; bool GetAntialiasAdvice() const; @@ -156,15 +128,10 @@ private: long Release() const; sal_uLong GetByteCount() const { return mnBytesUsed; } - void InitGlyphData(const GlyphItem&, GlyphData&) const; - void GarbageCollect( long ); void ReleaseFromGarbageCollect(); void ApplyGlyphTransform(bool bVertical, FT_Glyph) const; - typedef std::unordered_map<sal_GlyphId, GlyphData> GlyphList; - mutable GlyphList maGlyphList; - rtl::Reference<FreetypeFontInstance> mpFontInstance; // used by GlyphCache for cache LRU algorithm |