summaryrefslogtreecommitdiff
path: root/vcl/inc/unx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-06-05 14:16:23 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-06-08 22:29:50 +0200
commitc4c56de1b0e62ec866b519b2b24c5e805f0a86d3 (patch)
treea8a5b3c67b72804a27fd2f1aea39451691a3fa0c /vcl/inc/unx
parentd865866ec5cf6966757c9f2abd24b18a39f2f924 (diff)
hold LogicalFontInstance with rtl::Reference
instead of manual reference counting. Also the releasing of not-currently-in-use LogicalFontInstance objects from the cache is made less aggressive - we now only flush entries until we have less than CACHE_SIZE instances, instead of flushing the whole cache. Change-Id: Ib235b132776b5f09ae8ae93a933c2eebe5fa9610 Reviewed-on: https://gerrit.libreoffice.org/55384 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl/inc/unx')
-rw-r--r--vcl/inc/unx/freetype_glyphcache.hxx4
-rw-r--r--vcl/inc/unx/glyphcache.hxx5
2 files changed, 5 insertions, 4 deletions
diff --git a/vcl/inc/unx/freetype_glyphcache.hxx b/vcl/inc/unx/freetype_glyphcache.hxx
index d6b87b7ab7a9..bf00935b15a1 100644
--- a/vcl/inc/unx/freetype_glyphcache.hxx
+++ b/vcl/inc/unx/freetype_glyphcache.hxx
@@ -114,7 +114,7 @@ private:
public:
FreetypeFontFace( FreetypeFontInfo*, const FontAttributes& );
- virtual LogicalFontInstance* CreateFontInstance( const FontSelectPattern& ) const override;
+ virtual rtl::Reference<LogicalFontInstance> CreateFontInstance( const FontSelectPattern& ) const override;
virtual rtl::Reference<PhysicalFontFace> Clone() const override { return new FreetypeFontFace( *this ); }
virtual sal_IntPtr GetFontId() const override { return mpFreetypeFontInfo->GetFontId(); }
};
@@ -122,7 +122,7 @@ public:
// a class for cache entries for physical font instances that are based on serverfonts
class VCL_DLLPUBLIC FreetypeFontInstance : public LogicalFontInstance
{
- friend LogicalFontInstance* FreetypeFontFace::CreateFontInstance(const FontSelectPattern&) const;
+ friend rtl::Reference<LogicalFontInstance> FreetypeFontFace::CreateFontInstance(const FontSelectPattern&) const;
FreetypeFont* mpFreetypeFont;
diff --git a/vcl/inc/unx/glyphcache.hxx b/vcl/inc/unx/glyphcache.hxx
index 5e515db564b5..50d1f071d44f 100644
--- a/vcl/inc/unx/glyphcache.hxx
+++ b/vcl/inc/unx/glyphcache.hxx
@@ -39,6 +39,7 @@
#include <unordered_map>
class FreetypeManager;
+class FreetypeFontInstance;
class FreetypeFontInfo;
class GlyphData;
class FontConfigFontOptions;
@@ -139,7 +140,7 @@ public:
bool GetGlyphOutline(const GlyphItem& rGlyph, basegfx::B2DPolyPolygon&) const;
bool GetAntialiasAdvice() const;
- LogicalFontInstance* GetFontInstance() const { return mpFontInstance; }
+ FreetypeFontInstance* GetFontInstance() const { return mpFontInstance.get(); }
private:
friend class GlyphCache;
@@ -161,7 +162,7 @@ private:
typedef std::unordered_map<int,GlyphData> GlyphList;
mutable GlyphList maGlyphList;
- LogicalFontInstance* const mpFontInstance;
+ rtl::Reference<FreetypeFontInstance> mpFontInstance;
// used by GlyphCache for cache LRU algorithm
mutable long mnRefCount;