From 11c0effe3def917ec2002a30dbbcca1c5758ffa9 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 17 Dec 2019 12:54:56 +0200 Subject: tdf#112989 reduce export to PDF time reduces the time from 33s to 24s for me Change-Id: Ia70e1c4220ebedf0b686ed76c5704efa551591fe Reviewed-on: https://gerrit.libreoffice.org/85281 Tested-by: Jenkins Reviewed-by: Noel Grandin --- vcl/source/outdev/text.cxx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'vcl') diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx index 26d7e38f318c..8de7cece1bbb 100644 --- a/vcl/source/outdev/text.cxx +++ b/vcl/source/outdev/text.cxx @@ -48,6 +48,7 @@ #include #include #include +#include #define TEXT_DRAW_ELLIPSIS (DrawTextFlags::EndEllipsis | DrawTextFlags::PathEllipsis | DrawTextFlags::NewsEllipsis) @@ -1190,7 +1191,7 @@ ImplLayoutArgs OutputDevice::ImplPrepareLayoutArgs( OUString& rStr, const sal_Unicode* pBase = rStr.getStr(); const sal_Unicode* pStr = pBase + nMinIndex; const sal_Unicode* pEnd = pBase + nEndIndex; - OUStringBuffer sTmpStr(rStr); + boost::optional xTmpStr; for( ; pStr < pEnd; ++pStr ) { // TODO: are there non-digit localizations? @@ -1199,11 +1200,16 @@ ImplLayoutArgs OutputDevice::ImplPrepareLayoutArgs( OUString& rStr, // translate characters to local preference sal_UCS4 cChar = GetLocalizedChar( *pStr, meTextLanguage ); if( cChar != *pStr ) + { + if (!xTmpStr) + xTmpStr = OUStringBuffer(rStr); // TODO: are the localized digit surrogates? - sTmpStr[pStr - pBase] = cChar; + (*xTmpStr)[pStr - pBase] = cChar; + } } } - rStr = sTmpStr.makeStringAndClear(); + if (xTmpStr) + rStr = (*xTmpStr).makeStringAndClear(); } // right align for RTL text, DRAWPOS_REVERSED, RTL window style -- cgit