summaryrefslogtreecommitdiffstats
path: root/src/opengl
diff options
context:
space:
mode:
authorAndreas Kling <andreas.kling@nokia.com>2010-08-21 03:40:37 (GMT)
committerAndreas Kling <andreas.kling@nokia.com>2010-08-21 11:01:36 (GMT)
commitf46cb7033fc3bfc17c4ccf9125d670810322a0f5 (patch)
tree5f92a00a379c55f2409bb0d34186db77bf37afa6 /src/opengl
parentcca06c0d740be179d5196ad7919253b7d52392ed (diff)
downloadQt-f46cb7033fc3bfc17c4ccf9125d670810322a0f5.zip
Qt-f46cb7033fc3bfc17c4ccf9125d670810322a0f5.tar.gz
Qt-f46cb7033fc3bfc17c4ccf9125d670810322a0f5.tar.bz2
bindTexture: Replace texture if painting is active on pixmap/image
This fixes an issue with WebKit canvases not updating after the first frame since there's always a QPainter open on their backing store. Reviewed-by: Samuel Rødal
Diffstat (limited to 'src/opengl')
-rw-r--r--src/opengl/qgl.cpp23
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)