Fix alpha blending regression with WA_StacksOnTop QOpenGLWidgets
0bc42886898 in Qt 5.6 introduced support for premultiplied alpha in the raster-rendered QWidget content. Unfortunately this introduced a regression for OpenGL content from QOpenGLWidgets with WA_StacksOnTop set: these used standard alpha blending in 5.5 and earlier, and switching them to premultiplied (in case the - unrelated - raster content has a _Premultiplied QImage format) breaks all content that was done with non-premultiplied alpha in mind, for example the qopenglwidget example's "Transparent background" checkbox. Restore the pre-5.6 behavior. Fixes: QTBUG-74285 Change-Id: I76fcadd53cd436efa2b619b8d6739270995d044f Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
This commit is contained in:
parent
387f120bf9
commit
28a264cfe2
@ -446,6 +446,11 @@ void QPlatformBackingStore::composeAndFlush(QWindow *window, const QRegion ®i
|
||||
d_ptr->blitter->setRedBlueSwizzle(false);
|
||||
}
|
||||
|
||||
// There is no way to tell if the OpenGL-rendered content is premultiplied or not.
|
||||
// For compatibility, assume that it is not, and use normal alpha blend always.
|
||||
if (d_ptr->premultiplied)
|
||||
funcs->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
|
||||
|
||||
// Textures for renderToTexture widgets that have WA_AlwaysStackOnTop set.
|
||||
for (int i = 0; i < textures->count(); ++i) {
|
||||
if (textures->flags(i).testFlag(QPlatformTextureList::StacksOnTop))
|
||||
|
Loading…
x
Reference in New Issue
Block a user