diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-05-27 15:21:58 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-05-27 20:02:00 +0200 |
commit | fd7787b6f0f082db320ebe7b29fc5333587b5d2e (patch) | |
tree | 39d639228b8b0fcd215cbf91e18251aea45041d4 /vcl | |
parent | 832f04d1f78e54bb84c641c11cf90aa2f953fc17 (diff) |
no need to allocate these on the heap
Change-Id: I0740f7194c589d6949a816f365cd54403be72118
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116260
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/gdi/impanmvw.cxx | 8 | ||||
-rw-r--r-- | vcl/source/treelist/transfer.cxx | 16 |
2 files changed, 14 insertions, 10 deletions
diff --git a/vcl/source/gdi/impanmvw.cxx b/vcl/source/gdi/impanmvw.cxx index b7329c073ef1..5757d3d36e5c 100644 --- a/vcl/source/gdi/impanmvw.cxx +++ b/vcl/source/gdi/impanmvw.cxx @@ -151,7 +151,9 @@ void ImplAnimView::drawToPos( sal_uLong nPos ) } ScopedVclPtrInstance<VirtualDevice> aVDev; - std::unique_ptr<vcl::Region> xOldClip(!maClip.IsNull() ? new vcl::Region( pRenderContext->GetClipRegion() ) : nullptr); + std::optional<vcl::Region> xOldClip; + if (!maClip.IsNull()) + xOldClip = pRenderContext->GetClipRegion(); aVDev->SetOutputSizePixel( maSzPix, false ); nPos = std::min( nPos, static_cast<sal_uLong>(mpParent->Count()) - 1 ); @@ -270,7 +272,9 @@ void ImplAnimView::draw( sal_uLong nPos, VirtualDevice* pVDev ) if( !pVDev ) { - std::unique_ptr<vcl::Region> xOldClip(!maClip.IsNull() ? new vcl::Region( pRenderContext->GetClipRegion() ) : nullptr); + std::optional<vcl::Region> xOldClip; + if (!maClip.IsNull()) + xOldClip = pRenderContext->GetClipRegion(); if (xOldClip) pRenderContext->SetClipRegion( maClip ); diff --git a/vcl/source/treelist/transfer.cxx b/vcl/source/treelist/transfer.cxx index 5f57a7ff07b6..a917973e1122 100644 --- a/vcl/source/treelist/transfer.cxx +++ b/vcl/source/treelist/transfer.cxx @@ -332,11 +332,11 @@ Any SAL_CALL TransferableHelper::getTransferData2( const DataFlavor& rFlavor, co if( maAny >>= aSeq ) { - std::unique_ptr<SvMemoryStream> pSrcStm(new SvMemoryStream( aSeq.getArray(), aSeq.getLength(), StreamMode::WRITE | StreamMode::TRUNC )); GDIMetaFile aMtf; - - ReadGDIMetaFile( *pSrcStm, aMtf ); - pSrcStm.reset(); + { + SvMemoryStream aSrcStm( aSeq.getArray(), aSeq.getLength(), StreamMode::WRITE | StreamMode::TRUNC ); + ReadGDIMetaFile( aSrcStm, aMtf ); + } Graphic aGraphic( aMtf ); SvMemoryStream aDstStm( 65535, 65535 ); @@ -362,11 +362,11 @@ Any SAL_CALL TransferableHelper::getTransferData2( const DataFlavor& rFlavor, co if( maAny >>= aSeq ) { - std::unique_ptr<SvMemoryStream> pSrcStm(new SvMemoryStream( aSeq.getArray(), aSeq.getLength(), StreamMode::WRITE | StreamMode::TRUNC )); GDIMetaFile aMtf; - - ReadGDIMetaFile( *pSrcStm, aMtf ); - pSrcStm.reset(); + { + SvMemoryStream aSrcStm( aSeq.getArray(), aSeq.getLength(), StreamMode::WRITE | StreamMode::TRUNC ); + ReadGDIMetaFile( aSrcStm, aMtf ); + } SvMemoryStream aDstStm( 65535, 65535 ); |