summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-01-15 11:14:53 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-01-17 10:16:35 +0200
commit9fc4f39ce85d429d35eed097c0433ce69a62d687 (patch)
treecb09cad87f836482c481357168889ea9d49f1679
parent724e6822241322975dbc18e2b77723a01ac13da9 (diff)
loplugin:useuniqueptr in TransparencyEmit
Change-Id: I7cc2d329cb6238c7933f087fd94d1409756512ff
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx9
-rw-r--r--vcl/source/gdi/pdfwriter_impl.hxx15
2 files changed, 8 insertions, 16 deletions
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 8c8868bf9d2f..2c8cb52bfc14 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -2283,8 +2283,7 @@ void PDFWriterImpl::endPage()
if( item.m_pContentStream )
{
writeTransparentObject(item);
- delete item.m_pContentStream;
- item.m_pContentStream = nullptr;
+ item.m_pContentStream.reset();
}
}
@@ -7760,7 +7759,7 @@ void PDFWriterImpl::drawTransparent( const tools::PolyPolygon& rPolyPoly, sal_uI
m_aTransparentObjects.back().m_nObject = createObject();
m_aTransparentObjects.back().m_nExtGStateObject = createObject();
m_aTransparentObjects.back().m_fAlpha = static_cast<double>(100-nTransparentPercent) / 100.0;
- m_aTransparentObjects.back().m_pContentStream = new SvMemoryStream( 256, 256 );
+ m_aTransparentObjects.back().m_pContentStream.reset(new SvMemoryStream( 256, 256 ));
// create XObject's content stream
OStringBuffer aContent( 256 );
m_aPages.back().appendPolyPolygon( rPolyPoly, aContent );
@@ -7904,7 +7903,7 @@ void PDFWriterImpl::endTransparencyGroup( const tools::Rectangle& rBoundingBox,
m_aTransparentObjects.back().m_nObject = createObject();
m_aTransparentObjects.back().m_fAlpha = static_cast<double>(100-nTransparentPercent) / 100.0;
// get XObject's content stream
- m_aTransparentObjects.back().m_pContentStream = static_cast<SvMemoryStream*>(endRedirect());
+ m_aTransparentObjects.back().m_pContentStream.reset( static_cast<SvMemoryStream*>(endRedirect()) );
m_aTransparentObjects.back().m_nExtGStateObject = createObject();
OStringBuffer aObjName( 16 );
@@ -8486,7 +8485,7 @@ void PDFWriterImpl::writeTransparentObject( TransparencyEmit& rObject )
{
CHECK_RETURN2( updateObject( rObject.m_nObject ) );
- bool bFlateFilter = compressStream( rObject.m_pContentStream );
+ bool bFlateFilter = compressStream( rObject.m_pContentStream.get() );
rObject.m_pContentStream->Seek( STREAM_SEEK_TO_END );
sal_uLong nSize = rObject.m_pContentStream->Tell();
rObject.m_pContentStream->Seek( STREAM_SEEK_TO_BEGIN );
diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx
index 002b2e4cb655..e8f477f2bc81 100644
--- a/vcl/source/gdi/pdfwriter_impl.hxx
+++ b/vcl/source/gdi/pdfwriter_impl.hxx
@@ -297,22 +297,15 @@ public:
sal_Int32 m_nObject;
sal_Int32 m_nExtGStateObject;
double m_fAlpha;
- tools::Rectangle m_aBoundRect;
- SvMemoryStream* m_pContentStream;
- SvMemoryStream* m_pSoftMaskStream;
+ tools::Rectangle m_aBoundRect;
+ std::unique_ptr<SvMemoryStream> m_pContentStream;
+ std::unique_ptr<SvMemoryStream> m_pSoftMaskStream;
TransparencyEmit()
: m_nObject( 0 ),
m_nExtGStateObject( -1 ),
- m_fAlpha( 0.0 ),
- m_pContentStream( nullptr ),
- m_pSoftMaskStream( nullptr )
+ m_fAlpha( 0.0 )
{}
- ~TransparencyEmit()
- {
- delete m_pContentStream;
- delete m_pSoftMaskStream;
- }
};
// font subsets