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
Change-Id: Ie7368655ef3abeece49fb1a6421e2d6ea7ed5e95
Reviewed-by: André de la Rocha <andre.rocha@qt.io>
(cherry picked from commit 9e453dacc3855bafd3d7b692d76699c3bf07b9c6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Eirik Aavitsland 2022-07-01 18:23:08 +02:00 committed by Qt Cherry-pick Bot
parent 6dbb5d3e45
commit 15830162f5

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