diff options
author | Johan Klokkhammer Helsing <johan.helsing@qt.io> | 2018-03-13 13:04:40 +0100 |
---|---|---|
committer | Johan Helsing <johan.helsing@qt.io> | 2018-03-19 08:23:54 +0000 |
commit | efa6e989125b3a9cf54a408aae8a86ef4bddf778 (patch) | |
tree | 8960e3999024da8e5d73a9439c470be6781e35b2 /src/gui/image/qpixmap_raster.cpp | |
parent | d3121e3888ae43a7dc074f5d8acc26b1973a7726 (diff) |
QPixmap don't assume QPlatformScreen::format is opaque
QRasterPlatformPixmap::systemOpaqueFormat returned QPlatformScreen::format
without checking that the format was actually opaque.
This caused several QPixmap tests to fail on Wayland because Wayland
compositors don't communicate the native format of the screen, just a list of
supported pixel formats, so we just return ARGB32_premultiplied in
QWaylandScreen::format().
Rename the method systemOpaqueFormat to systemNativeFormat since that's how
it's used most of the time. And do a conversion when we actually care whether
the format is opaque or not.
Task-number: QTBUG-51748
Change-Id: I47dc1c3f185fb802016ca361206d47d02e8d3cf1
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/gui/image/qpixmap_raster.cpp')
-rw-r--r-- | src/gui/image/qpixmap_raster.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/gui/image/qpixmap_raster.cpp b/src/gui/image/qpixmap_raster.cpp index 51b4309e0a..431002d032 100644 --- a/src/gui/image/qpixmap_raster.cpp +++ b/src/gui/image/qpixmap_raster.cpp @@ -89,7 +89,7 @@ QRasterPlatformPixmap::~QRasterPlatformPixmap() { } -QImage::Format QRasterPlatformPixmap::systemOpaqueFormat() +QImage::Format QRasterPlatformPixmap::systemNativeFormat() { if (!QGuiApplication::primaryScreen()) return QImage::Format_RGB32; @@ -107,7 +107,7 @@ void QRasterPlatformPixmap::resize(int width, int height) if (pixelType() == BitmapType) format = QImage::Format_MonoLSB; else - format = systemOpaqueFormat(); + format = systemNativeFormat(); image = QImage(width, height, format); w = width; @@ -314,8 +314,9 @@ void QRasterPlatformPixmap::createPixmapForImage(QImage sourceImage, Qt::ImageCo ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32; } else { - QImage::Format opaqueFormat = systemOpaqueFormat(); - QImage::Format alphaFormat = qt_alphaVersionForPainting(opaqueFormat); + QImage::Format nativeFormat = systemNativeFormat(); + QImage::Format opaqueFormat = qt_opaqueVersionForPainting(nativeFormat); + QImage::Format alphaFormat = qt_alphaVersionForPainting(nativeFormat); if (!sourceImage.hasAlphaChannel()) { format = opaqueFormat; |