summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-12-17 12:54:56 +0200
committerAdolfo Jayme Barrientos <fitojb@ubuntu.com>2019-12-17 23:52:02 +0100
commit580f2b93a9c754743341e5e2f40084bceb8a1680 (patch)
treecfab6a02474a4e5bce56859951166820ac47d1d6 /vcl
parent39108ddebe9abd229b9b215c7e78452687422b37 (diff)
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 <noel.grandin@collabora.co.uk> (cherry picked from commit 11c0effe3def917ec2002a30dbbcca1c5758ffa9) Reviewed-on: https://gerrit.libreoffice.org/85302 Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/outdev/text.cxx12
1 files changed, 9 insertions, 3 deletions
diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index 3c69069929a8..0bb1d36fd35e 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -48,6 +48,7 @@
#include <textlayout.hxx>
#include <textlineinfo.hxx>
#include <impglyphitem.hxx>
+#include <boost/optional.hpp>
#define TEXT_DRAW_ELLIPSIS (DrawTextFlags::EndEllipsis | DrawTextFlags::PathEllipsis | DrawTextFlags::NewsEllipsis)
@@ -1189,7 +1190,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<OUStringBuffer> xTmpStr;
for( ; pStr < pEnd; ++pStr )
{
// TODO: are there non-digit localizations?
@@ -1198,11 +1199,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