Kaydet (Commit) 6d0d6a87 authored tarafından Noel Grandin's avatar Noel Grandin Kaydeden (comit) Noel Grandin

loplugin:useuniqueptr in QuartzSalBitmap::CreateColorMask

Change-Id: I7fbebf3730aa79209a3ad954522ad8695e5d8c24
Reviewed-on: https://gerrit.libreoffice.org/60704
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 97c934d9
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment