summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2022-05-01 19:14:50 +0200
committerLuboš Luňák <l.lunak@collabora.com>2022-05-02 15:06:26 +0200
commit8e6ab6502278702499e7468404d1010069176578 (patch)
tree678b55b91894c5b57728f84ba3da9794fd7f8b43 /include
parentbc7ea0a75911a782c0008be64508cbf3e0d74cc3 (diff)
better cache size limit for SalLayoutGlyphsCache
With just limit on the number of cached SalLayoutGlyphs instances the actual memory used could vary wildly depending on how long the text is. Change-Id: Ibcf6918e562e81276d21876c532838996e275bd6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133673 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'include')
-rw-r--r--include/vcl/glyphitemcache.hxx8
1 files changed, 7 insertions, 1 deletions
diff --git a/include/vcl/glyphitemcache.hxx b/include/vcl/glyphitemcache.hxx
index a7a49ca7a8f2..998dcf97f915 100644
--- a/include/vcl/glyphitemcache.hxx
+++ b/include/vcl/glyphitemcache.hxx
@@ -85,7 +85,13 @@ private:
{
size_t operator()(const CachedGlyphsKey& key) const { return key.hashValue; }
};
- typedef o3tl::lru_map<CachedGlyphsKey, SalLayoutGlyphs, CachedGlyphsHash> GlyphsCache;
+ struct GlyphsCost
+ {
+ size_t operator()(const SalLayoutGlyphs&) const;
+ };
+ typedef o3tl::lru_map<CachedGlyphsKey, SalLayoutGlyphs, CachedGlyphsHash,
+ std::equal_to<CachedGlyphsKey>, GlyphsCost>
+ GlyphsCache;
GlyphsCache mCachedGlyphs;
// Last temporary glyphs returned (pointer is returned, so the object needs to be kept somewhere).
std::optional<CachedGlyphsKey> mLastTemporaryKey;