Support all QImage formats in native pixmap conversion
The conversion fallback did not catch all the more recently added QImage formats, leading to corrupt pixmaps or crashes. Also alpha channels were needlessly thrown away if present. Change-Id: I38588035aa9bf37b77398489981df65201cf0340 Reviewed-by: Jake Petroules <jake.petroules@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
parent
4f515815ef
commit
8ba373361d
@ -529,8 +529,11 @@ void QX11PlatformPixmap::fromImage(const QImage &img, Qt::ImageConversionFlags f
|
||||
}
|
||||
}
|
||||
|
||||
if (d == 1 || d == 16 || d == 24 || image.format() == QImage::Format_Grayscale8) {
|
||||
image = image.convertToFormat(QImage::Format_RGB32, flags);
|
||||
if (d == 1 || image.format() > QImage::Format_ARGB32_Premultiplied) {
|
||||
QImage::Format fmt = QImage::Format_RGB32;
|
||||
if (alphaCheck.hasXRenderAndAlpha() && d > 1)
|
||||
fmt = QImage::Format_ARGB32_Premultiplied;
|
||||
image = image.convertToFormat(fmt, flags);
|
||||
fromImage(image, Qt::AutoColor);
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user