[Libreoffice-commits] core.git: vcl/quartz
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Thu Sep 20 06:19:36 UTC 2018
vcl/quartz/salbmp.cxx | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
New commits:
commit 6d0d6a875867c823603f5947f7a035601042f903
Author: Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Sat Sep 15 21:18:22 2018 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Sep 20 08:19:13 2018 +0200
loplugin:useuniqueptr in QuartzSalBitmap::CreateColorMask
Change-Id: I7fbebf3730aa79209a3ad954522ad8695e5d8c24
Reviewed-on: https://gerrit.libreoffice.org/60704
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/vcl/quartz/salbmp.cxx b/vcl/quartz/salbmp.cxx
index e8df35c712bf..b46a7f174168 100644
--- a/vcl/quartz/salbmp.cxx
+++ b/vcl/quartz/salbmp.cxx
@@ -937,8 +937,8 @@ CGImageRef QuartzSalBitmap::CreateColorMask( int nX, int nY, int nWidth,
if (m_pUserBuffer.get() && (nX + nWidth <= mnWidth) && (nY + nHeight <= mnHeight))
{
const sal_uInt32 nDestBytesPerRow = nWidth << 2;
- sal_uInt32* pMaskBuffer = static_cast<sal_uInt32*>( std::malloc( nHeight * nDestBytesPerRow ) );
- sal_uInt32* pDest = pMaskBuffer;
+ std::unique_ptr<sal_uInt32[]> pMaskBuffer(new (std::nothrow) sal_uInt32[ nHeight * nDestBytesPerRow / 4] );
+ sal_uInt32* pDest = pMaskBuffer.get();
ImplPixelFormat* pSourcePixels = ImplPixelFormat::GetFormat( mnBits, maPalette );
@@ -967,15 +967,11 @@ CGImageRef QuartzSalBitmap::CreateColorMask( int nX, int nY, int nWidth,
pSource += mnBytesPerRow;
}
- CGDataProviderRef xDataProvider( CGDataProviderCreateWithData(nullptr, pMaskBuffer, nHeight * nDestBytesPerRow, &CFRTLFree) );
+ CGDataProviderRef xDataProvider( CGDataProviderCreateWithData(nullptr, pMaskBuffer.release(), nHeight * nDestBytesPerRow, &CFRTLFree) );
xMask = CGImageCreate(nWidth, nHeight, 8, 32, nDestBytesPerRow, GetSalData()->mxRGBSpace, kCGImageAlphaPremultipliedFirst, xDataProvider, nullptr, true, kCGRenderingIntentDefault);
SAL_INFO("vcl.cg", "CGImageCreate(" << nWidth << "x" << nHeight << "x8) = " << xMask );
CFRelease(xDataProvider);
}
- else
- {
- free(pMaskBuffer);
- }
delete pSourcePixels;
}
More information about the Libreoffice-commits
mailing list