summaryrefslogtreecommitdiffstats
path: root/src/gui/image/qpixmap_raster.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/image/qpixmap_raster.cpp')
-rw-r--r--src/gui/image/qpixmap_raster.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/gui/image/qpixmap_raster.cpp b/src/gui/image/qpixmap_raster.cpp
index 13104ce17f..741f7713da 100644
--- a/src/gui/image/qpixmap_raster.cpp
+++ b/src/gui/image/qpixmap_raster.cpp
@@ -42,7 +42,6 @@
#include <private/qfont_p.h>
#include "qpixmap_raster_p.h"
-#include "qnativeimage_p.h"
#include "qimage_p.h"
#include "qpaintengine.h"
@@ -50,9 +49,12 @@
#include "qimage.h"
#include <QBuffer>
#include <QImageReader>
+#include <QGuiApplication>
+#include <QScreen>
#include <private/qimage_p.h>
#include <private/qsimd_p.h>
#include <private/qdrawhelper_p.h>
+#include <qpa/qplatformscreen.h>
QT_BEGIN_NAMESPACE
@@ -88,6 +90,13 @@ QRasterPlatformPixmap::~QRasterPlatformPixmap()
{
}
+QImage::Format QRasterPlatformPixmap::systemOpaqueFormat()
+{
+ if (!QGuiApplication::primaryScreen())
+ return QImage::Format_RGB32;
+ return QGuiApplication::primaryScreen()->handle()->format();
+}
+
QPlatformPixmap *QRasterPlatformPixmap::createCompatiblePlatformPixmap() const
{
return new QRasterPlatformPixmap(pixelType());
@@ -99,7 +108,7 @@ void QRasterPlatformPixmap::resize(int width, int height)
if (pixelType() == BitmapType)
format = QImage::Format_MonoLSB;
else
- format = QNativeImage::systemFormat();
+ format = systemOpaqueFormat();
image = QImage(width, height, format);
w = width;
@@ -195,7 +204,7 @@ void QRasterPlatformPixmap::fill(const QColor &color)
}
pixel = qPremultiply(color.rgba());
const QPixelLayout *layout = &qPixelLayouts[image.format()];
- layout->convertFromARGB32PM(&pixel, &pixel, 1, layout, 0);
+ layout->convertFromARGB32PM(&pixel, &pixel, 1, 0, 0);
} else if (image.format() == QImage::Format_Alpha8) {
pixel = qAlpha(color.rgba());
} else if (image.format() == QImage::Format_Grayscale8) {
@@ -306,13 +315,13 @@ void QRasterPlatformPixmap::createPixmapForImage(QImage &sourceImage, Qt::ImageC
? QImage::Format_ARGB32_Premultiplied
: QImage::Format_RGB32;
} else {
- QImage::Format opaqueFormat = QNativeImage::systemFormat();
+ QImage::Format opaqueFormat = systemOpaqueFormat();
QImage::Format alphaFormat = qt_alphaVersionForPainting(opaqueFormat);
if (!sourceImage.hasAlphaChannel()) {
format = opaqueFormat;
} else if ((flags & Qt::NoOpaqueDetection) == 0
- && !const_cast<QImage &>(sourceImage).data_ptr()->checkForAlphaPixels())
+ && !sourceImage.data_ptr()->checkForAlphaPixels())
{
format = opaqueFormat;
} else {
@@ -335,7 +344,7 @@ void QRasterPlatformPixmap::createPixmapForImage(QImage &sourceImage, Qt::ImageC
} else if (inPlace && sourceImage.d->convertInPlace(format, flags)) {
image = sourceImage;
} else {
- image = sourceImage.convertToFormat(format);
+ image = sourceImage.convertToFormat(format, flags);
}
if (image.d) {