eglfs: Fix swapped red and blue with QOpenGLWidget

Change-Id: I0793d0b53c0e7df65fecfe43ef9daaf07413ea77
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
This commit is contained in:
Laszlo Agocs 2014-02-17 18:00:11 +01:00 committed by The Qt Project
parent 727f50d11e
commit 1e413e01e0

View File

@ -119,16 +119,21 @@ void QEGLCompositor::render(QEGLPlatformWindow *window)
glBindTexture(GL_TEXTURE_2D, textureId);
QMatrix4x4 target = QOpenGLTextureBlitter::targetTransform(textures->geometry(i),
targetWindowRect);
m_blitter->setSwizzleRB(window->isRaster());
if (textures->count() > 1 && i == textures->count() - 1) {
// Backingstore for a widget with QOpenGLWidget subwidgets
m_blitter->setSwizzleRB(true);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
m_blitter->blit(textureId, target, QOpenGLTextureBlitter::OriginTopLeft);
glDisable(GL_BLEND);
} else if (textures->count() == 1) {
// A regular QWidget window
m_blitter->setSwizzleRB(true);
m_blitter->blit(textureId, target, QOpenGLTextureBlitter::OriginTopLeft);
} else {
// Texture from an FBO belonging to a QOpenGLWidget
m_blitter->setSwizzleRB(false);
m_blitter->blit(textureId, target, QOpenGLTextureBlitter::OriginBottomLeft);
}
}