QGLWidget: Support retina framebuffer grabbing
And update the opengl/grabber example. Task-number: QTBUG-31173 Change-Id: If09f1f3634b353d034f51240fc68be6ee7aabb48 Reviewed-by: Samuel Rødal <samuel.rodal@digia.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
This commit is contained in:
parent
602bd98737
commit
004f25df78
@ -175,7 +175,7 @@ QSlider *MainWindow::createSlider(const char *changedSignal,
|
||||
void MainWindow::setPixmap(const QPixmap &pixmap)
|
||||
{
|
||||
pixmapLabel->setPixmap(pixmap);
|
||||
QSize size = pixmap.size();
|
||||
QSize size = pixmap.size() / pixmap.devicePixelRatio();
|
||||
if (size - QSize(1, 0) == pixmapLabelArea->maximumViewportSize())
|
||||
size -= QSize(1, 0);
|
||||
pixmapLabel->resize(size);
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user