Fix hidpi support for opengl window grabbing
Now set the QImage devicePixelRatio so the content is correct on all screens. Task-number: QTBUG-53795 Change-Id: Ic92eee98f691ebb1e0212498c1ae13ede74bca93 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This commit is contained in:
parent
944bf6867f
commit
07bd5a90a3
@ -528,7 +528,9 @@ QImage QOpenGLWindow::grabFramebuffer()
|
||||
return QImage();
|
||||
|
||||
makeCurrent();
|
||||
return qt_gl_read_framebuffer(size() * devicePixelRatio(), false, false);
|
||||
QImage img = qt_gl_read_framebuffer(size() * devicePixelRatio(), false, false);
|
||||
img.setDevicePixelRatio(devicePixelRatio());
|
||||
return img;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -381,6 +381,7 @@ static bool fuzzyComparePixels(const QRgb testPixel, const QRgb refPixel, const
|
||||
|
||||
static void fuzzyCompareImages(const QImage &testImage, const QImage &referenceImage, const char* file, int line)
|
||||
{
|
||||
QCOMPARE(testImage.devicePixelRatio(), referenceImage.devicePixelRatio());
|
||||
QCOMPARE(testImage.width(), referenceImage.width());
|
||||
QCOMPARE(testImage.height(), referenceImage.height());
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user