summaryrefslogtreecommitdiffstats
path: root/src/opengl
diff options
context:
space:
mode:
authorSamuel Rødal <sroedal@trolltech.com>2009-09-01 14:09:29 +0200
committerSamuel Rødal <sroedal@trolltech.com>2009-09-01 14:26:14 +0200
commitae2f5c66d16fab9f92f960435057d955e9a832ef (patch)
treec76615e7f9a9292d0d129de3b532c9fac39ab653 /src/opengl
parentd0b4bd21d5fc04febdfdb41111435d79750e5ff6 (diff)
Fixed QGLFramebufferObject::toImage() releasing the FBO if bound.
Reviewed-by: Trond
Diffstat (limited to 'src/opengl')
-rw-r--r--src/opengl/qglframebufferobject.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp
index 965965487e..859afc7332 100644
--- a/src/opengl/qglframebufferobject.cpp
+++ b/src/opengl/qglframebufferobject.cpp
@@ -875,9 +875,12 @@ QImage QGLFramebufferObject::toImage() const
if (!d->valid)
return QImage();
- const_cast<QGLFramebufferObject *>(this)->bind();
+ bool wasBound = isBound();
+ if (!wasBound)
+ const_cast<QGLFramebufferObject *>(this)->bind();
QImage image = qt_gl_read_framebuffer(d->size, d->ctx->format().alpha(), true);
- const_cast<QGLFramebufferObject *>(this)->release();
+ if (!wasBound)
+ const_cast<QGLFramebufferObject *>(this)->release();
return image;
}