diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-04-23 14:56:15 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-04-25 10:24:25 +0200 |
commit | 2351701d533c4b489d633b9602930be57caff801 (patch) | |
tree | a5eea9c0614be792a9bb29099d3a0147e02b28df /vcl/headless/svpgdi.cxx | |
parent | 7c9d8afd913c17100aa4185e3b044137f225c81f (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/headless/svpgdi.cxx')
-rw-r--r-- | vcl/headless/svpgdi.cxx | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx index 7543bc69c760..9a3e9247659c 100644 --- a/vcl/headless/svpgdi.cxx +++ b/vcl/headless/svpgdi.cxx @@ -134,7 +134,7 @@ namespace } } - BitmapBuffer* FastConvert24BitRgbTo32BitCairo(const BitmapBuffer* pSrc) + std::unique_ptr<BitmapBuffer> FastConvert24BitRgbTo32BitCairo(const BitmapBuffer* pSrc) { if (pSrc == nullptr) return nullptr; @@ -142,7 +142,7 @@ namespace assert(pSrc->mnFormat == SVP_24BIT_FORMAT); const long nWidth = pSrc->mnWidth; const long nHeight = pSrc->mnHeight; - BitmapBuffer* pDst = new BitmapBuffer; + std::unique_ptr<BitmapBuffer> pDst(new BitmapBuffer); pDst->mnFormat = (ScanlineFormat::N32BitTcArgb | ScanlineFormat::TopDown); pDst->mnWidth = nWidth; pDst->mnHeight = nHeight; @@ -156,7 +156,6 @@ namespace { SAL_WARN("vcl.gdi", "checked multiply failed"); pDst->mpBits = nullptr; - delete pDst; return nullptr; } @@ -165,7 +164,6 @@ namespace { SAL_WARN("vcl.gdi", "scanline calculation wraparound"); pDst->mpBits = nullptr; - delete pDst; return nullptr; } @@ -177,7 +175,6 @@ namespace { // memory exception, clean up pDst->mpBits = nullptr; - delete pDst; return nullptr; } @@ -242,10 +239,10 @@ namespace const BitmapBuffer* pSrc = rSrcBmp.GetBuffer(); const SalTwoRect aTwoRect = { 0, 0, pSrc->mnWidth, pSrc->mnHeight, 0, 0, pSrc->mnWidth, pSrc->mnHeight }; - BitmapBuffer* pTmp = (pSrc->mnFormat == SVP_24BIT_FORMAT + std::unique_ptr<BitmapBuffer> pTmp = (pSrc->mnFormat == SVP_24BIT_FORMAT ? FastConvert24BitRgbTo32BitCairo(pSrc) : StretchAndConvert(*pSrc, aTwoRect, SVP_CAIRO_FORMAT)); - aTmpBmp.Create(pTmp); + aTmpBmp.Create(std::move(pTmp)); assert(aTmpBmp.GetBitCount() == 32); source = SvpSalGraphics::createCairoSurface(aTmpBmp.GetBuffer()); |