diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-04-15 14:37:47 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-04-15 14:51:18 -0400 |
commit | 8e50a6c7b1cb9481cce42c71ff07e921fb4292d0 (patch) | |
tree | 864a3e7d723dcce4feace1f6427a420a36ad1e70 /sc | |
parent | 168f26572ab320b210f4b9191ef6f152f01e6a38 (diff) |
Use single std::vector instance in lieu of heap arrays.
Change-Id: I36820b5c3790998eab922a0fa603ac063972c445
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/view/output2.cxx | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx index 4b99bcbb8e56..1a625e5c687d 100644 --- a/sc/source/ui/view/output2.cxx +++ b/sc/source/ui/view/output2.cxx @@ -1477,6 +1477,7 @@ void ScOutputData::DrawStrings( bool bPixelToLogic ) // before processing the cell value. ::boost::ptr_vector<ScPatternAttr> aAltPatterns; + std::vector<sal_Int32> aDX; long nPosY = nScrY; for (SCSIZE nArrY=1; nArrY+1<nArrCount; nArrY++) { @@ -2022,25 +2023,29 @@ void ScOutputData::DrawStrings( bool bPixelToLogic ) // aufgezeichnet werden (fuer nicht-proportionales Resize): OUString aString = aVars.GetString(); - if (bMetaFile || pFmtDevice != mpDev || aZoomX != aZoomY) + if (!aString.isEmpty()) { - sal_Int32* pDX = new sal_Int32[aString.getLength()]; - pFmtDevice->GetTextArray( aString, pDX ); - - if ( !mpRefDevice->GetConnectMetaFile() || - mpRefDevice->GetOutDevType() == OUTDEV_PRINTER ) + if (bMetaFile || pFmtDevice != mpDev || aZoomX != aZoomY) { - double fMul = GetStretch(); - sal_Int32 nLen = aString.getLength(); - for( sal_Int32 i = 0; i<nLen; i++ ) - pDX[i] = (long)(pDX[i] / fMul + 0.5); - } + size_t nLen = aString.getLength(); + if (aDX.size() < nLen) + aDX.resize(nLen, 0); + + pFmtDevice->GetTextArray(aString, &aDX[0]); - mpDev->DrawTextArray( aDrawTextPos, aString, pDX ); - delete[] pDX; + if ( !mpRefDevice->GetConnectMetaFile() || + mpRefDevice->GetOutDevType() == OUTDEV_PRINTER ) + { + double fMul = GetStretch(); + for (size_t i = 0; i < nLen; ++i) + aDX[i] = static_cast<sal_Int32>(aDX[i] / fMul + 0.5); + } + + mpDev->DrawTextArray(aDrawTextPos, aString, &aDX[0]); + } + else + mpDev->DrawText( aDrawTextPos, aString ); } - else - mpDev->DrawText( aDrawTextPos, aString ); if ( bHClip || bVClip ) { |