diff options
authorTor Arne Vestbø <>2015-06-26 12:45:35 +0200
committerTor Arne Vestbø <>2015-06-26 10:55:40 +0000
commit2d1189d9f281f1f78abed1a47939a4e2b5e747d7 (patch)
parent5757b8c516ad0d613739b222687583bca914a981 (diff)
lance: Ensure that OpenGL FBO is cleared before being used as surface
Merely filling with Qt::transparent is not enough, as the default blend mode of QPainter is QPainter::CompositionMode_SourceOver, where the alpha of the source is used to blend the pixel on top of the destination. The destination in the case of an FBO may contain garbage, and we end up with the same garbage as the alpha is 0. This was evident when running the ellipses and porter_duff/porter_duff2 tests on OS X. These tests can now be un-blacklisted. Change-Id: I315fa764fa29fb3a06e38945a738a6feadf4502d Reviewed-by: aavit <>
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/auto/other/lancelot/paintcommands.cpp b/tests/auto/other/lancelot/paintcommands.cpp
index caca0f2ebd..4fc41fd649 100644
--- a/tests/auto/other/lancelot/paintcommands.cpp
+++ b/tests/auto/other/lancelot/paintcommands.cpp
@@ -2383,7 +2383,10 @@ void PaintCommands::command_surface_begin(QRegExp re)
m_surface_glpaintdevice = new QOpenGLPaintDevice(qRound(w), qRound(h));
m_painter = new QPainter(m_surface_glpaintdevice);
+ m_painter->save();
+ m_painter->setCompositionMode(QPainter::CompositionMode_Clear);
m_painter->fillRect(QRect(0, 0, qRound(w), qRound(h)), Qt::transparent);
+ m_painter->restore();
} else if (m_type == WidgetType) {