diff options
author | Liang Qi <liang.qi@qt.io> | 2017-11-20 13:18:15 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2017-11-20 13:18:15 +0100 |
commit | f84d0cc0165047183466a956589315ad41e946d0 (patch) | |
tree | 9dedb5dfde84d4a2732b79e454a48d92158efdbe /src | |
parent | 4dd6b2bfebf02223ef498bf52ce354c628cc9607 (diff) | |
parent | 984ba6977201f8fbd94d44a2b67519e1faf458cc (diff) | |
download | qtsvg-f84d0cc0165047183466a956589315ad41e946d0.tar.gz |
Merge remote-tracking branch 'origin/5.10' into dev
Change-Id: I7e158268343c5d92d666d266a87095f1154714dd
Diffstat (limited to 'src')
-rw-r--r-- | src/svg/doc/snippets/doc_src_qtsvg.cpp | 16 | ||||
-rw-r--r-- | src/svg/doc/snippets/doc_src_qtsvg.pro | 16 | ||||
-rw-r--r-- | src/svg/doc/snippets/src_svg_qgraphicssvgitem.cpp | 16 | ||||
-rw-r--r-- | src/svg/doc/src/qtsvg-index.qdoc | 10 | ||||
-rw-r--r-- | src/svg/doc/src/qtsvg.qdoc | 10 | ||||
-rw-r--r-- | src/svg/doc/src/svgrendering.qdoc | 10 | ||||
-rw-r--r-- | src/svg/qgraphicssvgitem.cpp | 4 | ||||
-rw-r--r-- | src/svg/qsvggenerator.cpp | 7 | ||||
-rw-r--r-- | src/svg/qsvggraphics.cpp | 6 | ||||
-rw-r--r-- | src/svg/qsvghandler.cpp | 12 | ||||
-rw-r--r-- | src/svg/qsvgnode.cpp | 11 | ||||
-rw-r--r-- | src/svg/qsvgnode_p.h | 1 | ||||
-rw-r--r-- | src/svg/qsvgrenderer.cpp | 2 |
13 files changed, 78 insertions, 43 deletions
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 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$ ** ****************************************************************************/ 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 diff --git a/src/svg/qsvggenerator.cpp b/src/svg/qsvggenerator.cpp index 3f4e545..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 << "<mask id=\"" << maskId << "\" x=\"0\" y=\"0\" width=\"8\" height=\"8\" " << "stroke=\"none\" fill=\"#ffffff\" patternUnits=\"userSpaceOnUse\" >" << 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("</mask>") << endl << endl; d_func()->savedPatternMasks.append(maskId); } @@ -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; diff --git a/src/svg/qsvggraphics.cpp b/src/svg/qsvggraphics.cpp index 387136f..5b273af 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<QString> paragraphs; - QStack<QTextCharFormat> formats; QVector<QVector<QTextLayout::FormatRange> > formatRanges(1); paragraphs.push_back(QString()); @@ -466,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()) { @@ -554,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 d49a4ab..6c0e742 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(); @@ -3348,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 "<<prop->type()<< " ("<< id <<") "<<"to "<<this<<this->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; 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<typename TInputType> |