diff options
author | Albert Astals Cid <albert.astals.cid@kdab.com> | 2019-10-04 17:29:54 +0200 |
---|---|---|
committer | Albert Astals Cid <albert.astals.cid@kdab.com> | 2019-10-07 09:09:51 +0200 |
commit | a72ce34fd4f2fb0035bd982201bafedc0b6cd364 (patch) | |
tree | 5a101de5076a4d3793aef159e18aef0065bbe091 /src | |
parent | a7cb54082e3fd47758b8f17b0ece15a2f8c38aa5 (diff) | |
download | qtsvg-a72ce34fd4f2fb0035bd982201bafedc0b6cd364.tar.gz |
Small performance improvements suggested by clang-tidyv5.14.0-beta2
* Add const & to function parameters
* std::move an brush
* Add const & to variables assigned from functions returning const &
Change-Id: If412b78cc0198e24ce1c611fcd2026d0d723be80
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/svg/qsvghandler.cpp | 2 | ||||
-rw-r--r-- | src/svg/qsvghandler_p.h | 2 | ||||
-rw-r--r-- | src/svg/qsvgnode.cpp | 2 | ||||
-rw-r--r-- | src/svg/qsvgstyle.cpp | 2 |
4 files changed, 4 insertions, 4 deletions
diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp index fe79977..86ca77e 100644 --- a/src/svg/qsvghandler.cpp +++ b/src/svg/qsvghandler.cpp @@ -1986,7 +1986,7 @@ static void parseCSStoXMLAttrs(const QVector<QCss::Declaration> &declarations, } } -void QSvgHandler::parseCSStoXMLAttrs(QString css, QVector<QSvgCssAttribute> *attributes) +void QSvgHandler::parseCSStoXMLAttrs(const QString &css, QVector<QSvgCssAttribute> *attributes) { // preprocess (for unicode escapes), tokenize and remove comments m_cssParser.init(css); diff --git a/src/svg/qsvghandler_p.h b/src/svg/qsvghandler_p.h index 8eb061b..d76e56c 100644 --- a/src/svg/qsvghandler_p.h +++ b/src/svg/qsvghandler_p.h @@ -128,7 +128,7 @@ public: int animationDuration() const; #ifndef QT_NO_CSSPARSER - void parseCSStoXMLAttrs(QString css, QVector<QSvgCssAttribute> *attributes); + void parseCSStoXMLAttrs(const QString &css, QVector<QSvgCssAttribute> *attributes); #endif inline QPen defaultPen() const diff --git a/src/svg/qsvgnode.cpp b/src/svg/qsvgnode.cpp index 14aaea4..29fd4e5 100644 --- a/src/svg/qsvgnode.cpp +++ b/src/svg/qsvgnode.cpp @@ -341,7 +341,7 @@ QSvgNode::DisplayMode QSvgNode::displayMode() const qreal QSvgNode::strokeWidth(QPainter *p) { - QPen pen = p->pen(); + const QPen &pen = p->pen(); if (pen.style() == Qt::NoPen || pen.brush().style() == Qt::NoBrush || pen.isCosmetic()) return 0; return pen.widthF(); diff --git a/src/svg/qsvgstyle.cpp b/src/svg/qsvgstyle.cpp index b934f94..c4edd25 100644 --- a/src/svg/qsvgstyle.cpp +++ b/src/svg/qsvgstyle.cpp @@ -126,7 +126,7 @@ void QSvgFillStyle::setFillStyle(QSvgFillStyleProperty* style) void QSvgFillStyle::setBrush(QBrush brush) { - m_fill = brush; + m_fill = std::move(brush); m_style = 0; m_fillSet = 1; } |