diff options
author | Samuel Rødal <sroedal@trolltech.com> | 2009-06-29 10:09:37 (GMT) |
---|---|---|
committer | Samuel Rødal <sroedal@trolltech.com> | 2009-06-29 12:12:49 (GMT) |
commit | 9dd82fcebc50ca802e9e24a50283152e1dc35508 (patch) | |
tree | ff3a62bf1d1bc078fdf617da5d460790c81becf8 /src/opengl | |
parent | b14a08fd363defbff255b31b8d5482959dc53b4d (diff) | |
download | Qt-9dd82fcebc50ca802e9e24a50283152e1dc35508.zip Qt-9dd82fcebc50ca802e9e24a50283152e1dc35508.tar.gz Qt-9dd82fcebc50ca802e9e24a50283152e1dc35508.tar.bz2 |
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
Diffstat (limited to 'src/opengl')
-rw-r--r-- | src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 8 | ||||
-rw-r--r-- | 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(); |