diff options
author | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2015-09-28 16:42:27 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2015-10-14 11:39:01 +0000 |
commit | bc6d32686cbec7e225999f19ba5fb149507c8dec (patch) | |
tree | adb325f7ce35258dc0fe74d15717f570aa08e5b2 /src/widgets | |
parent | e82e075e51db598c5a6fe4da399c2b1966a36110 (diff) |
QOpenGLWidget: Fix grabbing multisample framebuffers
Task-number: QTBUG-48450
Change-Id: I0a680e0d682c7c08c3aea40d922bbf2ad66c1de0
Reviewed-by: Joni Poikelin <joni.poikelin@theqtcompany.com>
Reviewed-by: Paul Olav Tvete <paul.tvete@theqtcompany.com>
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/kernel/qopenglwidget.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/widgets/kernel/qopenglwidget.cpp b/src/widgets/kernel/qopenglwidget.cpp index ee0543ceda..65a70ceb02 100644 --- a/src/widgets/kernel/qopenglwidget.cpp +++ b/src/widgets/kernel/qopenglwidget.cpp @@ -877,11 +877,22 @@ QImage QOpenGLWidgetPrivate::grabFramebuffer() if (!inPaintGL) render(); - resolveSamples(); - q->makeCurrent(); + if (resolvedFbo) { + resolveSamples(); + resolvedFbo->bind(); + } else { + q->makeCurrent(); + } + QImage res = qt_gl_read_framebuffer(q->size() * q->devicePixelRatioF(), false, false); res.setDevicePixelRatio(q->devicePixelRatioF()); + // While we give no guarantees of what is going to be left bound, prefer the + // multisample fbo instead of the resolved one. Clients may continue to + // render straight after calling this function. + if (resolvedFbo) + q->makeCurrent(); + return res; } |