summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/sallayout.hxx6
-rw-r--r--vcl/qa/cppunit/complextext.cxx2
-rw-r--r--vcl/source/filter/svm/SvmConverter.cxx8
-rw-r--r--vcl/source/filter/wmf/emfwr.cxx7
-rw-r--r--vcl/source/filter/wmf/wmfwr.cxx12
-rw-r--r--vcl/source/gdi/CommonSalLayout.cxx14
-rw-r--r--vcl/source/gdi/sallayout.cxx65
-rw-r--r--vcl/source/gdi/textlayout.cxx11
-rw-r--r--vcl/source/outdev/text.cxx12
-rw-r--r--vcl/workben/vcldemo.cxx8
10 files changed, 69 insertions, 76 deletions
diff --git a/vcl/inc/sallayout.hxx b/vcl/inc/sallayout.hxx
index 9d37b71d1a3e..b2bdcc2d4cb0 100644
--- a/vcl/inc/sallayout.hxx
+++ b/vcl/inc/sallayout.hxx
@@ -128,7 +128,7 @@ class MultiSalLayout final : public SalLayout
public:
void DrawText(SalGraphics&) const override;
sal_Int32 GetTextBreak(DeviceCoordinate nMaxWidth, DeviceCoordinate nCharExtra, int nFactor) const override;
- DeviceCoordinate FillDXArray(DeviceCoordinate* pDXArray) const override;
+ DeviceCoordinate FillDXArray(std::vector<DeviceCoordinate>* pDXArray) const override;
void GetCaretPositions(int nArraySize, tools::Long* pCaretXArray) const override;
bool GetNextGlyph(const GlyphItem** pGlyph, Point& rPos, int& nStart,
const LogicalFontInstance** ppGlyphFont = nullptr,
@@ -179,7 +179,7 @@ public:
// used by upper layers
DeviceCoordinate GetTextWidth() const final override;
- DeviceCoordinate FillDXArray(DeviceCoordinate* pDXArray) const final override;
+ DeviceCoordinate FillDXArray(std::vector<DeviceCoordinate>* pDXArray) const final override;
sal_Int32 GetTextBreak(DeviceCoordinate nMaxWidth, DeviceCoordinate nCharExtra, int nFactor) const final override;
void GetCaretPositions(int nArraySize, tools::Long* pCaretXArray) const final override;
@@ -206,7 +206,7 @@ private:
void Justify(DeviceCoordinate nNewWidth);
void ApplyAsianKerning(const OUString& rStr);
- void GetCharWidths(DeviceCoordinate* pCharWidths) const;
+ void GetCharWidths(std::vector<DeviceCoordinate>& rCharWidths) const;
void SetNeedFallback(ImplLayoutArgs&, sal_Int32, bool);
diff --git a/vcl/qa/cppunit/complextext.cxx b/vcl/qa/cppunit/complextext.cxx
index a578cb71acef..77a98aa7afdb 100644
--- a/vcl/qa/cppunit/complextext.cxx
+++ b/vcl/qa/cppunit/complextext.cxx
@@ -72,7 +72,7 @@ void VclComplexTextTest::testArabic()
std::vector<tools::Long> aRefCharWidths {6, 9, 16, 16, 22, 22, 26, 29, 32, 32,
36, 40, 49, 53, 56, 63, 63, 66, 72, 72};
std::vector<tools::Long> aCharWidths(aOneTwoThree.getLength(), 0);
- tools::Long nTextWidth = pOutDev->GetTextArray(aOneTwoThree, aCharWidths.data());
+ tools::Long nTextWidth = pOutDev->GetTextArray(aOneTwoThree, &aCharWidths);
CPPUNIT_ASSERT_EQUAL(aRefCharWidths, aCharWidths);
// this sporadically returns 75 or 74 on some of the windows tinderboxes eg. tb73
diff --git a/vcl/source/filter/svm/SvmConverter.cxx b/vcl/source/filter/svm/SvmConverter.cxx
index 61c1647ebd24..8a34baa976a6 100644
--- a/vcl/source/filter/svm/SvmConverter.cxx
+++ b/vcl/source/filter/svm/SvmConverter.cxx
@@ -755,9 +755,9 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
{
if (nAryLen+1 == nStrLen && nIndex >= 0)
{
- std::unique_ptr<tools::Long[]> pTmpAry(new tools::Long[nStrLen]);
+ std::vector<tools::Long> aTmpAry;
- aFontVDev->GetTextArray( aStr, pTmpAry.get(), nIndex, nLen );
+ aFontVDev->GetTextArray( aStr, &aTmpAry, nIndex, nLen );
// now, the difference between the
// last and the second last DX array
@@ -767,9 +767,9 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
// difference to last elem and store
// in very last.
if( nStrLen > 1 )
- pDXAry[ nStrLen-1 ] = pDXAry[ nStrLen-2 ] + pTmpAry[ nStrLen-1 ] - pTmpAry[ nStrLen-2 ];
+ pDXAry[ nStrLen-1 ] = pDXAry[ nStrLen-2 ] + aTmpAry[ nStrLen-1 ] - aTmpAry[ nStrLen-2 ];
else
- pDXAry[ nStrLen-1 ] = pTmpAry[ nStrLen-1 ]; // len=1: 0th position taken to be 0
+ pDXAry[ nStrLen-1 ] = aTmpAry[ nStrLen-1 ]; // len=1: 0th position taken to be 0
}
#ifdef DBG_UTIL
else
diff --git a/vcl/source/filter/wmf/emfwr.cxx b/vcl/source/filter/wmf/emfwr.cxx
index 430048a060a4..69c7be43a57e 100644
--- a/vcl/source/filter/wmf/emfwr.cxx
+++ b/vcl/source/filter/wmf/emfwr.cxx
@@ -869,7 +869,7 @@ void EMFWriter::ImplWriteTextRecord( const Point& rPos, const OUString& rText, c
return;
sal_uInt32 nNormWidth;
- std::unique_ptr<tools::Long[]> pOwnArray;
+ std::vector<tools::Long> aOwnArray;
tools::Long* pDX;
// get text sizes
@@ -880,9 +880,8 @@ void EMFWriter::ImplWriteTextRecord( const Point& rPos, const OUString& rText, c
}
else
{
- pOwnArray.reset(new tools::Long[ nLen ]);
- nNormWidth = maVDev->GetTextArray( rText, pOwnArray.get() );
- pDX = pOwnArray.get();
+ nNormWidth = maVDev->GetTextArray( rText, &aOwnArray );
+ pDX = aOwnArray.data();
}
if( nLen > 1 )
diff --git a/vcl/source/filter/wmf/wmfwr.cxx b/vcl/source/filter/wmf/wmfwr.cxx
index 09c24110cbdb..bc88ba62dc84 100644
--- a/vcl/source/filter/wmf/wmfwr.cxx
+++ b/vcl/source/filter/wmf/wmfwr.cxx
@@ -1197,8 +1197,8 @@ void WMFWriter::WriteRecords( const GDIMetaFile & rMTF )
pVirDev->SetFont( aSrcFont );
const sal_Int32 nLen = aTemp.getLength();
- std::unique_ptr<tools::Long[]> pDXAry(nLen ? new tools::Long[ nLen ] : nullptr);
- const sal_Int32 nNormSize = pVirDev->GetTextArray( aTemp, pDXAry.get() );
+ std::vector<tools::Long> aDXAry;
+ const sal_Int32 nNormSize = pVirDev->GetTextArray( aTemp, nLen ? &aDXAry : nullptr );
if (nLen && nNormSize == 0)
{
OSL_FAIL("Impossible div by 0 action: MetaStretchTextAction!");
@@ -1206,13 +1206,13 @@ void WMFWriter::WriteRecords( const GDIMetaFile & rMTF )
else
{
for ( sal_Int32 i = 0; i < ( nLen - 1 ); i++ )
- pDXAry[ i ] = pDXAry[ i ] * static_cast<sal_Int32>(pA->GetWidth()) / nNormSize;
+ aDXAry[ i ] = aDXAry[ i ] * static_cast<sal_Int32>(pA->GetWidth()) / nNormSize;
if ( ( nLen <= 1 ) || ( static_cast<sal_Int32>(pA->GetWidth()) == nNormSize ) )
- pDXAry.reset();
+ aDXAry.clear();
aSrcLineInfo = LineInfo();
SetAllAttr();
- if ( !WMFRecord_Escape_Unicode( pA->GetPoint(), aTemp, pDXAry.get() ) )
- WMFRecord_ExtTextOut( pA->GetPoint(), aTemp, pDXAry.get() );
+ if ( !WMFRecord_Escape_Unicode( pA->GetPoint(), aTemp, aDXAry.empty() ? nullptr : aDXAry.data() ) )
+ WMFRecord_ExtTextOut( pA->GetPoint(), aTemp, aDXAry.empty() ? nullptr : aDXAry.data() );
}
}
break;
diff --git a/vcl/source/gdi/CommonSalLayout.cxx b/vcl/source/gdi/CommonSalLayout.cxx
index 4aa527c91d39..b6a489a88a9a 100644
--- a/vcl/source/gdi/CommonSalLayout.cxx
+++ b/vcl/source/gdi/CommonSalLayout.cxx
@@ -600,19 +600,19 @@ bool GenericSalLayout::LayoutText(ImplLayoutArgs& rArgs, const SalLayoutGlyphsIm
return true;
}
-void GenericSalLayout::GetCharWidths(DeviceCoordinate* pCharWidths) const
+void GenericSalLayout::GetCharWidths(std::vector<DeviceCoordinate>& rCharWidths) const
{
const int nCharCount = mnEndCharPos - mnMinCharPos;
- for (int i = 0; i < nCharCount; ++i)
- pCharWidths[i] = 0;
+ rCharWidths.clear();
+ rCharWidths.resize(nCharCount, 0);
for (auto const& aGlyphItem : m_GlyphItems)
{
const int nIndex = aGlyphItem.charPos() - mnMinCharPos;
if (nIndex >= nCharCount)
continue;
- pCharWidths[nIndex] += aGlyphItem.m_nNewWidth;
+ rCharWidths[nIndex] += aGlyphItem.m_nNewWidth;
}
}
@@ -636,11 +636,11 @@ void GenericSalLayout::GetCharWidths(DeviceCoordinate* pCharWidths) const
void GenericSalLayout::ApplyDXArray(const DeviceCoordinate* pDXArray, SalLayoutFlags nLayoutFlags)
{
int nCharCount = mnEndCharPos - mnMinCharPos;
- std::unique_ptr<DeviceCoordinate[]> const pOldCharWidths(new DeviceCoordinate[nCharCount]);
+ std::vector<DeviceCoordinate> aOldCharWidths;
std::unique_ptr<DeviceCoordinate[]> const pNewCharWidths(new DeviceCoordinate[nCharCount]);
// Get the natural character widths (i.e. before applying DX adjustments).
- GetCharWidths(pOldCharWidths.get());
+ GetCharWidths(aOldCharWidths);
// Calculate the character widths after DX adjustments.
for (int i = 0; i < nCharCount; ++i)
@@ -679,7 +679,7 @@ void GenericSalLayout::ApplyDXArray(const DeviceCoordinate* pDXArray, SalLayoutF
int nCharPos = m_GlyphItems[i].charPos() - mnMinCharPos;
DeviceCoordinate nDiff = 0;
for (int j = 0; j < m_GlyphItems[i].charCount(); j++)
- nDiff += pNewCharWidths[nCharPos + j] - pOldCharWidths[nCharPos + j];
+ nDiff += pNewCharWidths[nCharPos + j] - aOldCharWidths[nCharPos + j];
if (!m_GlyphItems[i].IsRTLGlyph())
{
diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx
index 2370e59bfa36..e731d6782cca 100644
--- a/vcl/source/gdi/sallayout.cxx
+++ b/vcl/source/gdi/sallayout.cxx
@@ -669,10 +669,10 @@ SalLayoutGlyphs SalLayout::GetGlyphs() const
return SalLayoutGlyphs(); // invalid
}
-DeviceCoordinate GenericSalLayout::FillDXArray( DeviceCoordinate* pCharWidths ) const
+DeviceCoordinate GenericSalLayout::FillDXArray( std::vector<DeviceCoordinate>* pCharWidths ) const
{
if (pCharWidths)
- GetCharWidths(pCharWidths);
+ GetCharWidths(*pCharWidths);
return GetTextWidth();
}
@@ -899,14 +899,13 @@ void GenericSalLayout::GetCaretPositions( int nMaxIndex, tools::Long* pCaretXArr
sal_Int32 GenericSalLayout::GetTextBreak( DeviceCoordinate nMaxWidth, DeviceCoordinate nCharExtra, int nFactor ) const
{
- int nCharCapacity = mnEndCharPos - mnMinCharPos;
- std::unique_ptr<DeviceCoordinate[]> const pCharWidths(new DeviceCoordinate[nCharCapacity]);
- GetCharWidths(pCharWidths.get());
+ std::vector<DeviceCoordinate> aCharWidths;
+ GetCharWidths(aCharWidths);
DeviceCoordinate nWidth = 0;
for( int i = mnMinCharPos; i < mnEndCharPos; ++i )
{
- nWidth += pCharWidths[ i - mnMinCharPos ] * nFactor;
+ nWidth += aCharWidths[ i - mnMinCharPos ] * nFactor;
if( nWidth > nMaxWidth )
return i;
nWidth += nCharExtra;
@@ -1061,7 +1060,7 @@ void MultiSalLayout::AdjustLayout( ImplLayoutArgs& rArgs )
{
SalLayout::AdjustLayout( rArgs );
ImplLayoutArgs aMultiArgs = rArgs;
- std::unique_ptr<DeviceCoordinate[]> pJustificationArray;
+ std::vector<DeviceCoordinate> aJustificationArray;
if( !rArgs.mpDXArray && rArgs.mnLayoutWidth )
{
@@ -1076,8 +1075,7 @@ void MultiSalLayout::AdjustLayout( ImplLayoutArgs& rArgs )
mpLayouts[n]->SalLayout::AdjustLayout( aMultiArgs );
// then we can measure the unmodified metrics
int nCharCount = rArgs.mnEndCharPos - rArgs.mnMinCharPos;
- pJustificationArray.reset(new DeviceCoordinate[nCharCount]);
- FillDXArray( pJustificationArray.get() );
+ FillDXArray( &aJustificationArray );
// #i17359# multilayout is not simplified yet, so calculating the
// unjustified width needs handholding; also count the number of
// stretchable virtual char widths
@@ -1086,8 +1084,8 @@ void MultiSalLayout::AdjustLayout( ImplLayoutArgs& rArgs )
for( int i = 0; i < nCharCount; ++i )
{
// convert array from widths to sum of widths
- nOrigWidth += pJustificationArray[i];
- if( pJustificationArray[i] > 0 )
+ nOrigWidth += aJustificationArray[i];
+ if( aJustificationArray[i] > 0 )
++nStretchable;
}
@@ -1098,7 +1096,7 @@ void MultiSalLayout::AdjustLayout( ImplLayoutArgs& rArgs )
DeviceCoordinate nWidthSum = 0;
for( int i = 0; i < nCharCount; ++i )
{
- DeviceCoordinate nJustWidth = pJustificationArray[i];
+ DeviceCoordinate nJustWidth = aJustificationArray[i];
if( (nJustWidth > 0) && (nStretchable > 0) )
{
DeviceCoordinate nDeltaWidth = nDiffWidth / nStretchable;
@@ -1107,10 +1105,10 @@ void MultiSalLayout::AdjustLayout( ImplLayoutArgs& rArgs )
--nStretchable;
}
nWidthSum += nJustWidth;
- pJustificationArray[i] = nWidthSum;
+ aJustificationArray[i] = nWidthSum;
}
if( nWidthSum != nTargetWidth )
- pJustificationArray[ nCharCount-1 ] = nTargetWidth;
+ aJustificationArray[ nCharCount-1 ] = nTargetWidth;
// the justification array is still in base level units
// => convert it to pixel units
@@ -1118,14 +1116,14 @@ void MultiSalLayout::AdjustLayout( ImplLayoutArgs& rArgs )
{
for( int i = 0; i < nCharCount; ++i )
{
- DeviceCoordinate nVal = pJustificationArray[ i ];
+ DeviceCoordinate nVal = aJustificationArray[ i ];
nVal += (mnUnitsPerPixel + 1) / 2;
- pJustificationArray[ i ] = nVal / mnUnitsPerPixel;
+ aJustificationArray[ i ] = nVal / mnUnitsPerPixel;
}
}
// change the mpDXArray temporarily (just for the justification)
- aMultiArgs.mpDXArray = pJustificationArray.get();
+ aMultiArgs.mpDXArray = aJustificationArray.data();
}
}
@@ -1429,23 +1427,23 @@ sal_Int32 MultiSalLayout::GetTextBreak( DeviceCoordinate nMaxWidth, DeviceCoordi
return mpLayouts[0]->GetTextBreak( nMaxWidth, nCharExtra, nFactor );
int nCharCount = mnEndCharPos - mnMinCharPos;
- std::unique_ptr<DeviceCoordinate[]> const pCharWidths(new DeviceCoordinate[nCharCount]);
- std::unique_ptr<DeviceCoordinate[]> const pFallbackCharWidths(new DeviceCoordinate[nCharCount]);
- mpLayouts[0]->FillDXArray( pCharWidths.get() );
+ std::vector<DeviceCoordinate> aCharWidths;
+ std::vector<DeviceCoordinate> aFallbackCharWidths;
+ mpLayouts[0]->FillDXArray( &aCharWidths );
for( int n = 1; n < mnLevel; ++n )
{
SalLayout& rLayout = *mpLayouts[ n ];
- rLayout.FillDXArray( pFallbackCharWidths.get() );
+ rLayout.FillDXArray( &aFallbackCharWidths );
double fUnitMul = mnUnitsPerPixel;
fUnitMul /= rLayout.GetUnitsPerPixel();
for( int i = 0; i < nCharCount; ++i )
{
- if( pCharWidths[ i ] == 0 )
+ if( aCharWidths[ i ] == 0 )
{
- DeviceCoordinate w = pFallbackCharWidths[i];
+ DeviceCoordinate w = aFallbackCharWidths[i];
w = static_cast<DeviceCoordinate>(w * fUnitMul + 0.5);
- pCharWidths[ i ] = w;
+ aCharWidths[ i ] = w;
}
}
}
@@ -1453,7 +1451,7 @@ sal_Int32 MultiSalLayout::GetTextBreak( DeviceCoordinate nMaxWidth, DeviceCoordi
DeviceCoordinate nWidth = 0;
for( int i = 0; i < nCharCount; ++i )
{
- nWidth += pCharWidths[ i ] * nFactor;
+ nWidth += aCharWidths[ i ] * nFactor;
if( nWidth > nMaxWidth )
return (i + mnMinCharPos);
nWidth += nCharExtra;
@@ -1462,24 +1460,23 @@ sal_Int32 MultiSalLayout::GetTextBreak( DeviceCoordinate nMaxWidth, DeviceCoordi
return -1;
}
-DeviceCoordinate MultiSalLayout::FillDXArray( DeviceCoordinate* pCharWidths ) const
+DeviceCoordinate MultiSalLayout::FillDXArray( std::vector<DeviceCoordinate>* pCharWidths ) const
{
DeviceCoordinate nMaxWidth = 0;
// prepare merging of fallback levels
- std::unique_ptr<DeviceCoordinate[]> pTempWidths;
+ std::vector<DeviceCoordinate> aTempWidths;
const int nCharCount = mnEndCharPos - mnMinCharPos;
if( pCharWidths )
{
- for( int i = 0; i < nCharCount; ++i )
- pCharWidths[i] = 0;
- pTempWidths.reset(new DeviceCoordinate[nCharCount]);
+ pCharWidths->clear();
+ pCharWidths->resize(nCharCount, 0);
}
for( int n = mnLevel; --n >= 0; )
{
// query every fallback level
- DeviceCoordinate nTextWidth = mpLayouts[n]->FillDXArray( pTempWidths.get() );
+ DeviceCoordinate nTextWidth = mpLayouts[n]->FillDXArray( &aTempWidths );
if( !nTextWidth )
continue;
// merge results from current level
@@ -1495,13 +1492,13 @@ DeviceCoordinate MultiSalLayout::FillDXArray( DeviceCoordinate* pCharWidths ) co
{
// #i17359# restriction:
// one char cannot be resolved from different fallbacks
- if( pCharWidths[i] != 0 )
+ if( (*pCharWidths)[i] != 0 )
continue;
- DeviceCoordinate nCharWidth = pTempWidths[i];
+ DeviceCoordinate nCharWidth = aTempWidths[i];
if( !nCharWidth )
continue;
nCharWidth = static_cast<DeviceCoordinate>(nCharWidth * fUnitMul + 0.5);
- pCharWidths[i] = nCharWidth;
+ (*pCharWidths)[i] = nCharWidth;
}
}
diff --git a/vcl/source/gdi/textlayout.cxx b/vcl/source/gdi/textlayout.cxx
index e3cad7aeadf7..5f4edb969e5c 100644
--- a/vcl/source/gdi/textlayout.cxx
+++ b/vcl/source/gdi/textlayout.cxx
@@ -86,7 +86,7 @@ namespace vcl
tools::Rectangle GetTextRect( const tools::Rectangle& _rRect, const OUString& _rText, DrawTextFlags _nStyle, Size* o_pDeviceSize );
private:
- tools::Long GetTextArray( const OUString& _rText, tools::Long* _pDXAry, sal_Int32 _nStartIndex, sal_Int32 _nLength ) const;
+ tools::Long GetTextArray( const OUString& _rText, std::vector<tools::Long>* _pDXAry, sal_Int32 _nStartIndex, sal_Int32 _nLength ) const;
OutputDevice& m_rTargetDevice;
OutputDevice& m_rReferenceDevice;
@@ -159,7 +159,7 @@ namespace vcl
}
}
- tools::Long ReferenceDeviceTextLayout::GetTextArray( const OUString& _rText, tools::Long* _pDXAry, sal_Int32 _nStartIndex, sal_Int32 _nLength ) const
+ tools::Long ReferenceDeviceTextLayout::GetTextArray( const OUString& _rText, std::vector<tools::Long>* _pDXAry, sal_Int32 _nStartIndex, sal_Int32 _nLength ) const
{
if ( !lcl_normalizeLength( _rText, _nStartIndex, _nLength ) )
return 0;
@@ -207,10 +207,9 @@ namespace vcl
return;
}
- std::unique_ptr<tools::Long[]> pCharWidths(new tools::Long[ _nLength ]);
- tools::Long nTextWidth = GetTextArray( _rText, pCharWidths.get(), _nStartIndex, _nLength );
- m_rTargetDevice.DrawTextArray( _rStartPoint, _rText, pCharWidths.get(), _nStartIndex, _nLength );
- pCharWidths.reset();
+ std::vector<tools::Long> aCharWidths;
+ tools::Long nTextWidth = GetTextArray( _rText, &aCharWidths, _nStartIndex, _nLength );
+ m_rTargetDevice.DrawTextArray( _rStartPoint, _rText, aCharWidths.data(), _nStartIndex, _nLength );
m_aCompleteTextRect.Union( tools::Rectangle( _rStartPoint, Size( nTextWidth, m_rTargetDevice.GetTextHeight() ) ) );
}
diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index d37d1c13dbaa..7d5fe5256353 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -906,7 +906,7 @@ void OutputDevice::DrawTextArray( const Point& rStartPt, const OUString& rStr,
mpAlphaVDev->DrawTextArray( rStartPt, rStr, pDXAry, nIndex, nLen, flags );
}
-tools::Long OutputDevice::GetTextArray( const OUString& rStr, tools::Long* pDXAry,
+tools::Long OutputDevice::GetTextArray( const OUString& rStr, std::vector<tools::Long>* pDXAry,
sal_Int32 nIndex, sal_Int32 nLen,
vcl::text::TextLayoutCache const*const pLayoutCache,
SalLayoutGlyphs const*const pSalLayoutCache) const
@@ -931,9 +931,7 @@ tools::Long OutputDevice::GetTextArray( const OUString& rStr, tools::Long* pDXAr
// element init in the happy case will still be found by tools,
// and hope that is sufficient.
if (pDXAry)
- {
- memset(pDXAry, 0, nLen * sizeof(*pDXAry));
- }
+ std::fill(pDXAry->begin(), pDXAry->end(), 0);
return 0;
}
@@ -993,14 +991,14 @@ tools::Long OutputDevice::GetTextArray( const OUString& rStr, tools::Long* pDXAr
// convert virtual char widths to virtual absolute positions
if( pDXAry )
for( int i = 1; i < nLen; ++i )
- pDXAry[ i ] += pDXAry[ i-1 ];
+ (*pDXAry)[ i ] += (*pDXAry)[ i-1 ];
// convert from font units to logical units
if( mbMap )
{
if( pDXAry )
for( int i = 0; i < nLen; ++i )
- pDXAry[i] = ImplDevicePixelToLogicWidth( pDXAry[i] );
+ (*pDXAry)[i] = ImplDevicePixelToLogicWidth( (*pDXAry)[i] );
nWidth = ImplDevicePixelToLogicWidth( nWidth );
}
@@ -1008,7 +1006,7 @@ tools::Long OutputDevice::GetTextArray( const OUString& rStr, tools::Long* pDXAr
{
if( pDXAry )
for( int i = 0; i < nLen; ++i )
- pDXAry[i] /= nWidthFactor;
+ (*pDXAry)[i] /= nWidthFactor;
nWidth /= nWidthFactor;
}
return nWidth;
diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx
index 1d9b3cf742b3..691ef192858f 100644
--- a/vcl/workben/vcldemo.cxx
+++ b/vcl/workben/vcldemo.cxx
@@ -630,14 +630,14 @@ public:
}
// DX array rendering
- std::unique_ptr<tools::Long[]> pItems(new tools::Long[aText.getLength()+10]);
- rDev.GetTextArray(aText, pItems.get());
+ std::vector<tools::Long> aItems;
+ rDev.GetTextArray(aText, &aItems);
for (tools::Long j = 0; j < aText.getLength(); ++j)
{
Point aTop = aTextRect.TopLeft();
Point aBottom = aTop;
- aTop.Move(pItems[j], 0);
- aBottom.Move(pItems[j], aTextRect.GetHeight());
+ aTop.Move(aItems[j], 0);
+ aBottom.Move(aItems[j], aTextRect.GetHeight());
rDev.SetLineColor(COL_RED);
rDev.SetRasterOp(RasterOp::Xor);
rDev.DrawLine(aTop,aBottom);