summaryrefslogtreecommitdiffstats
path: root/tests/auto/other/lancelot/paintcommands.cpp
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2017-05-23 13:57:20 +0200
committerLiang Qi <liang.qi@qt.io>2017-05-31 18:53:57 +0000
commit32a94e54b58f311f37689f4bc8e0c8a54f0f9216 (patch)
treeebc56016f1f5eeacd2e82303fa691665c68dab59 /tests/auto/other/lancelot/paintcommands.cpp
parentc76b0c87b0cd9ba55dcb50eee0792592226672b3 (diff)
Do not always use argb32pm for subsurfaces
A number of drawing paths were never tested by lancelot because we always used argb32pm for subsurfaces. This patch switches the subsurfaces to use the painter format or its alpha version. This means changes to composition tests as it changes precision, especially of alpha in the a2rgb30 formats. Change-Id: I24d53bf6e1db8cca36bda69e2ddf07f20256b3c8 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Diffstat (limited to 'tests/auto/other/lancelot/paintcommands.cpp')
-rw-r--r--tests/auto/other/lancelot/paintcommands.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/auto/other/lancelot/paintcommands.cpp b/tests/auto/other/lancelot/paintcommands.cpp
index c28812e120..8419f93e3b 100644
--- a/tests/auto/other/lancelot/paintcommands.cpp
+++ b/tests/auto/other/lancelot/paintcommands.cpp
@@ -36,6 +36,7 @@
#include <qtextlayout.h>
#include <qdebug.h>
#include <QStaticText>
+#include <private/qimage_p.h>
#ifndef QT_NO_OPENGL
#include <QOpenGLFramebufferObjectFormat>
@@ -2402,7 +2403,13 @@ void PaintCommands::command_surface_begin(QRegExp re)
m_painter = new QPainter(&m_surface_pixmap);
#endif
} else {
- m_surface_image = QImage(qRound(w), qRound(h), QImage::Format_ARGB32_Premultiplied);
+ QImage::Format surface_format;
+ if (QImage::toPixelFormat(m_format).alphaUsage() != QPixelFormat::UsesAlpha)
+ surface_format = qt_alphaVersion(m_format);
+ else
+ surface_format = m_format;
+
+ m_surface_image = QImage(qRound(w), qRound(h), surface_format);
m_surface_image.fill(0);
m_painter = new QPainter(&m_surface_image);
}