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 <andre.rocha@qt.io>
This commit is contained in:
Eirik Aavitsland 2022-07-01 18:23:08 +02:00
parent f344f3d58e
commit 9e453dacc3

View File

@ -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);