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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Aug 10 17:49:18 UTC 2018


 vcl/source/gdi/CommonSalLayout.cxx |    4 ++++
 1 file changed, 4 insertions(+)

New commits:
commit 2f383611f356023948cd825688a95b5f9425fe13
Author:     Miklos Vajna <vmiklos at collabora.co.uk>
AuthorDate: Fri Aug 10 17:49:15 2018 +0200
Commit:     Miklos Vajna <vmiklos at collabora.co.uk>
CommitDate: Fri Aug 10 19:48:53 2018 +0200

    vcl text layout: return early for empty strings
    
    It seems the only side effect of GenericSalLayout::LayoutText() is
    push_back() calls on m_GlyphItems, which doesn't happen for an empty
    string input, so it's safe short-circuit this case.
    
    Change-Id: Ia6e2865117bca60573e2874f11d3742413e9df4b
    Reviewed-on: https://gerrit.libreoffice.org/58850
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Jenkins

diff --git a/vcl/source/gdi/CommonSalLayout.cxx b/vcl/source/gdi/CommonSalLayout.cxx
index 2ce4e6890789..7f3d9d851797 100644
--- a/vcl/source/gdi/CommonSalLayout.cxx
+++ b/vcl/source/gdi/CommonSalLayout.cxx
@@ -260,6 +260,10 @@ bool GenericSalLayout::HasVerticalAlternate(sal_UCS4 aChar, sal_UCS4 aVariationS
 
 bool GenericSalLayout::LayoutText(ImplLayoutArgs& rArgs)
 {
+    // No need to touch m_GlyphItems at all for an empty string.
+    if (rArgs.mnEndCharPos - rArgs.mnMinCharPos <= 0)
+        return true;
+
     hb_font_t *pHbFont = mpFont->GetHbFont();
     hb_face_t* pHbFace = hb_font_get_face(pHbFont);
 


More information about the Libreoffice-commits mailing list