diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2018-09-07 10:43:10 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2018-09-07 16:02:49 +0200 |
commit | 2a73c9e04ba9379c0561a7e8d531b5633c46ec52 (patch) | |
tree | f20c1d7e42bd1117c86c17b620cc90ff7f2f0f7f | |
parent | 2aaf5a73dac9f1dc137fba1e5f8536ef9f67ed89 (diff) |
sw: less vcl text layout calls in SwFont::GetTextBreak()
Number of GenericSalLayout::LayoutText() calls during "dt<F3>" in Writer: 105
-> 89.
Change-Id: I0f2bb241536209cfccc1d78bed6f54bf5c31e627
Reviewed-on: https://gerrit.libreoffice.org/60133
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins
-rw-r--r-- | include/vcl/outdev.hxx | 3 | ||||
-rw-r--r-- | sw/source/core/inc/fntcache.hxx | 1 | ||||
-rw-r--r-- | sw/source/core/txtnode/fntcache.cxx | 9 | ||||
-rw-r--r-- | vcl/source/outdev/text.cxx | 5 |
4 files changed, 14 insertions, 4 deletions
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index 1aa842b46cd5..f015f52488d8 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -1174,7 +1174,8 @@ public: sal_Int32 GetTextBreak( const OUString& rStr, long nTextWidth, sal_Int32 nIndex, sal_Int32 nLen = -1, long nCharExtra = 0, - vcl::TextLayoutCache const* = nullptr) const; + vcl::TextLayoutCache const* = nullptr, + const SalLayoutGlyphs* pGlyphs = nullptr) const; sal_Int32 GetTextBreak( const OUString& rStr, long nTextWidth, sal_Unicode nExtraChar, sal_Int32& rExtraCharPos, sal_Int32 nIndex, sal_Int32 nLen, diff --git a/sw/source/core/inc/fntcache.hxx b/sw/source/core/inc/fntcache.hxx index ee8a1d2971f7..a7400f03d0d1 100644 --- a/sw/source/core/inc/fntcache.hxx +++ b/sw/source/core/inc/fntcache.hxx @@ -122,6 +122,7 @@ public: sal_uInt16 GetZoom() const { return m_nZoom; } sal_uInt16 GetPropWidth() const { return m_nPropWidth; } bool IsSymbol() const { return m_bSymbol; } + std::map<SwTextGlyphsKey, SalLayoutGlyphs>& GetTextGlyphs() { return m_aTextGlyphs; } void DrawText( SwDrawTextInfo &rInf ); /// determine the TextSize (of the printer) diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx index e893e43d1f8e..5f294fe6c7ca 100644 --- a/sw/source/core/txtnode/fntcache.cxx +++ b/sw/source/core/txtnode/fntcache.cxx @@ -2483,10 +2483,17 @@ TextFrameIndex SwFont::GetTextBreak(SwDrawTextInfo const & rInf, long nTextWidth *rInf.GetHyphPos() = TextFrameIndex((nHyphPos == -1) ? COMPLETE_STRING : nHyphPos); } else + { + SwFntAccess aFntAccess(m_aSub[m_nActual].m_nFontCacheId, m_aSub[m_nActual].m_nFontIndex, + &m_aSub[m_nActual], rInf.GetShell()); + SwTextGlyphsKey aGlyphsKey{ &rInf.GetOut(), *pTmpText, nTmpIdx, nTmpLen }; + SalLayoutGlyphs* pGlyphs + = lcl_CreateLayout(aGlyphsKey, aFntAccess.Get()->GetTextGlyphs()[aGlyphsKey]); nTextBreak = TextFrameIndex(rInf.GetOut().GetTextBreak( *pTmpText, nTextWidth, sal_Int32(nTmpIdx), sal_Int32(nTmpLen), - nKern, rInf.GetVclCache())); + nKern, rInf.GetVclCache(), pGlyphs)); + } if (bTextReplaced && sal_Int32(nTextBreak) != -1) { diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx index 820df543bc5d..b0243b3395a6 100644 --- a/vcl/source/outdev/text.cxx +++ b/vcl/source/outdev/text.cxx @@ -1394,10 +1394,11 @@ bool OutputDevice::GetTextIsRTL( const OUString& rString, sal_Int32 nIndex, sal_ sal_Int32 OutputDevice::GetTextBreak( const OUString& rStr, long nTextWidth, sal_Int32 nIndex, sal_Int32 nLen, long nCharExtra, - vcl::TextLayoutCache const*const pLayoutCache) const + vcl::TextLayoutCache const*const pLayoutCache, + const SalLayoutGlyphs* pGlyphs) const { std::unique_ptr<SalLayout> pSalLayout = ImplLayout( rStr, nIndex, nLen, - Point(0,0), 0, nullptr, SalLayoutFlags::NONE, pLayoutCache); + Point(0,0), 0, nullptr, SalLayoutFlags::NONE, pLayoutCache, pGlyphs); sal_Int32 nRetVal = -1; if( pSalLayout ) { |