diff options
Diffstat (limited to 'src/svg/qsvgstyle.cpp')
-rw-r--r-- | src/svg/qsvgstyle.cpp | 53 |
1 files changed, 8 insertions, 45 deletions
diff --git a/src/svg/qsvgstyle.cpp b/src/svg/qsvgstyle.cpp index e82d89c..604b4e4 100644 --- a/src/svg/qsvgstyle.cpp +++ b/src/svg/qsvgstyle.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt SVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qsvgstyle_p.h" @@ -158,7 +122,7 @@ void QSvgFillStyle::setFillStyle(QSvgFillStyleProperty* style) void QSvgFillStyle::setBrush(QBrush brush) { m_fill = std::move(brush); - m_style = 0; + m_style = nullptr; m_fillSet = 1; } @@ -666,8 +630,8 @@ void QSvgAnimateTransform::setArgs(TransformType type, Additive additive, const m_type = type; m_args = args; m_additive = additive; - Q_ASSERT(!(args.count()%3)); - m_count = args.count() / 3; + Q_ASSERT(!(args.size()%3)); + m_count = args.size() / 3; } void QSvgAnimateTransform::apply(QPainter *p, const QSvgNode *node, QSvgExtraStates &) @@ -686,7 +650,6 @@ void QSvgAnimateTransform::revert(QPainter *p, QSvgExtraStates &) void QSvgAnimateTransform::resolveMatrix(const QSvgNode *node) { - static const qreal deg2rad = qreal(0.017453292519943295769); qreal totalTimeElapsed = node->document()->currentElapsed(); if (totalTimeElapsed < m_from || m_finished) return; @@ -786,7 +749,7 @@ void QSvgAnimateTransform::resolveMatrix(const QSvgNode *node) qreal transXDiff = (to1-from1) * percentOfAnimation; qreal transX = from1 + transXDiff; m_transform = QTransform(); - m_transform.shear(qTan(transX * deg2rad), 0); + m_transform.shear(qTan(qDegreesToRadians(transX)), 0); break; } case SkewY: { @@ -801,7 +764,7 @@ void QSvgAnimateTransform::resolveMatrix(const QSvgNode *node) qreal transYDiff = (to1 - from1) * percentOfAnimation; qreal transY = from1 + transYDiff; m_transform = QTransform(); - m_transform.shear(0, qTan(transY * deg2rad)); + m_transform.shear(0, qTan(qDegreesToRadians(transY))); break; } default: @@ -873,7 +836,7 @@ void QSvgAnimateColor::apply(QPainter *p, const QSvgNode *node, QSvgExtraStates percentOfAnimation -= ((int)percentOfAnimation); } - qreal currentPosition = percentOfAnimation * (m_colors.count() - 1); + qreal currentPosition = percentOfAnimation * (m_colors.size() - 1); int startElem = qFloor(currentPosition); int endElem = qCeil(currentPosition); |