summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEirik Aavitsland <[email protected]>2022-07-01 18:23:08 +0200
committerEirik Aavitsland <[email protected]>2022-07-12 09:02:38 +0200
commit9e453dacc3855bafd3d7b692d76699c3bf07b9c6 (patch)
tree71572e131f4095713e1dac45d61da9d35d6e7df0
parentf344f3d58e4814f4d64f837fe6f4237f0eb0556d (diff)
Fix printing of dpr>1 images on Windows
The win32 printing paint engine copies tiles of the source image into temporary target images for printing. It does that using QPainter painting. If there is a difference in DPR between source and target, the painting will be scaled, leading to distorted results. Fixes: QTBUG-99990 Pick-to: 6.4 6.3 6.2 5.15 Change-Id: Ie7368655ef3abeece49fb1a6421e2d6ea7ed5e95 Reviewed-by: AndrĂ© de la Rocha <[email protected]>
-rw-r--r--src/printsupport/platform/windows/qprintengine_win.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/printsupport/platform/windows/qprintengine_win.cpp b/src/printsupport/platform/windows/qprintengine_win.cpp
index d6dd5eae5ca..cd3e03d88e3 100644
--- a/src/printsupport/platform/windows/qprintengine_win.cpp
+++ b/src/printsupport/platform/windows/qprintengine_win.cpp
@@ -563,6 +563,7 @@ void QWin32PrintEngine::drawPixmap(const QRectF &targetRect,
QImage img(QSize(imgw, imgh), QImage::Format_RGB32);
img.fill(Qt::white);
QPainter painter(&img);
+ img.setDevicePixelRatio(pixmap.devicePixelRatio());
painter.drawPixmap(0,0, pixmap, tileSize * x, tileSize * y, imgw, imgh);
QPixmap p = QPixmap::fromImage(img);