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>
This commit is contained in:
parent
04c42d2d09
commit
eb5ef33122
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user