DocPage Organizer: fixing paint bug

This commit is contained in:
Jakub Melka 2021-07-26 20:21:36 +02:00
parent 7cc02ae51c
commit 97151df84c

View File

@ -174,12 +174,13 @@ QPixmap PageItemDelegate::getPageImagePixmap(const PageGroupItem* item, QRect re
{ {
QRect drawRect(QPoint(0, 0), rect.size()); QRect drawRect(QPoint(0, 0), rect.size());
QRect mediaBox(QPoint(0, 0), image.size()); QRect mediaBox(QPoint(0, 0), image.size());
QMatrix matrix = pdf::PDFRenderer::createMediaBoxToDevicePointMatrix(mediaBox, drawRect, groupItem.pageAdditionalRotation); QRectF rotatedMediaBox = pdf::PDFPage::getRotatedBox(mediaBox, groupItem.pageAdditionalRotation);
QMatrix matrix = pdf::PDFRenderer::createMediaBoxToDevicePointMatrix(rotatedMediaBox, drawRect, groupItem.pageAdditionalRotation);
QPainter painter(&pixmap); QPainter painter(&pixmap);
painter.setWorldMatrixEnabled(true); painter.setWorldMatrixEnabled(true);
painter.setWorldMatrix(matrix); painter.setWorldMatrix(matrix);
painter.translate(0, mediaBox.height()); painter.translate(0, image.height());
painter.scale(1.0, -1.0); painter.scale(1.0, -1.0);
painter.drawImage(0, 0, image); painter.drawImage(0, 0, image);
} }