summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@digia.com>2014-08-07 13:47:21 +0200
committerAllan Sandfeld Jensen <allan.jensen@digia.com>2014-08-16 09:50:01 +0200
commiteb5ef3312260479ada82e6463e7ec3a8b6245e7f (patch)
treed99d2e1f1a1678e12890eae02575c1c82f50b837 /src/plugins/platforms/cocoa
parent04c42d2d0957a6b85034ea76e2bbc0551b3b3af4 (diff)
Handle 10-bit per color formats in qt_mac_toCGImage
Add support for the four new RGB30 formats to qt_mac_toCGImage so that they get converted to ARGB32_Premultiplied instead of potentially misinterpreted. Change-Id: I0921edaef7509c1db9bd547b454dade03d289ea3 Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
Diffstat (limited to 'src/plugins/platforms/cocoa')
-rw-r--r--src/plugins/platforms/cocoa/qcocoahelpers.mm11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.mm b/src/plugins/platforms/cocoa/qcocoahelpers.mm
index e3916ea787..894c2c1168 100644
--- a/src/plugins/platforms/cocoa/qcocoahelpers.mm
+++ b/src/plugins/platforms/cocoa/qcocoahelpers.mm
@@ -97,13 +97,10 @@ CGImageRef qt_mac_toCGImage(const QImage &inImage)
if (inImage.isNull())
return 0;
- QImage image = (inImage.depth() == 32) ? inImage : inImage.convertToFormat(QImage::Format_ARGB32_Premultiplied);
+ QImage image = inImage;
uint cgflags = kCGImageAlphaNone;
switch (image.format()) {
- case QImage::Format_ARGB32_Premultiplied:
- cgflags = kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host;
- break;
case QImage::Format_ARGB32:
cgflags = kCGImageAlphaFirst | kCGBitmapByteOrder32Host;
break;
@@ -123,7 +120,11 @@ CGImageRef qt_mac_toCGImage(const QImage &inImage)
cgflags = kCGImageAlphaNoneSkipLast | kCGBitmapByteOrder32Big;
break;
default:
- Q_ASSERT(false); // Should never be reached.
+ // Everything not recognized explicitly is converted to ARGB32_Premultiplied.
+ image = inImage.convertToFormat(QImage::Format_ARGB32_Premultiplied);
+ // no break;
+ case QImage::Format_ARGB32_Premultiplied:
+ cgflags = kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host;
break;
}