use QImage::Format_ARGB32_Premultiplied image format for raster pixmaps unless pixel type is bitmap

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2022-03-01 13:02:03 +02:00
parent 73619d7898
commit 5f61f29f3c

View file

@ -50,11 +50,10 @@ QPixmapData *QRasterPixmapData::createCompatiblePixmapData() const
void QRasterPixmapData::resize(int width, int height) void QRasterPixmapData::resize(int width, int height)
{ {
QImage::Format format; QImage::Format format = QImage::Format_ARGB32_Premultiplied;
if (pixelType() == BitmapType) if (pixelType() == BitmapType) {
format = QImage::Format_MonoLSB; format = QImage::Format_MonoLSB;
else }
format = QImage::systemFormat();
image = QImage(width, height, format); image = QImage(width, height, format);
w = width; w = width;
@ -89,8 +88,6 @@ void QRasterPixmapData::fromImage(const QImage &sourceImage,
QImage::Format format = QImage::Format_ARGB32_Premultiplied; QImage::Format format = QImage::Format_ARGB32_Premultiplied;
if (pixelType() == BitmapType) { if (pixelType() == BitmapType) {
format = QImage::Format_MonoLSB; format = QImage::Format_MonoLSB;
} else if ((flags & Qt::NoOpaqueDetection) == 0 && !sourceImage.d->checkForAlphaPixels()) {
format = QImage::systemFormat();
} }
image = sourceImage.convertToFormat(format); image = sourceImage.convertToFormat(format);