diff options
author | Morten Johan Sørvig <morten.sorvig@digia.com> | 2013-12-10 10:02:51 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-02-25 16:00:03 +0100 |
commit | f2ade01f4c0c33e070d89b473b4c0037aed9e7f3 (patch) | |
tree | 62c12f156c5d3aefed089a24e7dbcc45f34443e9 /src/plugins/platforms/cocoa/qcocoahelpers.h | |
parent | 51572d3d8f85f8836c25d1f793e69b170672cc3c (diff) |
Cocoa: QImage -> CGImage conversion cleanup
Move to one qt_mac_toCGImage function that has simple
semantics and properly retains a copy of the QImage
for the lifetime of the CGImage.
Remove the old qt_mac_toCGImage function which had
two problems:
1) It would not retain the QImage data (this was probably
ok for its original use case: creating short-lived
CGImages for the paint engine)
2) It had acquired a somewhat odd **datacopy out
parameter for the cases where you _do_ want to retain
the image data.
This makes the exported image conversion function
from QtMacExtras work: The CGImages it creates will
no longer reference free'd memory once the QImage
is deleted.
Change-Id: I583040d16aefb17fc3d801d6b047a0b2a76c7f74
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoahelpers.h')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoahelpers.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.h b/src/plugins/platforms/cocoa/qcocoahelpers.h index 419bf631aa..893aa4408a 100644 --- a/src/plugins/platforms/cocoa/qcocoahelpers.h +++ b/src/plugins/platforms/cocoa/qcocoahelpers.h @@ -68,10 +68,12 @@ void *qt_mac_QStringListToNSMutableArrayVoid(const QStringList &list); inline NSMutableArray *qt_mac_QStringListToNSMutableArray(const QStringList &qstrlist) { return reinterpret_cast<NSMutableArray *>(qt_mac_QStringListToNSMutableArrayVoid(qstrlist)); } -CGImageRef qt_mac_image_to_cgimage(const QImage &image); NSImage *qt_mac_cgimage_to_nsimage(CGImageRef iamge); NSImage *qt_mac_create_nsimage(const QPixmap &pm); NSImage *qt_mac_create_nsimage(const QIcon &icon); +CGImageRef qt_mac_toCGImage(const QImage &qImage); +CGImageRef qt_mac_toCGImageMask(const QImage &qImage); +QImage qt_mac_toQImage(CGImageRef image); NSSize qt_mac_toNSSize(const QSize &qtSize); NSRect qt_mac_toNSRect(const QRect &rect); @@ -159,8 +161,6 @@ public: }; CGContextRef qt_mac_cg_context(QPaintDevice *pdev); -CGImageRef qt_mac_toCGImage(const QImage &qImage, bool isMask, uchar **dataCopy); -QImage qt_mac_toQImage(CGImageRef image); template<typename T> T qt_mac_resolveOption(const T &fallback, const QByteArray &environment) |