include/vcl/glyphitemcache.hxx  |    1 -
 vcl/source/gdi/impglyphitem.cxx |   20 ++++++++------------
 2 files changed, 8 insertions(+), 13 deletions(-)

New commits:
commit 339fbb7bc30f227b9d4c9b9eea03b25f49533dee
Author:     Luboš Luňák <l.lu...@collabora.com>
AuthorDate: Mon Apr 11 12:46:21 2022 +0200
Commit:     Luboš Luňák <l.lu...@collabora.com>
CommitDate: Sun May 1 05:46:50 2022 +0200

    SalLayoutGlyphsCache no longer needs to hash OutputDevice pointer
    
    It seems now the cache key contains all the necessary info and
    results can be shared even between different OutputDevice instances,
    as long as they are "the same".
    
    Change-Id: I367322f469ab6713299f178a711a63065b245f9a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132902
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lu...@collabora.com>

diff --git a/include/vcl/glyphitemcache.hxx b/include/vcl/glyphitemcache.hxx
index ea6d9fca7ffb..a7a49ca7a8f2 100644
--- a/include/vcl/glyphitemcache.hxx
+++ b/include/vcl/glyphitemcache.hxx
@@ -69,7 +69,6 @@ private:
         sal_Int32 index;
         sal_Int32 len;
         tools::Long logicWidth;
-        VclPtr<const OutputDevice> outputDevice;
         vcl::Font font;
         double fontScaleX;
         double fontScaleY;
diff --git a/vcl/source/gdi/impglyphitem.cxx b/vcl/source/gdi/impglyphitem.cxx
index e66a5bad1a2d..0ae4e979e141 100644
--- a/vcl/source/gdi/impglyphitem.cxx
+++ b/vcl/source/gdi/impglyphitem.cxx
@@ -367,18 +367,15 @@ SalLayoutGlyphsCache::GetLayoutGlyphs(VclPtr<const 
OutputDevice> outputDevice, c
     return nullptr;
 }
 
-SalLayoutGlyphsCache::CachedGlyphsKey::CachedGlyphsKey(const VclPtr<const 
OutputDevice>& d,
-                                                       const OUString& t, 
sal_Int32 i, sal_Int32 l,
-                                                       tools::Long w)
+SalLayoutGlyphsCache::CachedGlyphsKey::CachedGlyphsKey(
+    const VclPtr<const OutputDevice>& outputDevice, const OUString& t, 
sal_Int32 i, sal_Int32 l,
+    tools::Long w)
     : text(t)
     , index(i)
     , len(l)
     , logicWidth(w)
-    , outputDevice(d)
     // we also need to save things used in 
OutputDevice::ImplPrepareLayoutArgs(), in case they
-    // change in the output device
-    // TODO there is still something missing, otherwise it wouldn't be 
necessary to compare
-    // also the OutputDevice pointers
+    // change in the output device, plus mapMode affects the sizes.
     , font(outputDevice->GetFont())
     // TODO It would be possible to get a better hit ratio if mapMode wasn't 
part of the key
     // and results that differ only in mapmode would have coordinates adjusted 
based on that.
@@ -397,7 +394,6 @@ 
SalLayoutGlyphsCache::CachedGlyphsKey::CachedGlyphsKey(const VclPtr<const Output
     o3tl::hash_combine(hashValue, index);
     o3tl::hash_combine(hashValue, len);
     o3tl::hash_combine(hashValue, logicWidth);
-
     o3tl::hash_combine(hashValue, outputDevice.get());
     // Need to use IgnoreColor, because sometimes the color changes, but it's 
irrelevant
     // for text layout (and also obsolete in vcl::Font).
@@ -415,10 +411,10 @@ 
SalLayoutGlyphsCache::CachedGlyphsKey::CachedGlyphsKey(const VclPtr<const Output
 inline bool SalLayoutGlyphsCache::CachedGlyphsKey::operator==(const 
CachedGlyphsKey& other) const
 {
     return hashValue == other.hashValue && index == other.index && len == 
other.len
-           && logicWidth == other.logicWidth && outputDevice == 
other.outputDevice
-           && mapMode == other.mapMode && rtl == other.rtl && layoutMode == 
other.layoutMode
-           && digitLanguage == other.digitLanguage && fontScaleX == 
other.fontScaleX
-           && fontScaleY == other.fontScaleY && 
font.EqualIgnoreColor(other.font)
+           && logicWidth == other.logicWidth && mapMode == other.mapMode && 
rtl == other.rtl
+           && layoutMode == other.layoutMode && digitLanguage == 
other.digitLanguage
+           && fontScaleX == other.fontScaleX && fontScaleY == other.fontScaleY
+           && font.EqualIgnoreColor(other.font)
            && vcl::text::FastStringCompareEqual()(text, other.text);
     // Slower things last in the comparison.
 }

Reply via email to