summaryrefslogtreecommitdiff
path: root/vcl/inc/impfontcache.hxx
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/impfontcache.hxx
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/impfontcache.hxx')
-rw-r--r--vcl/inc/impfontcache.hxx20
1 files changed, 4 insertions, 16 deletions
diff --git a/vcl/inc/impfontcache.hxx b/vcl/inc/impfontcache.hxx
index a99283fb300e..6cb05b39d9b3 100644
--- a/vcl/inc/impfontcache.hxx
+++ b/vcl/inc/impfontcache.hxx
@@ -33,36 +33,24 @@ class PhysicalFontCollection;
class ImplFontCache
{
- // For access to Acquire and Release
- friend class LogicalFontInstance;
-
private:
LogicalFontInstance* mpLastHitCacheEntry; ///< keeps the last hit cache entry
- int mnRef0Count; ///< number of unreferenced LogicalFontInstances
// cache of recently used font instances
struct IFSD_Equal { bool operator()( const FontSelectPattern&, const FontSelectPattern& ) const; };
struct IFSD_Hash { size_t operator()( const FontSelectPattern& ) const; };
- typedef std::unordered_map<FontSelectPattern,LogicalFontInstance*,IFSD_Hash,IFSD_Equal > FontInstanceList;
+ typedef std::unordered_map<FontSelectPattern, rtl::Reference<LogicalFontInstance>, IFSD_Hash, IFSD_Equal> FontInstanceList;
FontInstanceList maFontInstanceList;
- int CountUnreferencedEntries() const;
- bool IsFontInList(const LogicalFontInstance* pFont) const;
-
- /// Increase the refcount of the given LogicalFontInstance.
- void Acquire(LogicalFontInstance*);
- /// Decrease the refcount and potentially cleanup the entries with zero refcount from the cache.
- void Release(LogicalFontInstance*);
-
- LogicalFontInstance* GetFontInstance(PhysicalFontCollection const*, FontSelectPattern&);
+ rtl::Reference<LogicalFontInstance> GetFontInstance(PhysicalFontCollection const*, FontSelectPattern&);
public:
ImplFontCache();
~ImplFontCache();
- LogicalFontInstance* GetFontInstance( PhysicalFontCollection const *,
+ rtl::Reference<LogicalFontInstance> GetFontInstance( PhysicalFontCollection const *,
const vcl::Font&, const Size& rPixelSize, float fExactHeight);
- LogicalFontInstance* GetGlyphFallbackFont( PhysicalFontCollection const *, FontSelectPattern&,
+ rtl::Reference<LogicalFontInstance> GetGlyphFallbackFont( PhysicalFontCollection const *, FontSelectPattern&,
int nFallbackLevel, OUString& rMissingCodes );
void Invalidate();