summaryrefslogtreecommitdiff
path: root/vcl/win
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/win
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/win')
-rw-r--r--vcl/win/gdi/salbmp.cxx22
1 files changed, 11 insertions, 11 deletions
diff --git a/vcl/win/gdi/salbmp.cxx b/vcl/win/gdi/salbmp.cxx
index d9a3603a9ea8..9e001429abb1 100644
--- a/vcl/win/gdi/salbmp.cxx
+++ b/vcl/win/gdi/salbmp.cxx
@@ -266,7 +266,7 @@ Gdiplus::Bitmap* WinSalBitmap::ImplCreateGdiPlusBitmap()
}
BitmapBuffer* pRGB = pSalRGB->AcquireBuffer(BitmapAccessMode::Read);
- BitmapBuffer* pExtraRGB = nullptr;
+ std::unique_ptr<BitmapBuffer> pExtraRGB;
if(pRGB && ScanlineFormat::N24BitTcBgr != (pRGB->mnFormat & ~ScanlineFormat::TopDown))
{
@@ -278,7 +278,7 @@ Gdiplus::Bitmap* WinSalBitmap::ImplCreateGdiPlusBitmap()
ScanlineFormat::N24BitTcBgr);
pSalRGB->ReleaseBuffer(pRGB, BitmapAccessMode::Write);
- pRGB = pExtraRGB;
+ pRGB = pExtraRGB.get();
}
if(pRGB
@@ -322,9 +322,9 @@ Gdiplus::Bitmap* WinSalBitmap::ImplCreateGdiPlusBitmap()
if(pExtraRGB)
{
// #i123478# shockingly, BitmapBuffer does not free the memory it is controlling
- // in its destructor, this *has to be done handish*. Doing it here now
+ // in its destructor, this *has to be done by hand*. Doing it here now
delete[] pExtraRGB->mpBits;
- delete pExtraRGB;
+ pExtraRGB.reset();
}
else
{
@@ -354,7 +354,7 @@ Gdiplus::Bitmap* WinSalBitmap::ImplCreateGdiPlusBitmap(const WinSalBitmap& rAlph
}
BitmapBuffer* pRGB = pSalRGB->AcquireBuffer(BitmapAccessMode::Read);
- BitmapBuffer* pExtraRGB = nullptr;
+ std::unique_ptr<BitmapBuffer> pExtraRGB;
if(pRGB && ScanlineFormat::N24BitTcBgr != (pRGB->mnFormat & ~ScanlineFormat::TopDown))
{
@@ -366,7 +366,7 @@ Gdiplus::Bitmap* WinSalBitmap::ImplCreateGdiPlusBitmap(const WinSalBitmap& rAlph
ScanlineFormat::N24BitTcBgr);
pSalRGB->ReleaseBuffer(pRGB, BitmapAccessMode::Read);
- pRGB = pExtraRGB;
+ pRGB = pExtraRGB.get();
}
WinSalBitmap* pSalA = const_cast< WinSalBitmap* >(&rAlphaSource);
@@ -381,7 +381,7 @@ Gdiplus::Bitmap* WinSalBitmap::ImplCreateGdiPlusBitmap(const WinSalBitmap& rAlph
}
BitmapBuffer* pA = pSalA->AcquireBuffer(BitmapAccessMode::Read);
- BitmapBuffer* pExtraA = nullptr;
+ std::unique_ptr<BitmapBuffer> pExtraA;
if(pA && ScanlineFormat::N8BitPal != (pA->mnFormat & ~ScanlineFormat::TopDown))
{
@@ -396,7 +396,7 @@ Gdiplus::Bitmap* WinSalBitmap::ImplCreateGdiPlusBitmap(const WinSalBitmap& rAlph
&rTargetPalette);
pSalA->ReleaseBuffer(pA, BitmapAccessMode::Read);
- pA = pExtraA;
+ pA = pExtraA.get();
}
if(pRGB
@@ -458,7 +458,7 @@ Gdiplus::Bitmap* WinSalBitmap::ImplCreateGdiPlusBitmap(const WinSalBitmap& rAlph
// #i123478# shockingly, BitmapBuffer does not free the memory it is controlling
// in its destructor, this *has to be done handish*. Doing it here now
delete[] pExtraA->mpBits;
- delete pExtraA;
+ pExtraA.reset();
}
else
{
@@ -473,9 +473,9 @@ Gdiplus::Bitmap* WinSalBitmap::ImplCreateGdiPlusBitmap(const WinSalBitmap& rAlph
if(pExtraRGB)
{
// #i123478# shockingly, BitmapBuffer does not free the memory it is controlling
- // in its destructor, this *has to be done handish*. Doing it here now
+ // in its destructor, this *has to be done by hand*. Doing it here now
delete[] pExtraRGB->mpBits;
- delete pExtraRGB;
+ pExtraRGB.reset();
}
else
{