forked from pool/libqt5-qtsvg
Accepting request 743230 from home:Vogtinator:qt5.14
Qt 5.14.0 Beta 2 OBS-URL: https://build.opensuse.org/request/show/743230 OBS-URL: https://build.opensuse.org/package/show/KDE:Qt:5.14/libqt5-qtsvg?expand=0&rev=3
This commit is contained in:
116
0001-Revert-Fix-rendering-of-SVGs-with-viewBoxes.patch
Normal file
116
0001-Revert-Fix-rendering-of-SVGs-with-viewBoxes.patch
Normal file
@@ -0,0 +1,116 @@
|
||||
From df10b8b84ca1b94f7b0e493ca460d2ee7eeefdf7 Mon Sep 17 00:00:00 2001
|
||||
From: Fabian Vogt <fvogt@suse.de>
|
||||
Date: Thu, 24 Oct 2019 15:19:56 +0200
|
||||
Subject: [PATCH] Revert "Fix rendering of SVGs with viewBoxes"
|
||||
|
||||
This reverts commit 14fa4591eb34a35cf3d485fd901e3f1e2caa7770.
|
||||
---
|
||||
src/svg/qsvgtinydocument.cpp | 38 +++++---------------
|
||||
src/svg/qsvgtinydocument_p.h | 5 +--
|
||||
tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp | 10 ------
|
||||
3 files changed, 9 insertions(+), 44 deletions(-)
|
||||
|
||||
diff --git a/src/svg/qsvgtinydocument.cpp b/src/svg/qsvgtinydocument.cpp
|
||||
index 3143ad2..b9e2d82 100644
|
||||
--- a/src/svg/qsvgtinydocument.cpp
|
||||
+++ b/src/svg/qsvgtinydocument.cpp
|
||||
@@ -338,7 +338,6 @@ void QSvgTinyDocument::setHeight(int len, bool percent)
|
||||
void QSvgTinyDocument::setViewBox(const QRectF &rect)
|
||||
{
|
||||
m_viewBox = rect;
|
||||
- m_implicitViewBox = false;
|
||||
}
|
||||
|
||||
void QSvgTinyDocument::addSvgFont(QSvgFont *font)
|
||||
@@ -420,35 +419,14 @@ void QSvgTinyDocument::mapSourceToTarget(QPainter *p, const QRectF &targetRect,
|
||||
source = viewBox();
|
||||
|
||||
if (source != target && !source.isNull()) {
|
||||
- if (m_implicitViewBox) {
|
||||
- QTransform transform;
|
||||
- transform.scale(target.width() / source.width(),
|
||||
- target.height() / source.height());
|
||||
- QRectF c2 = transform.mapRect(source);
|
||||
- p->translate(target.x() - c2.x(),
|
||||
- target.y() - c2.y());
|
||||
- p->scale(target.width() / source.width(),
|
||||
- target.height() / source.height());
|
||||
- } 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.
|
||||
-
|
||||
- // Apply the view box translation if specified.
|
||||
- p->translate(target.x() - source.x(),
|
||||
- target.y() - source.y());
|
||||
-
|
||||
- // Scale the view box into the view port (target) by preserve the aspect ratio.
|
||||
- QSizeF viewBoxSize = source.size();
|
||||
- viewBoxSize.scale(target.width(), target.height(), Qt::KeepAspectRatio);
|
||||
-
|
||||
- // Center the view box in the view port
|
||||
- p->translate((target.width() - viewBoxSize.width()) / 2,
|
||||
- (target.height() - viewBoxSize.height()) / 2);
|
||||
-
|
||||
- p->scale(viewBoxSize.width() / source.width(),
|
||||
- viewBoxSize.height() / source.height());
|
||||
- }
|
||||
+ QTransform transform;
|
||||
+ transform.scale(target.width() / source.width(),
|
||||
+ target.height() / source.height());
|
||||
+ QRectF c2 = transform.mapRect(source);
|
||||
+ p->translate(target.x() - c2.x(),
|
||||
+ target.y() - c2.y());
|
||||
+ p->scale(target.width() / source.width(),
|
||||
+ target.height() / source.height());
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/src/svg/qsvgtinydocument_p.h b/src/svg/qsvgtinydocument_p.h
|
||||
index 404587d..4babb9f 100644
|
||||
--- a/src/svg/qsvgtinydocument_p.h
|
||||
+++ b/src/svg/qsvgtinydocument_p.h
|
||||
@@ -125,7 +125,6 @@ private:
|
||||
bool m_widthPercent;
|
||||
bool m_heightPercent;
|
||||
|
||||
- mutable bool m_implicitViewBox = true;
|
||||
mutable QRectF m_viewBox;
|
||||
|
||||
QHash<QString, QSvgRefCounter<QSvgFont> > m_fonts;
|
||||
@@ -174,10 +173,8 @@ inline bool QSvgTinyDocument::heightPercent() const
|
||||
|
||||
inline QRectF QSvgTinyDocument::viewBox() const
|
||||
{
|
||||
- if (m_viewBox.isNull()) {
|
||||
+ if (m_viewBox.isNull())
|
||||
m_viewBox = transformedBounds();
|
||||
- m_implicitViewBox = true;
|
||||
- }
|
||||
|
||||
return m_viewBox;
|
||||
}
|
||||
diff --git a/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp b/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp
|
||||
index cf19213..e0646f2 100644
|
||||
--- a/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp
|
||||
+++ b/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp
|
||||
@@ -268,16 +268,6 @@ void tst_QSvgRenderer::testMapViewBoxToTarget()
|
||||
QCOMPARE(picture.boundingRect(), QRect(125, 125, 250, 250));
|
||||
}
|
||||
|
||||
- { // Viewport and viewBox specified -> scale 500x500 square to 1000x750 while preserving aspect ratio gives 750x750
|
||||
- // however the box is centered at 375, 250
|
||||
- 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;
|
||||
- QPainter painter(&picture);
|
||||
- QSvgRenderer rend(data);
|
||||
- rend.render(&painter);
|
||||
- painter.end();
|
||||
- QCOMPARE(picture.boundingRect(), QRect(375, 250, 750, 750));
|
||||
- }
|
||||
}
|
||||
|
||||
void tst_QSvgRenderer::testRenderElement()
|
||||
--
|
||||
2.23.0
|
||||
|
@@ -1,3 +1,19 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Oct 24 13:23:05 UTC 2019 - Fabian Vogt <fabian@ritter-vogt.de>
|
||||
|
||||
- Update to 5.14.0-beta2:
|
||||
* New bugfix release
|
||||
* No changelog available
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Oct 15 12:34:51 UTC 2019 - Fabian Vogt <fabian@ritter-vogt.de>
|
||||
|
||||
- Update to 5.14.0-beta1:
|
||||
* New bugfix release
|
||||
* No changelog available
|
||||
- Add patch to avoid regression (QTBUG-78200):
|
||||
* 0001-Revert-Fix-rendering-of-SVGs-with-viewBoxes.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Sep 30 13:30:36 UTC 2019 - Fabian Vogt <fabian@ritter-vogt.de>
|
||||
|
||||
|
@@ -21,18 +21,20 @@
|
||||
%define libname libQt5Svg5
|
||||
|
||||
Name: libqt5-qtsvg
|
||||
Version: 5.14.0~alpha
|
||||
Version: 5.14.0~beta2
|
||||
Release: 0
|
||||
Summary: Qt 5 SVG Library
|
||||
License: LGPL-2.1-with-Qt-Company-Qt-exception-1.1 or LGPL-3.0-only
|
||||
Group: Development/Libraries/X11
|
||||
Url: https://www.qt.io
|
||||
%define base_name libqt5
|
||||
%define real_version 5.14.0-alpha
|
||||
%define real_version 5.14.0-beta2
|
||||
%define so_version 5.14.0
|
||||
%define tar_version qtsvg-everywhere-src-5.14.0-alpha
|
||||
%define tar_version qtsvg-everywhere-src-5.14.0-beta2
|
||||
Source: https://download.qt.io/development_releases/qt/5.14/%{real_version}/submodules/%{tar_version}.tar.xz
|
||||
Source1: baselibs.conf
|
||||
# PATCH-FIX-OPENSUSE
|
||||
Patch1: 0001-Revert-Fix-rendering-of-SVGs-with-viewBoxes.patch
|
||||
BuildRequires: libQt5Core-private-headers-devel >= %{version}
|
||||
BuildRequires: libQt5Gui-private-headers-devel >= %{version}
|
||||
BuildRequires: libQt5Widgets-private-headers-devel >= %{version}
|
||||
@@ -50,7 +52,7 @@ The Qt SVG module provides functionality for displaying SVG images
|
||||
as a widget, and to create SVG files using drawing commands.
|
||||
|
||||
%prep
|
||||
%setup -q -n %{tar_version}
|
||||
%autosetup -p1 -n %{tar_version}
|
||||
|
||||
%package -n %libname
|
||||
Summary: Qt 5 SVG Library
|
||||
|
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:044d691b2d883f70f1628df1aaa1ff9a8cfd3e4f42940f904af78680995237e6
|
||||
size 1884024
|
3
qtsvg-everywhere-src-5.14.0-beta2.tar.xz
Normal file
3
qtsvg-everywhere-src-5.14.0-beta2.tar.xz
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:301dc67a1d7c4457baf42c1544637ac4167b60f5fe212160fa606b3973d17465
|
||||
size 1892408
|
Reference in New Issue
Block a user