include/vcl/glyphitemcache.hxx | 9 +++------ vcl/source/gdi/impglyphitem.cxx | 17 ++++++----------- vcl/source/gdi/pdfwriter_impl.cxx | 6 +++--- 3 files changed, 12 insertions(+), 20 deletions(-)
New commits: commit 53fe4a26c7c4691fcf9d07d022adfd45247d176b Author: Luboš Luňák <l.lu...@collabora.com> AuthorDate: Thu Apr 7 12:25:09 2022 +0200 Commit: Luboš Luňák <l.lu...@collabora.com> CommitDate: Fri Apr 8 21:28:58 2022 +0200 ignore Point logicalPos argument in SalLayoutGlyphsCache It's only used for the DXArray argument in ImplLayout(), so if we ignore that one when caching, the position can be ignored too. Change-Id: Id2a7b452e2b75139177c1e73c48eaa466742a59c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132672 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 64a1a64186ee..fca8e9f12575 100644 --- a/include/vcl/glyphitemcache.hxx +++ b/include/vcl/glyphitemcache.hxx @@ -48,13 +48,11 @@ public: GetLayoutGlyphs(VclPtr<const OutputDevice> outputDevice, const OUString& text, const vcl::text::TextLayoutCache* layoutCache = nullptr) const { - return GetLayoutGlyphs(outputDevice, text, 0, text.getLength(), Point(0, 0), 0, - layoutCache); + return GetLayoutGlyphs(outputDevice, text, 0, text.getLength(), 0, layoutCache); } const SalLayoutGlyphs* GetLayoutGlyphs(VclPtr<const OutputDevice> outputDevice, const OUString& text, sal_Int32 nIndex, - sal_Int32 nLen, const Point& rLogicPos = Point(0, 0), - tools::Long nLogicWidth = 0, + sal_Int32 nLen, tools::Long nLogicWidth = 0, const vcl::text::TextLayoutCache* layoutCache = nullptr) const; void clear() { mCachedGlyphs.clear(); } @@ -64,7 +62,6 @@ private: OUString text; sal_Int32 index; sal_Int32 len; - Point logicPos; tools::Long logicWidth; VclPtr<const OutputDevice> outputDevice; vcl::Font font; @@ -73,7 +70,7 @@ private: LanguageType digitLanguage; size_t hashValue; CachedGlyphsKey(const VclPtr<const OutputDevice>& dev, const OUString& t, sal_Int32 i, - sal_Int32 l, const Point& p, tools::Long w); + sal_Int32 l, tools::Long w); bool operator==(const CachedGlyphsKey& other) const; }; struct CachedGlyphsHash diff --git a/vcl/source/gdi/impglyphitem.cxx b/vcl/source/gdi/impglyphitem.cxx index ea3c490b0ba2..01654cfddcbc 100644 --- a/vcl/source/gdi/impglyphitem.cxx +++ b/vcl/source/gdi/impglyphitem.cxx @@ -97,13 +97,12 @@ bool SalLayoutGlyphsImpl::IsValid() const const SalLayoutGlyphs* SalLayoutGlyphsCache::GetLayoutGlyphs(VclPtr<const OutputDevice> outputDevice, const OUString& text, - sal_Int32 nIndex, sal_Int32 nLen, const Point& rLogicPos, - tools::Long nLogicWidth, + sal_Int32 nIndex, sal_Int32 nLen, tools::Long nLogicWidth, const vcl::text::TextLayoutCache* layoutCache) const { if (nLen == 0) return nullptr; - const CachedGlyphsKey key(outputDevice, text, nIndex, nLen, rLogicPos, nLogicWidth); + const CachedGlyphsKey key(outputDevice, text, nIndex, nLen, nLogicWidth); auto it = mCachedGlyphs.find(key); if (it != mCachedGlyphs.end()) { @@ -121,7 +120,7 @@ SalLayoutGlyphsCache::GetLayoutGlyphs(VclPtr<const OutputDevice> outputDevice, c layoutCache = tmpLayoutCache.get(); } std::unique_ptr<SalLayout> layout - = outputDevice->ImplLayout(text, nIndex, nLen, rLogicPos, nLogicWidth, {}, + = outputDevice->ImplLayout(text, nIndex, nLen, Point(0, 0), nLogicWidth, {}, SalLayoutFlags::GlyphItemsOnly, layoutCache); if (layout) { @@ -134,11 +133,10 @@ SalLayoutGlyphsCache::GetLayoutGlyphs(VclPtr<const OutputDevice> outputDevice, c SalLayoutGlyphsCache::CachedGlyphsKey::CachedGlyphsKey(const VclPtr<const OutputDevice>& d, const OUString& t, sal_Int32 i, sal_Int32 l, - const Point& p, tools::Long w) + tools::Long w) : text(t) , index(i) , len(l) - , logicPos(p) , logicWidth(w) , outputDevice(d) // we also need to save things used in OutputDevice::ImplPrepareLayoutArgs(), in case they @@ -154,8 +152,6 @@ SalLayoutGlyphsCache::CachedGlyphsKey::CachedGlyphsKey(const VclPtr<const Output o3tl::hash_combine(hashValue, vcl::text::FirstCharsStringHash()(text)); o3tl::hash_combine(hashValue, index); o3tl::hash_combine(hashValue, len); - o3tl::hash_combine(hashValue, logicPos.X()); - o3tl::hash_combine(hashValue, logicPos.Y()); o3tl::hash_combine(hashValue, logicWidth); o3tl::hash_combine(hashValue, outputDevice.get()); @@ -170,9 +166,8 @@ 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 - && logicPos == other.logicPos && logicWidth == other.logicWidth - && outputDevice == other.outputDevice && rtl == other.rtl - && layoutMode == other.layoutMode + && logicWidth == other.logicWidth && outputDevice == other.outputDevice + && rtl == other.rtl && layoutMode == other.layoutMode && digitLanguage == other.digitLanguage // slower things here && font == other.font && vcl::text::FastStringCompareEqual()(text, other.text); diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 65a0827ad68d..1853fe544eeb 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -6499,7 +6499,7 @@ void PDFWriterImpl::drawText( const Point& rPos, const OUString& rText, sal_Int3 // get a layout from the OutputDevice's SalGraphics // this also enforces font substitution and sets the font on SalGraphics - const SalLayoutGlyphs* layoutGlyphs = m_layoutGlyphsCache.GetLayoutGlyphs( this, rText, nIndex, nLen, rPos ); + const SalLayoutGlyphs* layoutGlyphs = m_layoutGlyphsCache.GetLayoutGlyphs( this, rText, nIndex, nLen ); std::unique_ptr<SalLayout> pLayout = ImplLayout( rText, nIndex, nLen, rPos, 0, {}, SalLayoutFlags::NONE, nullptr, layoutGlyphs ); if( pLayout ) @@ -6516,7 +6516,7 @@ void PDFWriterImpl::drawTextArray( const Point& rPos, const OUString& rText, o3t // get a layout from the OutputDevice's SalGraphics // this also enforces font substitution and sets the font on SalGraphics - const SalLayoutGlyphs* layoutGlyphs = m_layoutGlyphsCache.GetLayoutGlyphs( this, rText, nIndex, nLen, rPos, 0 ); + const SalLayoutGlyphs* layoutGlyphs = m_layoutGlyphsCache.GetLayoutGlyphs( this, rText, nIndex, nLen ); std::unique_ptr<SalLayout> pLayout = ImplLayout( rText, nIndex, nLen, rPos, 0, pDXArray, SalLayoutFlags::NONE, nullptr, layoutGlyphs ); if( pLayout ) @@ -6533,7 +6533,7 @@ void PDFWriterImpl::drawStretchText( const Point& rPos, sal_uLong nWidth, const // get a layout from the OutputDevice's SalGraphics // this also enforces font substitution and sets the font on SalGraphics - const SalLayoutGlyphs* layoutGlyphs = m_layoutGlyphsCache.GetLayoutGlyphs( this, rText, nIndex, nLen, rPos, nWidth ); + const SalLayoutGlyphs* layoutGlyphs = m_layoutGlyphsCache.GetLayoutGlyphs( this, rText, nIndex, nLen, nWidth ); std::unique_ptr<SalLayout> pLayout = ImplLayout( rText, nIndex, nLen, rPos, nWidth, {}, SalLayoutFlags::NONE, nullptr, layoutGlyphs ); if( pLayout )