diff options
Diffstat (limited to 'vcl/source/gdi')
-rw-r--r-- | vcl/source/gdi/gdimtf.cxx | 4 | ||||
-rw-r--r-- | vcl/source/gdi/metaact.cxx | 38 | ||||
-rw-r--r-- | vcl/source/gdi/mtfxmldump.cxx | 2 | ||||
-rw-r--r-- | vcl/source/gdi/pdfwriter.cxx | 2 | ||||
-rw-r--r-- | vcl/source/gdi/pdfwriter_impl.cxx | 2 | ||||
-rw-r--r-- | vcl/source/gdi/pdfwriter_impl2.cxx | 2 | ||||
-rw-r--r-- | vcl/source/gdi/textlayout.cxx | 2 |
7 files changed, 28 insertions, 24 deletions
diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx index 39fe64c33050..28cd535a1eb6 100644 --- a/vcl/source/gdi/gdimtf.cxx +++ b/vcl/source/gdi/gdimtf.cxx @@ -1463,7 +1463,7 @@ tools::Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, tools::R tools::Rectangle aRect; // hdu said base = index aMapVDev->GetTextBoundRect( aRect, pAct->GetText(), pAct->GetIndex(), pAct->GetIndex(), pAct->GetLen(), - 0, pAct->GetDXArray() ); + 0, { pAct->GetDXArray().data(), pAct->GetDXArray().size() } ); Point aPt( pAct->GetPoint() ); aRect.Move( aPt.X(), aPt.Y() ); ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, nullptr ); @@ -2257,7 +2257,7 @@ sal_uLong GDIMetaFile::GetSizeBytes() const nSizeBytes += ( pTextArrayAction->GetText().getLength() * sizeof( sal_Unicode ) ); - if( pTextArrayAction->GetDXArray() ) + if( !pTextArrayAction->GetDXArray().empty() ) nSizeBytes += ( pTextArrayAction->GetLen() << 2 ); } break; diff --git a/vcl/source/gdi/metaact.cxx b/vcl/source/gdi/metaact.cxx index beb7dbffa7ee..191c5c05539c 100644 --- a/vcl/source/gdi/metaact.cxx +++ b/vcl/source/gdi/metaact.cxx @@ -598,34 +598,38 @@ MetaTextArrayAction::MetaTextArrayAction( const MetaTextArrayAction& rAction ) : MetaAction ( MetaActionType::TEXTARRAY ), maStartPt ( rAction.maStartPt ), maStr ( rAction.maStr ), + maDXAry ( rAction.maDXAry ), mnIndex ( rAction.mnIndex ), mnLen ( rAction.mnLen ) { - if( rAction.mpDXAry ) - { - mpDXAry.reset( new tools::Long[ mnLen ] ); - memcpy( mpDXAry.get(), rAction.mpDXAry.get(), mnLen * sizeof( tools::Long ) ); - } } MetaTextArrayAction::MetaTextArrayAction( const Point& rStartPt, const OUString& rStr, - const tools::Long* pDXAry, + const std::vector<tools::Long>& rDXAry, sal_Int32 nIndex, sal_Int32 nLen ) : MetaAction ( MetaActionType::TEXTARRAY ), maStartPt ( rStartPt ), maStr ( rStr ), + maDXAry ( rDXAry ), mnIndex ( nIndex ), mnLen ( nLen ) { - const sal_Int32 nAryLen = pDXAry ? mnLen : 0; +} - if (nAryLen > 0) - { - mpDXAry.reset( new tools::Long[ nAryLen ] ); - memcpy( mpDXAry.get(), pDXAry, nAryLen * sizeof(tools::Long) ); - } +MetaTextArrayAction::MetaTextArrayAction( const Point& rStartPt, + const OUString& rStr, + o3tl::span<const tools::Long> pDXAry, + sal_Int32 nIndex, + sal_Int32 nLen ) : + MetaAction ( MetaActionType::TEXTARRAY ), + maStartPt ( rStartPt ), + maStr ( rStr ), + maDXAry ( pDXAry.begin(), pDXAry.end() ), + mnIndex ( nIndex ), + mnLen ( nLen ) +{ } MetaTextArrayAction::~MetaTextArrayAction() @@ -634,7 +638,7 @@ MetaTextArrayAction::~MetaTextArrayAction() void MetaTextArrayAction::Execute( OutputDevice* pOut ) { - pOut->DrawTextArray( maStartPt, maStr, mpDXAry.get(), mnIndex, mnLen ); + pOut->DrawTextArray( maStartPt, maStr, { maDXAry.data(), maDXAry.size() }, mnIndex, mnLen ); } rtl::Reference<MetaAction> MetaTextArrayAction::Clone() const @@ -651,16 +655,16 @@ void MetaTextArrayAction::Scale( double fScaleX, double fScaleY ) { ImplScalePoint( maStartPt, fScaleX, fScaleY ); - if ( mpDXAry && mnLen ) + if ( !maDXAry.empty() && mnLen ) { for ( sal_uInt16 i = 0, nCount = mnLen; i < nCount; i++ ) - mpDXAry[ i ] = FRound( mpDXAry[ i ] * fabs(fScaleX) ); + maDXAry[ i ] = FRound( maDXAry[ i ] * fabs(fScaleX) ); } } -void MetaTextArrayAction::SetDXArray(std::unique_ptr<tools::Long[]> aArray) +void MetaTextArrayAction::SetDXArray(std::vector<tools::Long> aArray) { - mpDXAry = std::move(aArray); + maDXAry = std::move(aArray); } MetaStretchTextAction::MetaStretchTextAction() : diff --git a/vcl/source/gdi/mtfxmldump.cxx b/vcl/source/gdi/mtfxmldump.cxx index a66de852d6ac..11c76ac5af5c 100644 --- a/vcl/source/gdi/mtfxmldump.cxx +++ b/vcl/source/gdi/mtfxmldump.cxx @@ -811,7 +811,7 @@ void MetafileXmlDump::writeXml(const GDIMetaFile& rMetaFile, tools::XmlWriter& r rWriter.attribute("index", aIndex); rWriter.attribute("length", aLength); - if (pMetaTextArrayAction->GetDXArray()) + if (!pMetaTextArrayAction->GetDXArray().empty()) { rWriter.startElement("dxarray"); OUStringBuffer sDxLengthString; diff --git a/vcl/source/gdi/pdfwriter.cxx b/vcl/source/gdi/pdfwriter.cxx index 40210eabcff3..2130b0fc30f7 100644 --- a/vcl/source/gdi/pdfwriter.cxx +++ b/vcl/source/gdi/pdfwriter.cxx @@ -81,7 +81,7 @@ void PDFWriter::DrawTextLine( void PDFWriter::DrawTextArray( const Point& rStartPt, const OUString& rStr, - const tools::Long* pDXAry, + o3tl::span<const tools::Long> pDXAry, sal_Int32 nIndex, sal_Int32 nLen ) { diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index a342cba1854d..ef77b6b691f6 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -6500,7 +6500,7 @@ void PDFWriterImpl::drawText( const Point& rPos, const OUString& rText, sal_Int3 } } -void PDFWriterImpl::drawTextArray( const Point& rPos, const OUString& rText, const tools::Long* pDXArray, sal_Int32 nIndex, sal_Int32 nLen ) +void PDFWriterImpl::drawTextArray( const Point& rPos, const OUString& rText, o3tl::span<const tools::Long> pDXArray, sal_Int32 nIndex, sal_Int32 nLen ) { MARK( "drawText with array" ); diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx index 8d1cc7310da3..8bce2a37ba8c 100644 --- a/vcl/source/gdi/pdfwriter_impl2.cxx +++ b/vcl/source/gdi/pdfwriter_impl2.cxx @@ -809,7 +809,7 @@ void PDFWriterImpl::playMetafile( const GDIMetaFile& i_rMtf, vcl::PDFExtOutDevDa case MetaActionType::TEXTARRAY: { const MetaTextArrayAction* pA = static_cast<const MetaTextArrayAction*>(pAction); - m_rOuterFace.DrawTextArray( pA->GetPoint(), pA->GetText(), pA->GetDXArray(), pA->GetIndex(), pA->GetLen() ); + m_rOuterFace.DrawTextArray( pA->GetPoint(), pA->GetText(), { pA->GetDXArray().data(), pA->GetDXArray().size() }, pA->GetIndex(), pA->GetLen() ); } break; diff --git a/vcl/source/gdi/textlayout.cxx b/vcl/source/gdi/textlayout.cxx index 738b6d460fcb..6fdd0d72ffb8 100644 --- a/vcl/source/gdi/textlayout.cxx +++ b/vcl/source/gdi/textlayout.cxx @@ -209,7 +209,7 @@ namespace vcl std::vector<tools::Long> aCharWidths; tools::Long nTextWidth = GetTextArray( _rText, &aCharWidths, _nStartIndex, _nLength ); - m_rTargetDevice.DrawTextArray( _rStartPoint, _rText, aCharWidths.data(), _nStartIndex, _nLength ); + m_rTargetDevice.DrawTextArray( _rStartPoint, _rText, { aCharWidths.data(), aCharWidths.size() }, _nStartIndex, _nLength ); m_aCompleteTextRect.Union( tools::Rectangle( _rStartPoint, Size( nTextWidth, m_rTargetDevice.GetTextHeight() ) ) ); } |