diff options
author | Khaled Hosny <khaledhosny@eglug.org> | 2016-05-17 22:49:40 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-05-18 00:08:27 +0000 |
commit | f688acfdae00ebdd891737e533d54368810185e1 (patch) | |
tree | 6d68a846bcf80efc714fd0da0150030dc94af9ef /vcl/unx | |
parent | bdcb496858a7d37e7d24436dcededa8613469df0 (diff) |
Try to fix perf regression in HbLayoutEngine::Layout()
Regression from 1da9b4c24e806ad2447b4a656e2a7192755bb6a8. We should
cache the break iterator as creating it is pretty expensive.
Change-Id: Id9bbe9aa9835d1b38bc7c8219464ee9c62335325
Reviewed-on: https://gerrit.libreoffice.org/25073
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'vcl/unx')
-rw-r--r-- | vcl/unx/generic/glyphs/gcach_layout.cxx | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/vcl/unx/generic/glyphs/gcach_layout.cxx b/vcl/unx/generic/glyphs/gcach_layout.cxx index 61d1477a0ff0..f2afa9ae5db0 100644 --- a/vcl/unx/generic/glyphs/gcach_layout.cxx +++ b/vcl/unx/generic/glyphs/gcach_layout.cxx @@ -326,6 +326,7 @@ private: hb_script_t maHbScript; hb_face_t* mpHbFace; int mnUnitsPerEM; + css::uno::Reference<css::i18n::XBreakIterator> mxBreak; public: explicit HbLayoutEngine(ServerFont&); @@ -514,7 +515,8 @@ bool HbLayoutEngine::Layout(ServerFontLayout& rLayout, ImplLayoutArgs& rArgs) sal_Int32 nGraphemeStartPos = std::numeric_limits<sal_Int32>::max(); sal_Int32 nGraphemeEndPos = std::numeric_limits<sal_Int32>::min(); - css::uno::Reference<css::i18n::XBreakIterator> xBreak = vcl::unohelper::CreateBreakIterator(); + if (!mxBreak.is()) + mxBreak = vcl::unohelper::CreateBreakIterator(); com::sun::star::lang::Locale aLocale(rArgs.maLanguageTag.getLocale()); for (int i = 0; i < nRunGlyphCount; ++i) { @@ -539,13 +541,13 @@ bool HbLayoutEngine::Layout(ServerFontLayout& rLayout, ImplLayoutArgs& rArgs) if(bRightToLeft && (nCharPos < nGraphemeStartPos)) { sal_Int32 nDone; - nGraphemeStartPos = xBreak->previousCharacters(rArgs.mrStr, nCharPos+1, aLocale, + nGraphemeStartPos = mxBreak->previousCharacters(rArgs.mrStr, nCharPos+1, aLocale, com::sun::star::i18n::CharacterIteratorMode::SKIPCELL, 1, nDone); } else if(!bRightToLeft && (nCharPos >= nGraphemeEndPos)) { sal_Int32 nDone; - nGraphemeEndPos = xBreak->nextCharacters(rArgs.mrStr, nCharPos, aLocale, + nGraphemeEndPos = mxBreak->nextCharacters(rArgs.mrStr, nCharPos, aLocale, com::sun::star::i18n::CharacterIteratorMode::SKIPCELL, 1, nDone); } else |