[Libreoffice-commits] core.git: vcl/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Tue Dec 17 12:52:06 UTC 2019
vcl/source/outdev/text.cxx | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
New commits:
commit 11c0effe3def917ec2002a30dbbcca1c5758ffa9
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Dec 17 12:54:56 2019 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Dec 17 13:50:59 2019 +0100
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 at collabora.co.uk>
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 <textlayout.hxx>
#include <textlineinfo.hxx>
#include <impglyphitem.hxx>
+#include <boost/optional.hpp>
#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<OUStringBuffer> 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
More information about the Libreoffice-commits
mailing list