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 <eirik.aavitsland@theqtcompany.com>
This commit is contained in:
Tor Arne Vestbø 2015-06-26 12:45:35 +02:00
parent 5757b8c516
commit 2d1189d9f2

View File

@ -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) {