diff options
author | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2016-04-12 18:15:52 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2016-04-13 09:19:18 +0200 |
commit | 6e6079031cf44149be4ca1f05547b4c03e505290 (patch) | |
tree | d16fb11a3cdb50f367fea645359538523ab83620 /src/quick/util | |
parent | 38d2d6ede6722b0fb86ee6723bbfbb2b063c4d6b (diff) | |
parent | 8ca22ca7eb5216513410651411fd2e0f07e50f34 (diff) |
Merge remote-tracking branch 'origin/dev' into wip/scenegraphng
Change-Id: If33197b616de3476811f0161d4ecd8e7d004756c
Diffstat (limited to 'src/quick/util')
-rw-r--r-- | src/quick/util/qquickanimation.cpp | 4 | ||||
-rw-r--r-- | src/quick/util/qquickanimatorjob.cpp | 17 | ||||
-rw-r--r-- | src/quick/util/qquickanimatorjob_p.h | 2 | ||||
-rw-r--r-- | src/quick/util/qquickpath.cpp | 8 | ||||
-rw-r--r-- | src/quick/util/qquickpixmapcache.cpp | 1 | ||||
-rw-r--r-- | src/quick/util/qquicktimeline.cpp | 8 |
6 files changed, 23 insertions, 17 deletions
diff --git a/src/quick/util/qquickanimation.cpp b/src/quick/util/qquickanimation.cpp index 51212661c9..adf8f600a0 100644 --- a/src/quick/util/qquickanimation.cpp +++ b/src/quick/util/qquickanimation.cpp @@ -1441,7 +1441,7 @@ QQuickVector3dAnimation::~QQuickVector3dAnimation() } /*! - \qmlproperty real QtQuick::Vector3dAnimation::from + \qmlproperty vector3d QtQuick::Vector3dAnimation::from This property holds the starting value for the animation. If the Vector3dAnimation is defined within a \l Transition or \l Behavior, @@ -1463,7 +1463,7 @@ void QQuickVector3dAnimation::setFrom(QVector3D f) } /*! - \qmlproperty real QtQuick::Vector3dAnimation::to + \qmlproperty vector3d QtQuick::Vector3dAnimation::to This property holds the end value for the animation. If the Vector3dAnimation is defined within a \l Transition or \l Behavior, diff --git a/src/quick/util/qquickanimatorjob.cpp b/src/quick/util/qquickanimatorjob.cpp index 3502a28301..f0ecb8150a 100644 --- a/src/quick/util/qquickanimatorjob.cpp +++ b/src/quick/util/qquickanimatorjob.cpp @@ -239,6 +239,10 @@ void QQuickAnimatorJob::debugAnimation(QDebug d) const << "target:" << m_target << "value:" << m_value; } +qreal QQuickAnimatorJob::progress(int time) const +{ + return m_easing.valueForProgress((m_duration == 0) ? qreal(1) : qreal(time) / qreal(m_duration)); +} qreal QQuickAnimatorJob::value() const { qreal v; @@ -388,7 +392,7 @@ void QQuickXAnimatorJob::updateCurrentTime(int time) if (!m_controller) return; - m_value = m_from + (m_to - m_from) * m_easing.valueForProgress(time / (qreal) m_duration); + m_value = m_from + (m_to - m_from) * progress(time); m_helper->dx = m_value; m_helper->wasChanged = true; } @@ -404,7 +408,7 @@ void QQuickYAnimatorJob::updateCurrentTime(int time) if (!m_controller) return; - m_value = m_from + (m_to - m_from) * m_easing.valueForProgress(time / (qreal) m_duration); + m_value = m_from + (m_to - m_from) * progress(time); m_helper->dy = m_value; m_helper->wasChanged = true; } @@ -473,7 +477,7 @@ void QQuickOpacityAnimatorJob::updateCurrentTime(int time) if (!m_controller || !m_opacityNode) return; - m_value = m_from + (m_to - m_from) * m_easing.valueForProgress(time / (qreal) m_duration); + m_value = m_from + (m_to - m_from) * progress(time); m_opacityNode->setOpacity(m_value); } @@ -488,7 +492,7 @@ void QQuickScaleAnimatorJob::updateCurrentTime(int time) if (!m_controller) return; - m_value = m_from + (m_to - m_from) * m_easing.valueForProgress(time / (qreal) m_duration); + m_value = m_from + (m_to - m_from) * progress(time); m_helper->scale = m_value; m_helper->wasChanged = true; } @@ -507,7 +511,8 @@ void QQuickRotationAnimatorJob::updateCurrentTime(int time) if (!m_controller) return; - float t = m_easing.valueForProgress(time / (qreal) m_duration); + float t = progress(time); + switch (m_direction) { case QQuickRotationAnimator::Clockwise: m_value = _q_interpolateClockwiseRotation(m_from, m_to, t).toFloat(); @@ -590,7 +595,7 @@ void QQuickUniformAnimatorJob::updateCurrentTime(int time) if (!m_node || m_uniformIndex == -1 || m_uniformType == -1) return; - m_value = m_from + (m_to - m_from) * m_easing.valueForProgress(time / (qreal) m_duration); + m_value = m_from + (m_to - m_from) * progress(time); QQuickShaderEffectMaterial *material = static_cast<QQuickShaderEffectMaterial *>(m_node->material()); diff --git a/src/quick/util/qquickanimatorjob_p.h b/src/quick/util/qquickanimatorjob_p.h index 75d2b962a5..118487f937 100644 --- a/src/quick/util/qquickanimatorjob_p.h +++ b/src/quick/util/qquickanimatorjob_p.h @@ -158,6 +158,8 @@ protected: QQuickAnimatorJob(); void debugAnimation(QDebug d) const Q_DECL_OVERRIDE; + qreal progress(int time) const; + QPointer<QQuickItem> m_target; QQuickAnimatorController *m_controller; diff --git a/src/quick/util/qquickpath.cpp b/src/quick/util/qquickpath.cpp index 062411e0a9..6b491a433c 100644 --- a/src/quick/util/qquickpath.cpp +++ b/src/quick/util/qquickpath.cpp @@ -46,7 +46,7 @@ #include <private/qbezier_p.h> #include <QtCore/qmath.h> -#include <QtCore/qnumeric.h> +#include <QtCore/private/qnumeric_p.h> QT_BEGIN_NAMESPACE @@ -560,7 +560,7 @@ void QQuickPath::createPointCache() const { Q_D(const QQuickPath); qreal pathLength = d->pathLength; - if (pathLength <= 0 || qIsNaN(pathLength)) + if (pathLength <= 0 || qt_is_nan(pathLength)) return; const int segments = segmentCount(d->_path, pathLength); @@ -633,7 +633,7 @@ QPointF QQuickPath::sequentialPointAt(const QPainterPath &path, const qreal &pat QPointF QQuickPath::forwardsPointAt(const QPainterPath &path, const qreal &pathLength, const QList<AttributePoint> &attributePoints, QQuickCachedBezier &prevBez, qreal p, qreal *angle) { - if (pathLength <= 0 || qIsNaN(pathLength)) + if (pathLength <= 0 || qt_is_nan(pathLength)) return path.pointAtPercent(0); //expensive? const int lastElement = path.elementCount() - 1; @@ -689,7 +689,7 @@ QPointF QQuickPath::forwardsPointAt(const QPainterPath &path, const qreal &pathL //ideally this should be merged with forwardsPointAt QPointF QQuickPath::backwardsPointAt(const QPainterPath &path, const qreal &pathLength, const QList<AttributePoint> &attributePoints, QQuickCachedBezier &prevBez, qreal p, qreal *angle) { - if (pathLength <= 0 || qIsNaN(pathLength)) + if (pathLength <= 0 || qt_is_nan(pathLength)) return path.pointAtPercent(0); const int firstElement = 1; //element 0 is always a MoveTo, which we ignore diff --git a/src/quick/util/qquickpixmapcache.cpp b/src/quick/util/qquickpixmapcache.cpp index 23b2887fac..2b6e8f68c3 100644 --- a/src/quick/util/qquickpixmapcache.cpp +++ b/src/quick/util/qquickpixmapcache.cpp @@ -530,7 +530,6 @@ void QQuickPixmapReader::asyncResponseFinished(QQuickImageResponse *response) QQuickTextureFactory *t = 0; QQuickPixmapReply::ReadError error = QQuickPixmapReply::NoError; QString errorString; - QSize readSize; if (!response->errorString().isEmpty()) { error = QQuickPixmapReply::Loading; errorString = response->errorString(); diff --git a/src/quick/util/qquicktimeline.cpp b/src/quick/util/qquicktimeline.cpp index d8226a08f3..74baa3bfda 100644 --- a/src/quick/util/qquicktimeline.cpp +++ b/src/quick/util/qquicktimeline.cpp @@ -47,7 +47,7 @@ #include <QCoreApplication> #include <QEasingCurve> #include <QTime> -#include <QtNumeric> +#include <QtCore/private/qnumeric_p.h> #include <algorithm> @@ -387,7 +387,7 @@ void QQuickTimeLine::set(QQuickTimeLineValue &timeLineValue, qreal value) */ int QQuickTimeLine::accel(QQuickTimeLineValue &timeLineValue, qreal velocity, qreal acceleration) { - if (qFuzzyIsNull(acceleration) || qIsNaN(acceleration)) + if (qFuzzyIsNull(acceleration) || qt_is_nan(acceleration)) return -1; if ((velocity > 0.0f) == (acceleration > 0.0f)) @@ -414,7 +414,7 @@ int QQuickTimeLine::accel(QQuickTimeLineValue &timeLineValue, qreal velocity, qr */ int QQuickTimeLine::accel(QQuickTimeLineValue &timeLineValue, qreal velocity, qreal acceleration, qreal maxDistance) { - if (qFuzzyIsNull(maxDistance) || qIsNaN(maxDistance) || qFuzzyIsNull(acceleration) || qIsNaN(acceleration)) + if (qFuzzyIsNull(maxDistance) || qt_is_nan(maxDistance) || qFuzzyIsNull(acceleration) || qt_is_nan(acceleration)) return -1; Q_ASSERT(acceleration > 0.0f && maxDistance > 0.0f); @@ -444,7 +444,7 @@ int QQuickTimeLine::accel(QQuickTimeLineValue &timeLineValue, qreal velocity, qr */ int QQuickTimeLine::accelDistance(QQuickTimeLineValue &timeLineValue, qreal velocity, qreal distance) { - if (qFuzzyIsNull(distance) || qIsNaN(distance) || qFuzzyIsNull(velocity) || qIsNaN(velocity)) + if (qFuzzyIsNull(distance) || qt_is_nan(distance) || qFuzzyIsNull(velocity) || qt_is_nan(velocity)) return -1; Q_ASSERT((distance >= 0.0f) == (velocity >= 0.0f)); |