diff options
author | Morten Johan Sørvig <morten.sorvig@qt.io> | 2016-06-23 12:04:48 +0200 |
---|---|---|
committer | Morten Johan Sørvig <morten.sorvig@qt.io> | 2016-08-15 11:28:28 +0000 |
commit | a5e89005445ac8ca18ac046eaf55fe2230e47cd6 (patch) | |
tree | cc6122b32d0c14c0ed8314f0ed20960d65b68f44 | |
parent | bdc16cce7972cdd0bd02b58077a8dd465036632c (diff) |
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>
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoahelpers.mm | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.mm b/src/plugins/platforms/cocoa/qcocoahelpers.mm index 8601e222ec..6c6bc3e4eb 100644 --- a/src/plugins/platforms/cocoa/qcocoahelpers.mm +++ b/src/plugins/platforms/cocoa/qcocoahelpers.mm @@ -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); } |