diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2018-08-10 17:49:15 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2018-08-10 19:48:53 +0200 |
commit | 2f383611f356023948cd825688a95b5f9425fe13 (patch) | |
tree | acb3fecaa9312a0c19e7bd2495bceee62888383d /vcl | |
parent | 36a2af004e1a7b17a71d8327c7ae2b6091ab0ffa (diff) |
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@collabora.co.uk>
Tested-by: Jenkins
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/gdi/CommonSalLayout.cxx | 4 |
1 files changed, 4 insertions, 0 deletions
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); |