[Libreoffice-commits] core.git: include/vcl sw/source vcl/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Sep 7 14:03:16 UTC 2018


 include/vcl/outdev.hxx              |    3 ++-
 sw/source/core/inc/fntcache.hxx     |    1 +
 sw/source/core/txtnode/fntcache.cxx |    9 ++++++++-
 vcl/source/outdev/text.cxx          |    5 +++--
 4 files changed, 14 insertions(+), 4 deletions(-)

New commits:
commit 2a73c9e04ba9379c0561a7e8d531b5633c46ec52
Author:     Miklos Vajna <vmiklos at collabora.co.uk>
AuthorDate: Fri Sep 7 10:43:10 2018 +0200
Commit:     Miklos Vajna <vmiklos at collabora.co.uk>
CommitDate: Fri Sep 7 16:02:49 2018 +0200

    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 at collabora.co.uk>
    Tested-by: Jenkins

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 )
     {


More information about the Libreoffice-commits mailing list