Cocoa: Make qt_mac_toCGImageMask be self contained

Remove qt_mac_deleteImage and qt_mac_toCGImageMask
which are not used elsewhere.

Change-Id: Idd3177d4c521eea318b58dc664efe6907896d022
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
This commit is contained in:
Morten Johan Sørvig 2016-06-23 12:04:48 +02:00
parent bdc16cce79
commit a5e8900544

View File

@ -111,23 +111,13 @@ CGImageRef qt_mac_toCGImage(const QImage &inImage)
return inImage.convertToFormat(QImage::Format_ARGB32_Premultiplied).toCGImage();
}
static void qt_mac_deleteImage(void *image, const void *, size_t)
{
delete static_cast<QImage *>(image);
}
// Creates a CGDataProvider with the data from the given image.
// The data provider retains a copy of the image.
CGDataProviderRef qt_mac_CGDataProvider(const QImage &image)
{
return CGDataProviderCreateWithData(new QImage(image), image.bits(),
image.byteCount(), qt_mac_deleteImage);
}
CGImageRef qt_mac_toCGImageMask(const QImage &image)
{
QCFType<CGDataProviderRef> dataProvider = qt_mac_CGDataProvider(image);
static const auto deleter = [](void *image, const void *, size_t) { delete static_cast<QImage *>(image); };
QCFType<CGDataProviderRef> dataProvider =
CGDataProviderCreateWithData(new QImage(image), image.bits(),
image.byteCount(), deleter);
return CGImageMaskCreate(image.width(), image.height(), 8, image.depth(),
image.bytesPerLine(), dataProvider, NULL, false);
}