From 9dd82fcebc50ca802e9e24a50283152e1dc35508 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Mon, 29 Jun 2009 12:09:37 +0200 Subject: Fixed some regressions in the OpenGL pixmap backend. Make sure a QPixmap gets an alpha channel when filled with a non-opaque color, and fix issues where shader manager did not active correct shader program. Reviewed-by: Tom --- src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 8 +++++--- src/opengl/qpixmapdata_gl.cpp | 9 ++++++++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index e24742f..4bf5d4c 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -656,7 +656,6 @@ void QGL2PaintEngineEx::sync() glActiveTexture(GL_TEXTURE0); d->needsSync = true; - d->shaderManager->setDirty(); } void QGL2PaintEngineExPrivate::transferMode(EngineMode newMode) @@ -834,7 +833,6 @@ bool QGL2PaintEngineExPrivate::prepareForDraw(bool srcPixelsAreOpaque) } shaderManager->setUseGlobalOpacity(useGlobalOpacityUniform); - bool changed = shaderManager->useCorrectShaderProg(); // If the shader program needs changing, we change it and mark all uniforms as dirty if (changed) { @@ -1182,7 +1180,9 @@ bool QGL2PaintEngineEx::begin(QPaintDevice *pdev) qt_resolve_version_2_0_functions(d->ctx); #endif - if (!d->shaderManager) { + if (d->shaderManager) { + d->shaderManager->setDirty(); + } else { d->shaderManager = new QGLEngineShaderManager(d->ctx); d->uniformIdentifiers[QGL2PaintEngineExPrivate::ImageTexture] = d->shaderManager->getUniformIdentifier("imageTexture"); @@ -1554,6 +1554,8 @@ void QGL2PaintEngineEx::setState(QPainterState *new_state) d->shaderMatrixUniformDirty = true; d->opacityUniformDirty = true; + d->shaderManager->setDirty(); + if (old_state && old_state != s && old_state->canRestoreClip) { d->updateDepthScissorTest(); glDepthMask(false); diff --git a/src/opengl/qpixmapdata_gl.cpp b/src/opengl/qpixmapdata_gl.cpp index 8a2187c..f0c7e20 100644 --- a/src/opengl/qpixmapdata_gl.cpp +++ b/src/opengl/qpixmapdata_gl.cpp @@ -254,8 +254,15 @@ void QGLPixmapData::fill(const QColor &color) if (!isValid()) return; - if (!m_textureId) + bool hasAlpha = color.alpha() != 255; + if (hasAlpha && !m_hasAlpha) { + if (m_textureId) { + glDeleteTextures(1, &m_textureId); + m_textureId = 0; + m_dirty = true; + } m_hasAlpha = color.alpha() != 255; + } if (useFramebufferObjects()) { m_source = QImage(); -- cgit v0.12