summaryrefslogtreecommitdiffstats
path: root/src/plugins/imageformats/pdf
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2020-02-21 11:38:27 +0100
committerShawn Rutledge <shawn.rutledge@qt.io>2020-02-21 11:40:49 +0100
commitd9349a299f66fb154ad24f410451872a7ca253fb (patch)
tree2e8258ef3679707a2a9245c85bc8490251b3e256 /src/plugins/imageformats/pdf
parent50bc8b124705c33c5e27f035b1eab756e14247ba (diff)
parentc0aa9d794378846e4cc0b6fe94f2765bc31cefdd (diff)
Merge remote-tracking branch 'origin/wip/qtpdf' into 5.15v5.15.0-beta1
The feature set is mostly in place (except for some known shortcomings) and we need the merge to build it on iOS. Task-number: QTBUG-69519 Change-Id: Ib1ac82a9a7e0830d98d1c4327a1b15d4d7f4d4c1
Diffstat (limited to 'src/plugins/imageformats/pdf')
-rw-r--r--src/plugins/imageformats/pdf/qpdfiohandler.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/plugins/imageformats/pdf/qpdfiohandler.cpp b/src/plugins/imageformats/pdf/qpdfiohandler.cpp
index 9df85cf08..739e8b34c 100644
--- a/src/plugins/imageformats/pdf/qpdfiohandler.cpp
+++ b/src/plugins/imageformats/pdf/qpdfiohandler.cpp
@@ -98,7 +98,8 @@ bool QPdfIOHandler::read(QImage *image)
if (m_page < 0)
m_page = 0;
const bool xform = (m_clipRect.isValid() || m_scaledSize.isValid() || m_scaledClipRect.isValid());
- QSize finalSize = m_doc.pageSize(m_page).toSize();
+ QSize pageSize = m_doc.pageSize(m_page).toSize();
+ QSize finalSize = pageSize;
QRectF bounds;
if (xform && !finalSize.isEmpty()) {
bounds = QRectF(QPointF(0,0), QSizeF(finalSize));
@@ -112,6 +113,7 @@ bool QPdfIOHandler::read(QImage *image)
sc = QSizeF(qreal(m_scaledSize.width()) / finalSize.width(),
qreal(m_scaledSize.height()) / finalSize.height());
finalSize = m_scaledSize;
+ pageSize = m_scaledSize;
}
if (m_scaledClipRect.isValid()) {
tr2 = -m_scaledClipRect.topLeft();
@@ -133,9 +135,13 @@ bool QPdfIOHandler::read(QImage *image)
}
}
if (!finalSize.isEmpty()) {
+ QPdfDocumentRenderOptions options;
+ if (m_scaledClipRect.isValid())
+ options.setScaledClipRect(m_scaledClipRect);
+ options.setScaledSize(pageSize);
image->fill(m_backColor.rgba());
QPainter p(image);
- QImage pageImage = m_doc.render(m_page, finalSize);
+ QImage pageImage = m_doc.render(m_page, finalSize, options);
p.drawImage(0, 0, pageImage);
p.end();
}