diff options
author | Norbert Thiebaud <nthiebaud@gmail.com> | 2012-03-04 19:30:04 -0600 |
---|---|---|
committer | Norbert Thiebaud <nthiebaud@gmail.com> | 2012-03-04 21:12:48 -0600 |
commit | 2ea4964b2e81a25125eec7ce3eb0b06b3883edf0 (patch) | |
tree | 92bba31d500bbd117ffc50264c90e78539125081 /vcl/generic | |
parent | 6bb68cae7c31918eff8386d5b52be0759386bb60 (diff) |
help GlyphItems vector to be sized correctly up-front
Diffstat (limited to 'vcl/generic')
-rw-r--r-- | vcl/generic/glyphs/gcach_layout.cxx | 4 | ||||
-rw-r--r-- | vcl/generic/print/genpspgraphics.cxx | 3 |
2 files changed, 7 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) ); diff --git a/vcl/generic/print/genpspgraphics.cxx b/vcl/generic/print/genpspgraphics.cxx index b806c1d933ba..29c0610c53d1 100644 --- a/vcl/generic/print/genpspgraphics.cxx +++ b/vcl/generic/print/genpspgraphics.cxx @@ -616,6 +616,9 @@ bool PspFontLayout::LayoutText( ImplLayoutArgs& rArgs ) Point aNewPos( 0, 0 ); GlyphItem aPrevItem; rtl_TextEncoding aFontEnc = mrPrinterGfx.GetFontMgr().getFontEncoding( mnFontID ); + + Reserve(rArgs.mnLength); + for(;;) { bool bRightToLeft; |