sw/source/core/inc/fntcache.hxx | 2 ++ sw/source/core/txtnode/fntcache.cxx | 10 ++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-)
New commits: commit a514e402d67aee558346850ffb023e81f89224c2 Author: Luboš Luňák <l.lu...@collabora.com> AuthorDate: Mon Mar 14 23:47:04 2022 +0100 Commit: Luboš Luňák <l.lu...@collabora.com> CommitDate: Tue Mar 15 14:36:58 2022 +0100 use GetVclCache() in one more place in SwFntObj (tdf#116400) This is fine, the cache is the same as long as the substring is within the full string size. Change-Id: I9ad7cbe33db73219d16b3b907f2a9dff694d0923 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131566 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lu...@collabora.com> diff --git a/sw/source/core/inc/fntcache.hxx b/sw/source/core/inc/fntcache.hxx index 8d53b2fdaa72..9a38a68b63a1 100644 --- a/sw/source/core/inc/fntcache.hxx +++ b/sw/source/core/inc/fntcache.hxx @@ -111,6 +111,8 @@ class SwFntObj final : public SwCacheObj void GetTextArray(const OutputDevice& rOutputDevice, const OUString& rStr, std::vector<sal_Int32>& rDXAry, sal_Int32 nIndex, sal_Int32 nLen, bool bCaching, const vcl::text::TextLayoutCache* layoutCache = nullptr); + void GetTextArray(const OutputDevice& rOutputDevice, const SwDrawTextInfo& rInf, std::vector<sal_Int32>& rDXAry, + sal_Int32 nLen); void GetTextArray(const OutputDevice& rOutputDevice, const SwDrawTextInfo& rInf, std::vector<sal_Int32>& rDXAry); static tools::Long s_nPixWidth; diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx index 4403dbc5b074..e48c5e0e9953 100644 --- a/sw/source/core/txtnode/fntcache.cxx +++ b/sw/source/core/txtnode/fntcache.cxx @@ -869,6 +869,13 @@ void SwFntObj::GetTextArray(const OutputDevice& rOutputDevice, const SwDrawTextI return GetTextArray(rOutputDevice, rInf.GetText(), rDXAry, rInf.GetIdx().get(), rInf.GetLen().get(), true, rInf.GetVclCache()); } +void SwFntObj::GetTextArray(const OutputDevice& rOutputDevice, const SwDrawTextInfo& rInf, std::vector<sal_Int32>& rDXAry, sal_Int32 nLen) +{ + // Substring is fine. + assert( nLen <= rInf.GetLen().get()); + return GetTextArray(rOutputDevice, rInf.GetText(), rDXAry, rInf.GetIdx().get(), nLen, true, rInf.GetVclCache()); +} + void SwFntObj::DrawText( SwDrawTextInfo &rInf ) { OSL_ENSURE( rInf.GetShell(), "SwFntObj::DrawText without shell" ); @@ -1985,8 +1992,7 @@ Size SwFntObj::GetTextSize( SwDrawTextInfo& rInf ) rInf.GetOut().SetFont( *m_pPrtFont ); aTextSize.setHeight( rInf.GetOut().GetTextHeight() ); - GetTextArray(rInf.GetOut(), rInf.GetText(), aKernArray, - sal_Int32(rInf.GetIdx()), sal_Int32(nLn), true); + GetTextArray(rInf.GetOut(), rInf, aKernArray, nLn.get()); } if (bCompress)