diff options
-rw-r--r-- | src/gui/kernel/qopenglwindow.cpp | 4 | ||||
-rw-r--r-- | tests/auto/gui/qopengl/tst_qopengl.cpp | 1 |
2 files changed, 4 insertions, 1 deletions
diff --git a/src/gui/kernel/qopenglwindow.cpp b/src/gui/kernel/qopenglwindow.cpp index e1bd3d11b2..5170c7ab63 100644 --- a/src/gui/kernel/qopenglwindow.cpp +++ b/src/gui/kernel/qopenglwindow.cpp @@ -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; } /*! diff --git a/tests/auto/gui/qopengl/tst_qopengl.cpp b/tests/auto/gui/qopengl/tst_qopengl.cpp index 44921f68aa..4cdd8202e9 100644 --- a/tests/auto/gui/qopengl/tst_qopengl.cpp +++ b/tests/auto/gui/qopengl/tst_qopengl.cpp @@ -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()); |