summaryrefslogtreecommitdiffstats
path: root/src/opengl/qglframebufferobject.cpp
diff options
context:
space:
mode:
authorSamuel Rødal <sroedal@trolltech.com>2009-09-01 12:09:29 (GMT)
committerSamuel Rødal <sroedal@trolltech.com>2009-09-01 12:26:14 (GMT)
commitae2f5c66d16fab9f92f960435057d955e9a832ef (patch)
treec76615e7f9a9292d0d129de3b532c9fac39ab653 /src/opengl/qglframebufferobject.cpp
parentd0b4bd21d5fc04febdfdb41111435d79750e5ff6 (diff)
downloadQt-ae2f5c66d16fab9f92f960435057d955e9a832ef.zip
Qt-ae2f5c66d16fab9f92f960435057d955e9a832ef.tar.gz
Qt-ae2f5c66d16fab9f92f960435057d955e9a832ef.tar.bz2
Fixed QGLFramebufferObject::toImage() releasing the FBO if bound.
Reviewed-by: Trond
Diffstat (limited to 'src/opengl/qglframebufferobject.cpp')
-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 9659654..859afc7 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;
}