diff options
author | Tobias Hunger <tobias.hunger@qt.io> | 2019-04-16 16:32:08 +0200 |
---|---|---|
committer | Tobias Hunger <tobias.hunger@qt.io> | 2019-04-16 16:32:08 +0200 |
commit | 6630937e63ae5797487b86743a7733c8ae5cc42c (patch) | |
tree | 3d53dacf6430f9099e1fb20835881205de674961 /src/gui/image/qimage_darwin.mm | |
parent | 37ed6dae00640f9cc980ffda05347c12a7eb5d7e (diff) | |
parent | c7af193d2e49e9f10b86262e63d8d13abf72b5cf (diff) |
Merge commit 'dev' into 'wip/cmake-merge'
Change-Id: I176c40d031be26a1dd1cf08843e448a660598783
Diffstat (limited to 'src/gui/image/qimage_darwin.mm')
-rw-r--r-- | src/gui/image/qimage_darwin.mm | 29 |
1 files changed, 4 insertions, 25 deletions
diff --git a/src/gui/image/qimage_darwin.mm b/src/gui/image/qimage_darwin.mm index a5c391ad21..7ca1a0869a 100644 --- a/src/gui/image/qimage_darwin.mm +++ b/src/gui/image/qimage_darwin.mm @@ -40,6 +40,7 @@ #include "qimage.h" #include <private/qcore_mac_p.h> +#include <private/qcoregraphics_p.h> #import <Foundation/Foundation.h> #import <CoreGraphics/CoreGraphics.h> @@ -98,32 +99,10 @@ CGImageRef QImage::toCGImage() const if (isNull()) return nil; - // Determine the target native format - uint cgflags = kCGImageAlphaNone; - switch (format()) { - case QImage::Format_ARGB32: - cgflags = kCGImageAlphaFirst | kCGBitmapByteOrder32Host; - break; - case QImage::Format_RGB32: - cgflags = kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Host; - break; - case QImage::Format_RGBA8888_Premultiplied: - cgflags = kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big; - break; - case QImage::Format_RGBA8888: - cgflags = kCGImageAlphaLast | kCGBitmapByteOrder32Big; - break; - case QImage::Format_RGBX8888: - cgflags = kCGImageAlphaNoneSkipLast | kCGBitmapByteOrder32Big; - break; - case QImage::Format_ARGB32_Premultiplied: - cgflags = kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host; - break; - default: break; - } + CGBitmapInfo bitmapInfo = qt_mac_bitmapInfoForImage(*this); // Format not supported: return nil CGImageRef - if (cgflags == kCGImageAlphaNone) + if (bitmapInfo == kCGImageAlphaNone) return nil; // Create a data provider that owns a copy of the QImage and references the image data. @@ -140,7 +119,7 @@ CGImageRef QImage::toCGImage() const const bool shouldInterpolate = false; return CGImageCreate(width(), height(), bitsPerComponent, bitsPerPixel, - this->bytesPerLine(), colorSpace, cgflags, dataProvider, + this->bytesPerLine(), colorSpace, bitmapInfo, dataProvider, decode, shouldInterpolate, kCGRenderingIntentDefault); } |