sw/source/core/inc/fntcache.hxx     |   10 ++--------
 sw/source/core/txtnode/fntcache.cxx |   28 ++++++----------------------
 2 files changed, 8 insertions(+), 30 deletions(-)

New commits:
commit 172ba8b3d44c092435d690db7d4ca9090a114127
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Tue Jan 18 15:02:55 2022 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Sat Mar 12 20:34:05 2022 +0100

    remove newly unused code
    
    Change-Id: I371fd1242070fe19e408277e008d8627fd8b28d4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128567
    Tested-by: Caolán McNamara <caol...@redhat.com>
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sw/source/core/inc/fntcache.hxx b/sw/source/core/inc/fntcache.hxx
index a377a483cdde..ed97037c251f 100644
--- a/sw/source/core/inc/fntcache.hxx
+++ b/sw/source/core/inc/fntcache.hxx
@@ -80,14 +80,9 @@ struct SwTextGlyphsKeyHash
     size_t operator()(SwTextGlyphsKey const & rKey) const { return 
rKey.mnHashCode; }
 };
 /**
- * Glyphs and text width for the given SwTextGlyphsKey.
+ * Glyphs for the given SwTextGlyphsKey.
  */
-struct SwTextGlyphsData
-{
-    SalLayoutGlyphs m_aTextGlyphs;
-    tools::Long m_nTextWidth = -1; // -1 = not computed yet
-};
-typedef std::unordered_map<SwTextGlyphsKey, SwTextGlyphsData, 
SwTextGlyphsKeyHash> SwTextGlyphsMap;
+typedef std::unordered_map<SwTextGlyphsKey, SalLayoutGlyphs, 
SwTextGlyphsKeyHash> SwTextGlyphsMap;
 
 class SwFntObj final : public SwCacheObj
 {
@@ -145,7 +140,6 @@ public:
     sal_uInt16   GetPropWidth() const { return m_nPropWidth; }
     bool     IsSymbol() const { return m_bSymbol; }
 
-    tools::Long GetCachedTextWidth(const SwTextGlyphsKey& key, const 
vcl::text::TextLayoutCache* vclCache);
     SalLayoutGlyphs* GetCachedSalLayoutGlyphs(const SwTextGlyphsKey& key);
     void ClearCachedTextGlyphs();
 
diff --git a/sw/source/core/txtnode/fntcache.cxx 
b/sw/source/core/txtnode/fntcache.cxx
index 6082d978194a..2bdd00124dd4 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -203,7 +203,7 @@ const SalLayoutFlags eGlyphItemsOnlyLayout = 
SalLayoutFlags::GlyphItemsOnly | Sa
  */
 static SalLayoutGlyphs* lcl_CreateLayout(const SwTextGlyphsKey& rKey, 
SwTextGlyphsMap::iterator it)
 {
-    assert (!it->second.m_aTextGlyphs.IsValid());
+    assert (!it->second.IsValid());
 
     if (rKey.m_nIndex >= rKey.m_aText.getLength())
         // Same as in OutputDevice::GetTextArray().
@@ -217,9 +217,9 @@ static SalLayoutGlyphs* lcl_CreateLayout(const 
SwTextGlyphsKey& rKey, SwTextGlyp
         return nullptr;
 
     // Remember the calculation result.
-    it->second.m_aTextGlyphs = pLayout->GetGlyphs();
+    it->second = pLayout->GetGlyphs();
 
-    return &it->second.m_aTextGlyphs;
+    return &it->second;
 }
 
 SalLayoutGlyphs* SwFntObj::GetCachedSalLayoutGlyphs(const SwTextGlyphsKey& key)
@@ -227,33 +227,17 @@ SalLayoutGlyphs* SwFntObj::GetCachedSalLayoutGlyphs(const 
SwTextGlyphsKey& key)
     SwTextGlyphsMap::iterator it = m_aTextGlyphs.find(key);
     if(it != m_aTextGlyphs.end())
     {
-        if( it->second.m_aTextGlyphs.IsValid())
-            return &it->second.m_aTextGlyphs;
+        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;
     }
-    it = m_aTextGlyphs.insert_or_assign( it, key, SwTextGlyphsData());
+    it = m_aTextGlyphs.insert_or_assign( it, key, SalLayoutGlyphs());
     return lcl_CreateLayout(key, it);
 }
 
-tools::Long SwFntObj::GetCachedTextWidth(const SwTextGlyphsKey& key, const 
vcl::text::TextLayoutCache* vclCache)
-{
-    SwTextGlyphsMap::iterator it = m_aTextGlyphs.find(key);
-    if(it != m_aTextGlyphs.end() && it->second.m_nTextWidth >= 0)
-        return it->second.m_nTextWidth;
-    if(it == m_aTextGlyphs.end())
-    {
-        it = m_aTextGlyphs.insert_or_assign( it, key, SwTextGlyphsData());
-        lcl_CreateLayout(key, it);
-    }
-    it->second.m_nTextWidth = key.m_pOutputDevice->GetTextWidth(key.m_aText, 
key.m_nIndex, key.m_nLength, vclCache,
-        it->second.m_aTextGlyphs.IsValid() ? &it->second.m_aTextGlyphs : 
nullptr );
-    assert(it->second.m_nTextWidth >= 0);
-    return it->second.m_nTextWidth;
-}
-
 void SwFntObj::ClearCachedTextGlyphs()
 {
     m_aTextGlyphs.clear();

Reply via email to