summaryrefslogtreecommitdiff
path: root/vcl/generic/glyphs
diff options
context:
space:
mode:
authorNorbert Thiebaud <nthiebaud@gmail.com>2012-03-04 19:30:04 -0600
committerNorbert Thiebaud <nthiebaud@gmail.com>2012-03-04 21:12:48 -0600
commit2ea4964b2e81a25125eec7ce3eb0b06b3883edf0 (patch)
tree92bba31d500bbd117ffc50264c90e78539125081 /vcl/generic/glyphs
parent6bb68cae7c31918eff8386d5b52be0759386bb60 (diff)
help GlyphItems vector to be sized correctly up-front
Diffstat (limited to 'vcl/generic/glyphs')
-rw-r--r--vcl/generic/glyphs/gcach_layout.cxx4
1 files changed, 4 insertions, 0 deletions
diff --git a/vcl/generic/glyphs/gcach_layout.cxx b/vcl/generic/glyphs/gcach_layout.cxx
index 5f92f4855f56..ef03aa302311 100644
--- a/vcl/generic/glyphs/gcach_layout.cxx
+++ b/vcl/generic/glyphs/gcach_layout.cxx
@@ -106,6 +106,8 @@ bool ServerFontLayoutEngine::operator()( ServerFontLayout& rLayout, ImplLayoutAr
int nGlyphWidth = 0;
GlyphItem aPrevItem;
bool bRightToLeft;
+
+ rLayout.Reserve(rArgs.mnLength);
for( int nCharPos = -1; rArgs.GetNextPos( &nCharPos, &bRightToLeft ); )
{
sal_UCS4 cChar = rArgs.mpStr[ nCharPos ];
@@ -409,6 +411,8 @@ bool IcuLayoutEngine::operator()( ServerFontLayout& rLayout, ImplLayoutArgs& rAr
// allocate temporary arrays, note: round to even
int nGlyphCapacity = (3 * (rArgs.mnEndCharPos - rArgs.mnMinCharPos ) | 15) + 1;
+ rLayout.Reserve(nGlyphCapacity);
+
struct IcuPosition{ float fX, fY; };
const int nAllocSize = sizeof(LEGlyphID) + sizeof(le_int32) + sizeof(IcuPosition);
LEGlyphID* pIcuGlyphs = (LEGlyphID*)alloca( (nGlyphCapacity * nAllocSize) + sizeof(IcuPosition) );