diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2019-10-17 20:33:50 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-10-26 12:38:33 +0200 |
commit | e276c812648bf511d6c4813d6fd82a00391cfdac (patch) | |
tree | adbf24f41bef128a081cc1cc117c8023a3eed65d /vcl/source | |
parent | d04f044f05b4d13c3c6ea3f33fddd9c05a0ab3ad (diff) |
size some stringbuffer to prevent re-alloc
I started with 32 and kept doubling the size until the site
did not need re-alloc, but clamped it at 512 (e.g. in emfio/).
Change-Id: Ib7caf35a1b7e42b0e4ed8aa812493449e3eefc8f
Reviewed-on: https://gerrit.libreoffice.org/81540
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/control/field.cxx | 6 | ||||
-rw-r--r-- | vcl/source/outdev/font.cxx | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx index ed003e5d74e6..1e2ab5a237c5 100644 --- a/vcl/source/control/field.cxx +++ b/vcl/source/control/field.cxx @@ -894,12 +894,14 @@ namespace nTextLen = OUString(OUString::number(rFormatter.GetMin())).getLength(); string::padToLength(aBuf, nTextLen, '9'); Size aMinTextSize = rSpinField.CalcMinimumSizeForText( - rFormatter.CreateFieldText(aBuf.makeStringAndClear().toInt64())); + rFormatter.CreateFieldText(aBuf.toString().toInt64())); + aBuf.setLength(0); nTextLen = OUString(OUString::number(rFormatter.GetMax())).getLength(); string::padToLength(aBuf, nTextLen, '9'); Size aMaxTextSize = rSpinField.CalcMinimumSizeForText( - rFormatter.CreateFieldText(aBuf.makeStringAndClear().toInt64())); + rFormatter.CreateFieldText(aBuf.toString().toInt64())); + aBuf.setLength(0); Size aRet(std::max(aMinTextSize.Width(), aMaxTextSize.Width()), std::max(aMinTextSize.Height(), aMaxTextSize.Height())); diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx index b4a57c9c025e..22c61063bd21 100644 --- a/vcl/source/outdev/font.cxx +++ b/vcl/source/outdev/font.cxx @@ -1320,7 +1320,7 @@ std::unique_ptr<SalLayout> OutputDevice::ImplGlyphFallbackLayout( std::unique_pt // get list of code units that need glyph fallback int nCharPos = -1; bool bRTL = false; - OUStringBuffer aMissingCodeBuf; + OUStringBuffer aMissingCodeBuf(512); while (rLayoutArgs.GetNextPos( &nCharPos, &bRTL)) aMissingCodeBuf.append(rLayoutArgs.mrStr[nCharPos]); rLayoutArgs.ResetPos(); |