diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-08-21 11:14:39 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-08-21 11:14:39 (GMT) |
commit | 45a549dd8ad57bdd070d40a3d0606ab8429ceda6 (patch) | |
tree | 5f92a00a379c55f2409bb0d34186db77bf37afa6 | |
parent | cca06c0d740be179d5196ad7919253b7d52392ed (diff) | |
parent | f46cb7033fc3bfc17c4ccf9125d670810322a0f5 (diff) | |
download | Qt-45a549dd8ad57bdd070d40a3d0606ab8429ceda6.zip Qt-45a549dd8ad57bdd070d40a3d0606ab8429ceda6.tar.gz Qt-45a549dd8ad57bdd070d40a3d0606ab8429ceda6.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1:
bindTexture: Replace texture if painting is active on pixmap/image
-rw-r--r-- | src/opengl/qgl.cpp | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 1802107..51187cf 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -2287,11 +2287,19 @@ QImage QGLContextPrivate::convertToGLFormat(const QImage &image, bool force_prem QGLTexture *QGLContextPrivate::bindTexture(const QImage &image, GLenum target, GLint format, QGLContext::BindOptions options) { + Q_Q(QGLContext); + const qint64 key = image.cacheKey(); QGLTexture *texture = textureCacheLookup(key, target); if (texture) { - glBindTexture(target, texture->id); - return texture; + if (image.paintingActive()) { + // A QPainter is active on the image - take the safe route and replace the texture. + q->deleteTexture(texture->id); + texture = 0; + } else { + glBindTexture(target, texture->id); + return texture; + } } if (!texture) @@ -2557,14 +2565,19 @@ QGLTexture *QGLContextPrivate::bindTexture(const QPixmap &pixmap, GLenum target, } #else Q_UNUSED(pd); - Q_UNUSED(q); #endif const qint64 key = pixmap.cacheKey(); QGLTexture *texture = textureCacheLookup(key, target); if (texture) { - glBindTexture(target, texture->id); - return texture; + if (pixmap.paintingActive()) { + // A QPainter is active on the pixmap - take the safe route and replace the texture. + q->deleteTexture(texture->id); + texture = 0; + } else { + glBindTexture(target, texture->id); + return texture; + } } #if defined(Q_WS_X11) |