summaryrefslogtreecommitdiff
path: root/vcl/generic/glyphs/gcach_layout.cxx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-10-07 10:09:56 +0100
committerCaolán McNamara <caolanm@redhat.com>2015-10-07 13:24:01 +0000
commitae625675a88db46d378cc29f6513bbb4fa6e62a7 (patch)
tree0c91981c8e7726a79b3f911b86e30ca7475e1974 /vcl/generic/glyphs/gcach_layout.cxx
parent9bb6863fcf0784c70a95510b488f0162fe6deb37 (diff)
afl-eventtesting: creating OUString from super long sal_Unicode* is slow
the mpStr and mnLength arguments are always created from an OUString and the OUString aRun(rArgs.mpStr); creates a duplicate of the original string. Its way faster to pass the original OUString around instead. Change-Id: I3de0cc31654eb215362548b6aee435f9c0c3c9db Reviewed-on: https://gerrit.libreoffice.org/19221 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/generic/glyphs/gcach_layout.cxx')
-rw-r--r--vcl/generic/glyphs/gcach_layout.cxx18
1 files changed, 10 insertions, 8 deletions
diff --git a/vcl/generic/glyphs/gcach_layout.cxx b/vcl/generic/glyphs/gcach_layout.cxx
index 4a8c14445718..3d841449c434 100644
--- a/vcl/generic/glyphs/gcach_layout.cxx
+++ b/vcl/generic/glyphs/gcach_layout.cxx
@@ -58,7 +58,7 @@ void ServerFontLayout::AdjustLayout( ImplLayoutArgs& rArgs )
if( (rArgs.mnFlags & SalLayoutFlags::KerningAsian)
&& !(rArgs.mnFlags & SalLayoutFlags::Vertical) )
if( (rArgs.mpDXArray != NULL) || (rArgs.mnLayoutWidth != 0) )
- ApplyAsianKerning( rArgs.mpStr, rArgs.mnLength );
+ ApplyAsianKerning(rArgs.mrStr);
// insert kashidas where requested by the formatting array
if( (rArgs.mnFlags & SalLayoutFlags::KashidaJustification) && rArgs.mpDXArray )
@@ -89,13 +89,12 @@ void ServerFontLayout::SetNeedFallback(ImplLayoutArgs& rArgs, sal_Int32 nCharPos
//if position nCharPos is missing in the font, grab the entire grapheme and
//mark all glyphs as missing so the whole thing is rendered with the same
//font
- OUString aRun(rArgs.mpStr);
sal_Int32 nDone;
sal_Int32 nGraphemeStartPos =
- mxBreak->previousCharacters(aRun, nCharPos+1, aLocale,
+ mxBreak->previousCharacters(rArgs.mrStr, nCharPos+1, aLocale,
i18n::CharacterIteratorMode::SKIPCELL, 1, nDone);
sal_Int32 nGraphemeEndPos =
- mxBreak->nextCharacters(aRun, nCharPos, aLocale,
+ mxBreak->nextCharacters(rArgs.mrStr, nCharPos, aLocale,
i18n::CharacterIteratorMode::SKIPCELL, 1, nDone);
rArgs.NeedFallback(nGraphemeStartPos, nGraphemeEndPos, bRightToLeft);
@@ -409,6 +408,9 @@ bool HbLayoutEngine::Layout(ServerFontLayout& rLayout, ImplLayoutArgs& rArgs)
rLayout.Reserve(nGlyphCapacity);
+ const int nLength = rArgs.mrStr.getLength();
+ const sal_Unicode *pStr = rArgs.mrStr.getStr();
+
std::unique_ptr<vcl::TextLayoutCache> pNewScriptRun;
vcl::TextLayoutCache const* pTextLayout;
if (rArgs.m_pTextLayoutCache)
@@ -417,7 +419,7 @@ bool HbLayoutEngine::Layout(ServerFontLayout& rLayout, ImplLayoutArgs& rArgs)
}
else
{
- pNewScriptRun.reset(new vcl::TextLayoutCache(rArgs.mpStr, rArgs.mnEndCharPos));
+ pNewScriptRun.reset(new vcl::TextLayoutCache(pStr, rArgs.mnEndCharPos));
pTextLayout = pNewScriptRun.get();
}
@@ -472,7 +474,7 @@ bool HbLayoutEngine::Layout(ServerFontLayout& rLayout, ImplLayoutArgs& rArgs)
int nHbFlags = HB_BUFFER_FLAGS_DEFAULT;
if (nMinRunPos == 0)
nHbFlags |= HB_BUFFER_FLAG_BOT; /* Beginning-of-text */
- if (nEndRunPos == rArgs.mnLength)
+ if (nEndRunPos == nLength)
nHbFlags |= HB_BUFFER_FLAG_EOT; /* End-of-text */
hb_buffer_t *pHbBuffer = hb_buffer_create();
@@ -481,7 +483,7 @@ bool HbLayoutEngine::Layout(ServerFontLayout& rLayout, ImplLayoutArgs& rArgs)
hb_buffer_set_script(pHbBuffer, maHbScript);
hb_buffer_set_language(pHbBuffer, hb_language_from_string(sLanguage.getStr(), -1));
hb_buffer_set_flags(pHbBuffer, (hb_buffer_flags_t) nHbFlags);
- hb_buffer_add_utf16(pHbBuffer, rArgs.mpStr, rArgs.mnLength, nMinRunPos, nRunLen);
+ hb_buffer_add_utf16(pHbBuffer, pStr, nLength, nMinRunPos, nRunLen);
hb_shape(pHbFont, pHbBuffer, NULL, 0);
int nRunGlyphCount = hb_buffer_get_length(pHbBuffer);
@@ -505,7 +507,7 @@ bool HbLayoutEngine::Layout(ServerFontLayout& rLayout, ImplLayoutArgs& rArgs)
// FixupGlyphIndex() is doing, minus the GSUB part.
if (nCharPos >= 0)
{
- sal_UCS4 aChar = rArgs.mpStr[nCharPos];
+ sal_UCS4 aChar = rArgs.mrStr[nCharPos];
nGlyphIndex = rFont.FixupGlyphIndex(nGlyphIndex, aChar);
}