diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2022-05-25 17:25:35 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2022-05-25 22:06:13 +0200 |
commit | e544febe2108d0bbe99936ce7373a22f32fe08a7 (patch) | |
tree | 9fab9f595b553283e320230f90990278a32346f9 /vcl | |
parent | ff6347f86f6bae66d21059d68ca0b47a63fb0aa2 (diff) |
don't try glyph subsets if cloneCharRange() would return anyway
A small optimization.
Change-Id: I21786ce713bd39d14c075a941d83c060d04b8886
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134949
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/gdi/impglyphitem.cxx | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/vcl/source/gdi/impglyphitem.cxx b/vcl/source/gdi/impglyphitem.cxx index ffed4d56c743..bdedb263778e 100644 --- a/vcl/source/gdi/impglyphitem.cxx +++ b/vcl/source/gdi/impglyphitem.cxx @@ -103,6 +103,7 @@ SalLayoutGlyphsImpl* SalLayoutGlyphsImpl::cloneCharRange(sal_Int32 index, sal_In // the subset may not quite match what would a real layout call give (e.g. some characters with neutral // direction such as space might have different LTR/RTL flag). It seems bailing out here mostly // avoid relatively rare corner cases and doesn't matter for performance. + // This is also checked in SalLayoutGlyphsCache::GetLayoutGlyphs() below. if (!(GetFlags() & SalLayoutFlags::BiDiStrong) || rtl != bool(GetFlags() & SalLayoutFlags::BiDiRtl)) return nullptr; @@ -317,7 +318,10 @@ SalLayoutGlyphsCache::GetLayoutGlyphs(VclPtr<const OutputDevice> outputDevice, c } bool resetLastSubstringKey = true; const sal_Unicode nbSpace = 0xa0; // non-breaking space - if (nIndex != 0 || nLen != text.getLength()) + // SalLayoutGlyphsImpl::cloneCharRange() requires BiDiStrong, so if not set, do not even try. + bool skipGlyphSubsets + = !(outputDevice->GetLayoutMode() & vcl::text::ComplexTextLayoutFlags::BiDiStrong); + if ((nIndex != 0 || nLen != text.getLength()) && !skipGlyphSubsets) { // The glyphs functions are often called first for an entire string // and then with an increasing starting index until the end of the string. |