From 05685708b78b43713fbfc59ff78160340a38e2d1 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 20 Oct 2020 12:19:21 +0200 Subject: Whitespace cleanup in corelib/tools Change-Id: Ibe796c398a8e5488b7203abb07aa54740744f1ab Reviewed-by: Thiago Macieira --- src/corelib/tools/qeasingcurve.cpp | 47 +++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 23 deletions(-) (limited to 'src/corelib/tools/qeasingcurve.cpp') diff --git a/src/corelib/tools/qeasingcurve.cpp b/src/corelib/tools/qeasingcurve.cpp index 389efcb8f9..9eb74d12cc 100644 --- a/src/corelib/tools/qeasingcurve.cpp +++ b/src/corelib/tools/qeasingcurve.cpp @@ -320,7 +320,8 @@ static bool isConfigFunction(QEasingCurve::Type type) type == QEasingCurve::TCBSpline; } -struct TCBPoint { +struct TCBPoint +{ QPointF _point; qreal _t; qreal _c; @@ -605,8 +606,8 @@ struct BezierEase : public QEasingCurveFunction const qreal s = 1 - t; - const qreal s_squared = s*s; - const qreal t_squared = t*t; + const qreal s_squared = s * s; + const qreal t_squared = t * t; const qreal s_cubic = s_squared * s; const qreal t_cubic = t_squared * t; @@ -623,8 +624,8 @@ struct BezierEase : public QEasingCurveFunction const qreal s = 1 - t; - const qreal s_squared = s*s; - const qreal t_squared = t*t; + const qreal s_squared = s * s; + const qreal t_squared = t * t; const qreal s_cubic = s_squared * s; const qreal t_cubic = t_squared * t; @@ -639,7 +640,7 @@ struct BezierEase : public QEasingCurveFunction const qreal p2 = singleCubicBezier.p2x; const qreal p3 = singleCubicBezier.p3x; - const qreal t_squared = t*t; + const qreal t_squared = t * t; return -3*p0 + 3*p1 + 6*p0*t - 12*p1*t + 6*p2*t + 3*p3*t_squared - 3*p0*t_squared + 9*p1*t_squared - 9*p2*t_squared; } @@ -739,7 +740,7 @@ struct BezierEase : public QEasingCurveFunction qreal cos = b * x - a * x_squared; if (cos < 0) - return 0.225 * (cos * 1 *-cos - cos) + cos; + return 0.225 * (cos * 1 * -cos - cos) + cos; return 0.225 * (cos * cos - cos) + cos; } @@ -794,15 +795,15 @@ struct BezierEase : public QEasingCurveFunction if (D >= 0) { const qreal D_sqrt = qSqrt(D); - qreal u = _cbrt( -q * 0.5 + D_sqrt); - qreal v = _cbrt( -q * 0.5 - D_sqrt); + qreal u = _cbrt(-q * 0.5 + D_sqrt); + qreal v = _cbrt(-q * 0.5 - D_sqrt); qreal z1 = u + v; qreal t1 = z1 - a_by3; if (inRange(t1)) return t1; - qreal z2 = -1 *u; + qreal z2 = -1 * u; qreal t2 = z2 - a_by3; return t2; } @@ -825,7 +826,7 @@ struct BezierEase : public QEasingCurveFunction cosacos(g, s1, s2, s3); - qreal z1 = -1* f * s2; + qreal z1 = -1 * f * s2; qreal t1 = z1 - a_by3; if (inRange(t1)) return t1; @@ -940,7 +941,7 @@ struct ElasticEase : public QEasingCurveFunction { qreal p = (_p < 0) ? qreal(0.3) : _p; qreal a = (_a < 0) ? qreal(1.0) : _a; - switch(_t) { + switch (_t) { case QEasingCurve::InElastic: return easeInElastic(t, a, p); case QEasingCurve::OutElastic: @@ -973,7 +974,7 @@ struct BounceEase : public QEasingCurveFunction qreal value(qreal t) override { qreal a = (_a < 0) ? qreal(1.0) : _a; - switch(_t) { + switch (_t) { case QEasingCurve::InBounce: return easeInBounce(t, a); case QEasingCurve::OutBounce: @@ -1011,7 +1012,7 @@ struct BackEase : public QEasingCurveFunction if (!(t < 1)) return 1; qreal o = (_o < 0) ? qreal(1.70158) : _o; - switch(_t) { + switch (_t) { case QEasingCurve::InBack: return easeInBack(t, o); case QEasingCurve::OutBack: @@ -1028,7 +1029,7 @@ struct BackEase : public QEasingCurveFunction static QEasingCurve::EasingFunction curveToFunc(QEasingCurve::Type curve) { - switch(curve) { + switch (curve) { case QEasingCurve::Linear: return &easeNone; case QEasingCurve::InQuad: @@ -1103,7 +1104,7 @@ static QEasingCurve::EasingFunction curveToFunc(QEasingCurve::Type curve) static QEasingCurveFunction *curveToFunctionObject(QEasingCurve::Type type) { - switch(type) { + switch (type) { case QEasingCurve::InElastic: case QEasingCurve::OutElastic: case QEasingCurve::InOutElastic: @@ -1197,14 +1198,14 @@ bool QEasingCurve::operator==(const QEasingCurve &other) const && d_ptr->type == other.d_ptr->type; if (res) { if (d_ptr->config && other.d_ptr->config) { - // catch the config content + // catch the config content res = d_ptr->config->operator==(*(other.d_ptr->config)); } else if (d_ptr->config || other.d_ptr->config) { - // one one has a config object, which could contain default values - res = qFuzzyCompare(amplitude(), other.amplitude()) && - qFuzzyCompare(period(), other.period()) && - qFuzzyCompare(overshoot(), other.overshoot()); + // one one has a config object, which could contain default values + res = qFuzzyCompare(amplitude(), other.amplitude()) + && qFuzzyCompare(period(), other.period()) + && qFuzzyCompare(overshoot(), other.overshoot()); } } return res; @@ -1275,7 +1276,7 @@ void QEasingCurve::setPeriod(qreal period) */ qreal QEasingCurve::overshoot() const { - return d_ptr->config ? d_ptr->config->_o : qreal(1.70158) ; + return d_ptr->config ? d_ptr->config->_o : qreal(1.70158); } /*! @@ -1372,7 +1373,7 @@ void QEasingCurve::addTCBSegment(const QPointF &nextPoint, qreal t, qreal c, qre if (!d_ptr->config) d_ptr->config = curveToFunctionObject(d_ptr->type); - d_ptr->config->_tcbPoints.append(TCBPoint(nextPoint, t, c ,b)); + d_ptr->config->_tcbPoints.append(TCBPoint(nextPoint, t, c, b)); if (nextPoint == QPointF(1.0, 1.0)) { d_ptr->config->_bezierCurves = tcbToBezier(d_ptr->config->_tcbPoints); -- cgit v1.2.3