From 5f61f29f3c7262688c70f56e00428dbddddcd24e Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Tue, 1 Mar 2022 13:02:03 +0200 Subject: [PATCH] use QImage::Format_ARGB32_Premultiplied image format for raster pixmaps unless pixel type is bitmap Signed-off-by: Ivailo Monev --- src/gui/image/qpixmap_raster.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/gui/image/qpixmap_raster.cpp b/src/gui/image/qpixmap_raster.cpp index 83a50bb2f..d2a5c1131 100644 --- a/src/gui/image/qpixmap_raster.cpp +++ b/src/gui/image/qpixmap_raster.cpp @@ -50,11 +50,10 @@ QPixmapData *QRasterPixmapData::createCompatiblePixmapData() const void QRasterPixmapData::resize(int width, int height) { - QImage::Format format; - if (pixelType() == BitmapType) + QImage::Format format = QImage::Format_ARGB32_Premultiplied; + if (pixelType() == BitmapType) { format = QImage::Format_MonoLSB; - else - format = QImage::systemFormat(); + } image = QImage(width, height, format); w = width; @@ -89,8 +88,6 @@ void QRasterPixmapData::fromImage(const QImage &sourceImage, QImage::Format format = QImage::Format_ARGB32_Premultiplied; if (pixelType() == BitmapType) { format = QImage::Format_MonoLSB; - } else if ((flags & Qt::NoOpaqueDetection) == 0 && !sourceImage.d->checkForAlphaPixels()) { - format = QImage::systemFormat(); } image = sourceImage.convertToFormat(format);