summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2022-03-11 17:48:41 +0100
committerLuboš Luňák <l.lunak@collabora.com>2022-03-14 08:38:09 +0100
commit89fb3f7e87fd7ab9312bc43dffea842ffc34b140 (patch)
tree146045063a63cfd349089c6989a1cb413794d385 /vcl
parent3e3ef58be1c27e0ac32b0b5694f673f603d23224 (diff)
cache also failures in SalLayoutGlyphsCache
This is what 3f69ec9ab4236de13d229f675943123aeb42ea29 did in Writer. Change-Id: I40fb49ce83fd24f16050318c523d87603300b06d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131392 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/gdi/impglyphitem.cxx11
1 files changed, 9 insertions, 2 deletions
diff --git a/vcl/source/gdi/impglyphitem.cxx b/vcl/source/gdi/impglyphitem.cxx
index 0d8c2241a21e..1fefe68994d2 100644
--- a/vcl/source/gdi/impglyphitem.cxx
+++ b/vcl/source/gdi/impglyphitem.cxx
@@ -99,8 +99,15 @@ SalLayoutGlyphsCache::GetLayoutGlyphs(const OUString& text, VclPtr<OutputDevice>
{
const CachedGlyphsKey key(text, outputDevice);
auto it = mCachedGlyphs.find(key);
- if (it != mCachedGlyphs.end() && it->second.IsValid())
- return &it->second;
+ if (it != mCachedGlyphs.end())
+ {
+ if (it->second.IsValid())
+ return &it->second;
+ // Do not try to create the layout here. If a cache item exists, it's already
+ // been attempted and the layout was invalid (this happens with MultiSalLayout).
+ // So in that case this is a cached failure.
+ return nullptr;
+ }
std::unique_ptr<SalLayout> layout = outputDevice->ImplLayout(
text, 0, text.getLength(), Point(0, 0), 0, {}, SalLayoutFlags::GlyphItemsOnly);
if (layout)