diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2020-01-28 03:03:51 +0100 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2020-01-28 03:03:52 +0100 |
commit | 69175cddec56c681b7873d6145cc29e461f1d8b1 (patch) | |
tree | bbf9b694b368ccc1d92d86aec9531eabcd9636ea | |
parent | 20befe6f00c84934a7ab9e9c27c8ac85cd0dac1d (diff) | |
parent | 89045a973568a5750670db7340f2f58d478f78d0 (diff) | |
download | qtsvg-69175cddec56c681b7873d6145cc29e461f1d8b1.tar.gz |
Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: I987599c388f414928aabf6a193a8250c27f4f60d
-rw-r--r-- | dist/changes-5.14.1 | 28 | ||||
-rw-r--r-- | src/svg/qsvgtinydocument.cpp | 15 | ||||
-rw-r--r-- | tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp | 3 |
3 files changed, 39 insertions, 7 deletions
diff --git a/dist/changes-5.14.1 b/dist/changes-5.14.1 new file mode 100644 index 0000000..093098c --- /dev/null +++ b/dist/changes-5.14.1 @@ -0,0 +1,28 @@ +Qt 5.14.1 is a bug-fix release. It maintains both forward and backward +compatibility (source and binary) with Qt 5.14.0. + +For more details, refer to the online documentation included in this +distribution. The documentation is also available online: + +https://doc.qt.io/qt-5/index.html + +The Qt version 5.14 series is binary compatible with the 5.13.x series. +Applications compiled for 5.13 will continue to run with 5.14. + +Some of the changes listed in this file include issue tracking numbers +corresponding to tasks in the Qt Bug Tracker: + +https://bugreports.qt.io/ + +Each of these identifiers can be entered in the bug tracker to obtain more +information about a particular change. + +**************************************************************************** +* QSVGRenderer * +**************************************************************************** + + - In Qt 5.14.0, rendering would keep aspect ratio implied by the + viewbox, independently of the specified target area. This caused + many regressions with existing code, so is reverted now in + 5.14.1. The feature will instead be available as an opt-in in Qt + 5.15. diff --git a/src/svg/qsvgtinydocument.cpp b/src/svg/qsvgtinydocument.cpp index eb6b6b0..8f6aac1 100644 --- a/src/svg/qsvgtinydocument.cpp +++ b/src/svg/qsvgtinydocument.cpp @@ -421,10 +421,10 @@ void QSvgTinyDocument::mapSourceToTarget(QPainter *p, const QRectF &targetRect, source = viewBox(); if (source != target && !source.isNull()) { - if (m_implicitViewBox || !sourceRect.isNull() || !targetRect.isNull()) { - // Code path used when no view box is set, or when an explicit source size is given which - // overrides it (which is the case when we're rendering only a specific element by id), - // or when user has given explicit target bounds that overrides viebox aspect ratio +#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)) + if (m_implicitViewBox || !preserveAspectRatio()) { + // Code path used when no view box is set, or IgnoreAspectRatio requested +#endif QTransform transform; transform.scale(target.width() / source.width(), target.height() / source.height()); @@ -433,10 +433,10 @@ void QSvgTinyDocument::mapSourceToTarget(QPainter *p, const QRectF &targetRect, target.y() - c2.y()); p->scale(target.width() / source.width(), target.height() / source.height()); +#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)) } else { - // Code path used when a view box is specified and we're not rendering a specific element by id - // but the entire document. This attempts to emulate the default values of the <preserveAspectRatio> - // tag that's implicitly defined when <viewbox> is used. + // Code path used when KeepAspectRatio is requested. This attempts to emulate the default values + // of the <preserveAspectRatio tag that's implicitly defined when <viewbox> is used. // Scale the view box into the view port (target) by preserve the aspect ratio. QSizeF viewBoxSize = source.size(); @@ -452,6 +452,7 @@ void QSvgTinyDocument::mapSourceToTarget(QPainter *p, const QRectF &targetRect, // Apply the view box translation if specified. p->translate(-source.x(), -source.y()); } +#endif } } diff --git a/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp b/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp index 4a4a287..14cb473 100644 --- a/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp +++ b/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp @@ -270,6 +270,8 @@ void tst_QSvgRenderer::testMapViewBoxToTarget() QCOMPARE(picture.boundingRect(), QRect(125, 125, 250, 250)); } +#if 0 + // Requires keep-aspectratio feature { // Viewport and viewBox specified -> scale 500x500 square to 1000x750 while preserving aspect ratio gives 750x750 data = "<svg width=\"1000\" height=\"750\" viewBox=\"-250 -250 500 500\"><g><rect x=\"0\" y=\"0\" width=\"500\" height=\"500\" /></g></svg>"; QPicture picture; @@ -279,6 +281,7 @@ void tst_QSvgRenderer::testMapViewBoxToTarget() painter.end(); QCOMPARE(picture.boundingRect(), QRect(500, 375, 750, 750)); } +#endif } void tst_QSvgRenderer::testRenderElement() |