From bdcd7a97449502f92069d36196cc81064b1c02a0 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Tue, 22 Aug 2017 15:35:16 +0200 Subject: Remove inaccurate statement about using setSize() from the documentation Change-Id: I9a18a0cfc86411336cbf29e0b7fb2f77f704d284 Reviewed-by: Eirik Aavitsland --- src/svg/qgraphicssvgitem.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src') diff --git a/src/svg/qgraphicssvgitem.cpp b/src/svg/qgraphicssvgitem.cpp index f6b7c74..fe6e92e 100644 --- a/src/svg/qgraphicssvgitem.cpp +++ b/src/svg/qgraphicssvgitem.cpp @@ -123,9 +123,7 @@ public: \snippet src_svg_qgraphicssvgitem.cpp 0 - Size of the item can be set via the \l{QRectF::setSize()} - {setSize()} method of the \l{QGraphicsSvgItem::boundingRect()} - {bounding rectangle} or via direct manipulation of the items + Size of the item can be set via direct manipulation of the items transformation matrix. By default the SVG rendering is cached using QGraphicsItem::DeviceCoordinateCache -- cgit v1.2.1 From b839a0c2c483b59e3797f35aa1a81f3a3d072f72 Mon Sep 17 00:00:00 2001 From: Ales Erjavec Date: Tue, 12 Sep 2017 19:42:36 +0200 Subject: Return correct PdmDevicePixelRatioScaled metric QSvgGenerator::metric returned incorrect value for `PdmDevicePixelRatioScaled` resulting in degenerate `devicePixelRatioF()` return value. [ChangeLog][][QSvgGenerator] Report correct devicePixelRatioF Task-number: QTBUG-63159 Change-Id: Ib45e930b6b1b6d85aea5a68dd2b1b5f16a4eed3b Reviewed-by: Eirik Aavitsland --- src/svg/qsvggenerator.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/svg/qsvggenerator.cpp b/src/svg/qsvggenerator.cpp index 3f4e545..d294eb2 100644 --- a/src/svg/qsvggenerator.cpp +++ b/src/svg/qsvggenerator.cpp @@ -856,8 +856,9 @@ int QSvgGenerator::metric(QPaintDevice::PaintDeviceMetric metric) const case QPaintDevice::PdmPhysicalDpiY: return d->engine->resolution(); case QPaintDevice::PdmDevicePixelRatio: - case QPaintDevice::PdmDevicePixelRatioScaled: return 1; + case QPaintDevice::PdmDevicePixelRatioScaled: + return 1 * QPaintDevice::devicePixelRatioFScale(); default: qWarning("QSvgGenerator::metric(), unhandled metric %d\n", metric); break; -- cgit v1.2.1 From 2b4487a1c5fb4e7a6c942bf8c2fa995b6ea5ac01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Klitzing?= Date: Fri, 6 Oct 2017 13:33:16 +0200 Subject: Add missing emit Change-Id: I2a3c0a3734548919d8a337b88b9aa6fdf725bbc1 Reviewed-by: Friedemann Kleint --- src/svg/qsvgrenderer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/svg/qsvgrenderer.cpp b/src/svg/qsvgrenderer.cpp index bd0e6e3..d4ad373 100644 --- a/src/svg/qsvgrenderer.cpp +++ b/src/svg/qsvgrenderer.cpp @@ -304,7 +304,7 @@ int QSvgRenderer::animationDuration() const */ void QSvgRendererPrivate::callRepaintNeeded(QSvgRenderer *const q) { - q->repaintNeeded(); + emit q->repaintNeeded(); } template -- cgit v1.2.1 From 8241a99426d454c23a42640b781889adc820ba02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Klitzing?= Date: Fri, 6 Oct 2017 13:29:12 +0200 Subject: Remove unused variables Change-Id: I82fe38e2fbcc070d02d2acb34a43a8c971e84ae9 Reviewed-by: Friedemann Kleint Reviewed-by: Eirik Aavitsland --- src/svg/qsvggraphics.cpp | 1 - src/svg/qsvghandler.cpp | 10 ---------- 2 files changed, 11 deletions(-) (limited to 'src') diff --git a/src/svg/qsvggraphics.cpp b/src/svg/qsvggraphics.cpp index 387136f..b1047eb 100644 --- a/src/svg/qsvggraphics.cpp +++ b/src/svg/qsvggraphics.cpp @@ -316,7 +316,6 @@ void QSvgText::draw(QPainter *p, QSvgExtraStates &states) bool appendSpace = false; QVector paragraphs; - QStack formats; QVector > formatRanges(1); paragraphs.push_back(QString()); diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp index 88d85e3..7841fa3 100644 --- a/src/svg/qsvghandler.cpp +++ b/src/svg/qsvghandler.cpp @@ -2308,7 +2308,6 @@ static bool parseAnimateColorNode(QSvgNode *parent, const QXmlStreamAttributes &attributes, QSvgHandler *handler) { - QString typeStr = attributes.value(QLatin1String("type")).toString(); QStringRef fromStr = attributes.value(QLatin1String("from")); QStringRef toStr = attributes.value(QLatin1String("to")); QString valuesStr = attributes.value(QLatin1String("values")).toString(); @@ -2393,7 +2392,6 @@ static bool parseAnimateTransformNode(QSvgNode *parent, QString values = attributes.value(QLatin1String("values")).toString(); QString beginStr = attributes.value(QLatin1String("begin")).toString(); QString durStr = attributes.value(QLatin1String("dur")).toString(); - QString targetStr = attributes.value(QLatin1String("attributeName")).toString(); QString repeatStr = attributes.value(QLatin1String("repeatCount")).toString(); QString fillStr = attributes.value(QLatin1String("fill")).toString(); QString fromStr = attributes.value(QLatin1String("from")).toString(); @@ -3197,14 +3195,6 @@ static QSvgNode *createSvgNode(QSvgNode *parent, { Q_UNUSED(parent); Q_UNUSED(attributes); - QString baseProfile = attributes.value(QLatin1String("baseProfile")).toString(); -#if 0 - if (baseProfile.isEmpty() && baseProfile != QLatin1String("tiny")) { - qCWarning(lcSvgHandler, "Profile is %s while we only support tiny!", - qPrintable(baseProfile)); - } -#endif - QSvgTinyDocument *node = new QSvgTinyDocument(); QString widthStr = attributes.value(QLatin1String("width")).toString(); QString heightStr = attributes.value(QLatin1String("height")).toString(); -- cgit v1.2.1 From 660012b62e62f6bf3a00e1194e7e22e41b7ffd8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Klitzing?= Date: Fri, 6 Oct 2017 13:37:43 +0200 Subject: Avoid possible detaching Change-Id: Iea5521d1fd53d5af21f99023f8d9ed15ef2f4f68 Reviewed-by: Friedemann Kleint --- src/svg/qsvggenerator.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/svg/qsvggenerator.cpp b/src/svg/qsvggenerator.cpp index d294eb2..8b9a9bd 100644 --- a/src/svg/qsvggenerator.cpp +++ b/src/svg/qsvggenerator.cpp @@ -228,9 +228,9 @@ public: QTextStream str(&d_func()->defs, QIODevice::Append); str << "" << endl; - for (QRect r : reg.rects()) { + const auto &rects = reg.rects(); + for (const QRect &r : rects) str << rct.arg(r.x()).arg(r.y()).arg(r.width()).arg(r.height()) << endl; - } str << QStringLiteral("") << endl << endl; d_func()->savedPatternMasks.append(maskId); } -- cgit v1.2.1 From faa5d4f0ddb17061c5d126243a46f2af7e91e9d9 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Thu, 28 Sep 2017 16:48:36 +0200 Subject: Fix outdated BSD license header Change-Id: I3917e7ab180b49c77bff0d071eca10f8bc7f33c7 Reviewed-by: Jani Heikkinen --- src/svg/doc/snippets/doc_src_qtsvg.cpp | 16 +++++++++++++--- src/svg/doc/snippets/doc_src_qtsvg.pro | 16 +++++++++++++--- src/svg/doc/snippets/src_svg_qgraphicssvgitem.cpp | 16 +++++++++++++--- 3 files changed, 39 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/svg/doc/snippets/doc_src_qtsvg.cpp b/src/svg/doc/snippets/doc_src_qtsvg.cpp index 22b2b38..dc754c3 100644 --- a/src/svg/doc/snippets/doc_src_qtsvg.cpp +++ b/src/svg/doc/snippets/doc_src_qtsvg.cpp @@ -1,12 +1,22 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are diff --git a/src/svg/doc/snippets/doc_src_qtsvg.pro b/src/svg/doc/snippets/doc_src_qtsvg.pro index b9e8d4b..0c9aeed 100644 --- a/src/svg/doc/snippets/doc_src_qtsvg.pro +++ b/src/svg/doc/snippets/doc_src_qtsvg.pro @@ -1,12 +1,22 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are diff --git a/src/svg/doc/snippets/src_svg_qgraphicssvgitem.cpp b/src/svg/doc/snippets/src_svg_qgraphicssvgitem.cpp index e08862c..60018b6 100644 --- a/src/svg/doc/snippets/src_svg_qgraphicssvgitem.cpp +++ b/src/svg/doc/snippets/src_svg_qgraphicssvgitem.cpp @@ -1,12 +1,22 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are -- cgit v1.2.1 From c4c9b60dc4bbe3c3837c80ea63682f3ef9403277 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Thu, 28 Sep 2017 16:48:44 +0200 Subject: Fix outdated FDL license header Change-Id: I2a2501a61107717b8e1adacad064664cf54cd972 Reviewed-by: Jani Heikkinen --- src/svg/doc/src/qtsvg-index.qdoc | 10 +++++----- src/svg/doc/src/qtsvg.qdoc | 10 +++++----- src/svg/doc/src/svgrendering.qdoc | 10 +++++----- 3 files changed, 15 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/svg/doc/src/qtsvg-index.qdoc b/src/svg/doc/src/qtsvg-index.qdoc index 73a319b..b559d27 100644 --- a/src/svg/doc/src/qtsvg-index.qdoc +++ b/src/svg/doc/src/qtsvg-index.qdoc @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the documentation of the Qt SVG module. ** @@ -11,8 +11,8 @@ ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Free Documentation License Usage ** Alternatively, this file may be used under the terms of the GNU Free @@ -20,7 +20,7 @@ ** Foundation and appearing in the file included in the packaging of ** this file. Please review the following information to ensure ** the GNU Free Documentation License version 1.3 requirements -** will be met: http://www.gnu.org/copyleft/fdl.html. +** will be met: https://www.gnu.org/licenses/fdl-1.3.html. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/svg/doc/src/qtsvg.qdoc b/src/svg/doc/src/qtsvg.qdoc index 58a467b..c607bd0 100644 --- a/src/svg/doc/src/qtsvg.qdoc +++ b/src/svg/doc/src/qtsvg.qdoc @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the documentation of the Qt SVG module. ** @@ -11,8 +11,8 @@ ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Free Documentation License Usage ** Alternatively, this file may be used under the terms of the GNU Free @@ -20,7 +20,7 @@ ** Foundation and appearing in the file included in the packaging of ** this file. Please review the following information to ensure ** the GNU Free Documentation License version 1.3 requirements -** will be met: http://www.gnu.org/copyleft/fdl.html. +** will be met: https://www.gnu.org/licenses/fdl-1.3.html. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/svg/doc/src/svgrendering.qdoc b/src/svg/doc/src/svgrendering.qdoc index 8429ab4..48a8d14 100644 --- a/src/svg/doc/src/svgrendering.qdoc +++ b/src/svg/doc/src/svgrendering.qdoc @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the documentation of the Qt SVG module. ** @@ -11,8 +11,8 @@ ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Free Documentation License Usage ** Alternatively, this file may be used under the terms of the GNU Free @@ -20,7 +20,7 @@ ** Foundation and appearing in the file included in the packaging of ** this file. Please review the following information to ensure ** the GNU Free Documentation License version 1.3 requirements -** will be met: http://www.gnu.org/copyleft/fdl.html. +** will be met: https://www.gnu.org/licenses/fdl-1.3.html. ** $QT_END_LICENSE$ ** ****************************************************************************/ -- cgit v1.2.1 From 18a2adad907523ea31251ff0b62e3321241a40fa Mon Sep 17 00:00:00 2001 From: Eirik Aavitsland Date: Tue, 14 Nov 2017 14:47:08 +0100 Subject: Fix crash on recursive self-referral in element Referring to an ancestor in a element would lead to endless recursion. Add checks to avoid recursion, and also emit a warning while parsing. Task-number: QTBUG-64425 Change-Id: I9ee1b9bfef13796cc3f387ff8579c6b13bc4ae9a Reviewed-by: Andy Shaw --- src/svg/qsvggraphics.cpp | 5 ++++- src/svg/qsvghandler.cpp | 2 ++ src/svg/qsvgnode.cpp | 11 +++++++++++ src/svg/qsvgnode_p.h | 1 + 4 files changed, 18 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/svg/qsvggraphics.cpp b/src/svg/qsvggraphics.cpp index b1047eb..5b273af 100644 --- a/src/svg/qsvggraphics.cpp +++ b/src/svg/qsvggraphics.cpp @@ -465,6 +465,9 @@ QSvgUse::QSvgUse(const QPointF &start, QSvgNode *parent, QSvgNode *node) void QSvgUse::draw(QPainter *p, QSvgExtraStates &states) { + if (Q_UNLIKELY(!m_link || isDescendantOf(m_link))) + return; + applyStyle(p, states); if (!m_start.isNull()) { @@ -553,7 +556,7 @@ QSvgNode::Type QSvgVideo::type() const QRectF QSvgUse::bounds(QPainter *p, QSvgExtraStates &states) const { QRectF bounds; - if (m_link) { + if (Q_LIKELY(m_link && !isDescendantOf(m_link))) { p->translate(m_start); bounds = m_link->transformedBounds(p, states); p->translate(-m_start); diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp index 7841fa3..022afb6 100644 --- a/src/svg/qsvghandler.cpp +++ b/src/svg/qsvghandler.cpp @@ -3338,6 +3338,8 @@ static QSvgNode *createUseNode(QSvgNode *parent, if (group) { QSvgNode *link = group->scopeNode(linkId); if (link) { + if (parent->isDescendantOf(link)) + qCWarning(lcSvgHandler, "link #%s is recursive!", qPrintable(linkId)); QPointF pt; if (!xStr.isNull() || !yStr.isNull()) { QSvgHandler::LengthType type; diff --git a/src/svg/qsvgnode.cpp b/src/svg/qsvgnode.cpp index e504522..14aaea4 100644 --- a/src/svg/qsvgnode.cpp +++ b/src/svg/qsvgnode.cpp @@ -57,6 +57,17 @@ QSvgNode::~QSvgNode() } +bool QSvgNode::isDescendantOf(const QSvgNode *parent) const +{ + const QSvgNode *n = this; + while (n) { + if (n == parent) + return true; + n = n->m_parent; + } + return false; +} + void QSvgNode::appendStyleProperty(QSvgStyleProperty *prop, const QString &id) { //qDebug()<<"appending "<type()<< " ("<< id <<") "<<"to "<type(); diff --git a/src/svg/qsvgnode_p.h b/src/svg/qsvgnode_p.h index f9f6202..f2502e4 100644 --- a/src/svg/qsvgnode_p.h +++ b/src/svg/qsvgnode_p.h @@ -113,6 +113,7 @@ public: virtual void draw(QPainter *p, QSvgExtraStates &states) =0; QSvgNode *parent() const; + bool isDescendantOf(const QSvgNode *parent) const; void appendStyleProperty(QSvgStyleProperty *prop, const QString &id); void applyStyle(QPainter *p, QSvgExtraStates &states) const; -- cgit v1.2.1