summaryrefslogtreecommitdiff
path: root/vcl/source/gdi/salmisc.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-04-23 14:56:15 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-04-25 10:24:25 +0200
commit2351701d533c4b489d633b9602930be57caff801 (patch)
treea5eea9c0614be792a9bb29099d3a0147e02b28df /vcl/source/gdi/salmisc.cxx
parent7c9d8afd913c17100aa4185e3b044137f225c81f (diff)
loplugin:useuniqueptr pass BitmapBuffer around via std::unique_ptr
Change-Id: I0a20e7d3816714e42d6863fff27734dd08ae24ae Reviewed-on: https://gerrit.libreoffice.org/53357 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl/source/gdi/salmisc.cxx')
-rw-r--r--vcl/source/gdi/salmisc.cxx10
1 files changed, 2 insertions, 8 deletions
diff --git a/vcl/source/gdi/salmisc.cxx b/vcl/source/gdi/salmisc.cxx
index 6b2b8755e2b7..15fef5272b9b 100644
--- a/vcl/source/gdi/salmisc.cxx
+++ b/vcl/source/gdi/salmisc.cxx
@@ -259,13 +259,13 @@ static void ImplTCToPAL( const BitmapBuffer& rSrcBuffer, BitmapBuffer const & rD
}
}
-BitmapBuffer* StretchAndConvert(
+std::unique_ptr<BitmapBuffer> StretchAndConvert(
const BitmapBuffer& rSrcBuffer, const SalTwoRect& rTwoRect,
ScanlineFormat nDstBitmapFormat, const BitmapPalette* pDstPal, const ColorMask* pDstMask )
{
FncGetPixel pFncGetPixel;
FncSetPixel pFncSetPixel;
- BitmapBuffer* pDstBuffer = new BitmapBuffer;
+ std::unique_ptr<BitmapBuffer> pDstBuffer(new BitmapBuffer);
// set function for getting pixels
switch( RemoveScanline( rSrcBuffer.mnFormat ) )
@@ -335,7 +335,6 @@ BitmapBuffer* StretchAndConvert(
{
SAL_WARN("vcl.gdi", "checked multiply failed");
pDstBuffer->mpBits = nullptr;
- delete pDstBuffer;
return nullptr;
}
pDstBuffer->mnScanlineSize = AlignedWidth4Bytes(nScanlineBase);
@@ -343,7 +342,6 @@ BitmapBuffer* StretchAndConvert(
{
SAL_WARN("vcl.gdi", "scanline calculation wraparound");
pDstBuffer->mpBits = nullptr;
- delete pDstBuffer;
return nullptr;
}
try
@@ -354,7 +352,6 @@ BitmapBuffer* StretchAndConvert(
{
// memory exception, clean up
pDstBuffer->mpBits = nullptr;
- delete pDstBuffer;
return nullptr;
}
@@ -368,7 +365,6 @@ BitmapBuffer* StretchAndConvert(
assert(pDstPal && "destination buffer requires palette");
if (!pDstPal)
{
- delete pDstBuffer;
return nullptr;
}
pDstBuffer->maPalette = *pDstPal;
@@ -381,7 +377,6 @@ BitmapBuffer* StretchAndConvert(
assert(pDstMask && "destination buffer requires color mask");
if (!pDstMask)
{
- delete pDstBuffer;
return nullptr;
}
pDstBuffer->maColorMask = *pDstMask;
@@ -409,7 +404,6 @@ BitmapBuffer* StretchAndConvert(
// memory exception, clean up
// remark: the buffer ptr causing the exception
// is still NULL here
- delete pDstBuffer;
return nullptr;
}