diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-10-07 10:09:56 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-10-07 13:24:01 +0000 |
commit | ae625675a88db46d378cc29f6513bbb4fa6e62a7 (patch) | |
tree | 0c91981c8e7726a79b3f911b86e30ca7475e1974 /vcl/quartz | |
parent | 9bb6863fcf0784c70a95510b488f0162fe6deb37 (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/quartz')
-rw-r--r-- | vcl/quartz/ctlayout.cxx | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/vcl/quartz/ctlayout.cxx b/vcl/quartz/ctlayout.cxx index f1acd1727191..8e8f27572d3c 100644 --- a/vcl/quartz/ctlayout.cxx +++ b/vcl/quartz/ctlayout.cxx @@ -131,9 +131,11 @@ bool CTLayout::LayoutText( ImplLayoutArgs& rArgs ) if( mnCharCount <= 0 ) return false; + const sal_Unicode *pStr = rArgs.mrStr.getStr(); + // create the CoreText line layout CFStringRef aCFText = CFStringCreateWithCharactersNoCopy( NULL, - rArgs.mpStr + mnMinCharPos, + pStr + mnMinCharPos, mnCharCount, kCFAllocatorNull ); // CFAttributedStringCreate copies the attribues parameter @@ -146,7 +148,7 @@ bool CTLayout::LayoutText( ImplLayoutArgs& rArgs ) // reverse search for first 'non-space'... for( int i = mnEndCharPos - 1; i >= mnMinCharPos; i--) { - sal_Unicode nChar = rArgs.mpStr[i]; + sal_Unicode nChar = pStr[i]; if ((nChar <= 0x0020) || // blank (nChar == 0x00A0) || // non breaking space (nChar >= 0x2000 && nChar <= 0x200F) || // whitespace @@ -209,8 +211,9 @@ void CTLayout::AdjustLayout( ImplLayoutArgs& rArgs ) // recreate the CoreText line layout without trailing spaces SAL_INFO( "vcl.ct", "CFRelease(" << mpCTLine << ")" ); CFRelease( mpCTLine ); + const sal_Unicode *pStr = rArgs.mrStr.getStr(); CFStringRef aCFText = CFStringCreateWithCharactersNoCopy( NULL, - rArgs.mpStr + mnMinCharPos, + pStr + mnMinCharPos, mnCharCount - mnTrailingSpaceCount, kCFAllocatorNull ); CFAttributedStringRef pAttrStr = CFAttributedStringCreate( NULL, |