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>
This commit is contained in:
Laszlo Agocs 2015-09-28 16:42:27 +02:00
parent e82e075e51
commit bc6d32686c

View File

@ -877,11 +877,22 @@ QImage QOpenGLWidgetPrivate::grabFramebuffer()
if (!inPaintGL)
render();
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;
}