From 2d1189d9f281f1f78abed1a47939a4e2b5e747d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 26 Jun 2015 12:45:35 +0200 Subject: 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 --- tests/auto/other/lancelot/paintcommands.cpp | 3 +++ 1 file changed, 3 insertions(+) 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_glbuffer->bind(); 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(); #endif #ifdef Q_DEAD_CODE_FROM_QT4_X11 } else if (m_type == WidgetType) { -- cgit v1.2.3