From 004f25df78160d1caba2375fb2e6511a0c344bc8 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Tue, 21 May 2013 18:22:27 +0200 Subject: QGLWidget: Support retina framebuffer grabbing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit And update the opengl/grabber example. Task-number: QTBUG-31173 Change-Id: If09f1f3634b353d034f51240fc68be6ee7aabb48 Reviewed-by: Samuel Rødal Reviewed-by: Gunnar Sletta --- src/opengl/qgl.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/opengl') diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index def0470622..72c6e035d9 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -4090,11 +4090,12 @@ QImage QGLWidget::grabFrameBuffer(bool withAlpha) { makeCurrent(); QImage res; - int w = width(); - int h = height(); + qreal pixelRatio = devicePixelRatio(); + int w = pixelRatio * width(); + int h = pixelRatio * height(); if (format().rgba()) res = qt_gl_read_frame_buffer(QSize(w, h), format().alpha(), withAlpha); - + res.setDevicePixelRatio(pixelRatio); return res; } -- cgit v1.2.3