tools/qeasingcurve.cpp

Source codeSwitch to Preprocessed file
LineSource CodeCoverage
1/**************************************************************************** -
2** -
3** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -
4** Contact: http://www.qt-project.org/legal -
5** -
6** This file is part of the QtCore module of the Qt Toolkit. -
7** -
8** $QT_BEGIN_LICENSE:LGPL$ -
9** Commercial License Usage -
10** Licensees holding valid commercial Qt licenses may use this file in -
11** accordance with the commercial license agreement provided with the -
12** Software or, alternatively, in accordance with the terms contained in -
13** a written agreement between you and Digia. For licensing terms and -
14** conditions see http://qt.digia.com/licensing. For further information -
15** use the contact form at http://qt.digia.com/contact-us. -
16** -
17** GNU Lesser General Public License Usage -
18** Alternatively, this file may be used under the terms of the GNU Lesser -
19** General Public License version 2.1 as published by the Free Software -
20** Foundation and appearing in the file LICENSE.LGPL included in the -
21** packaging of this file. Please review the following information to -
22** ensure the GNU Lesser General Public License version 2.1 requirements -
23** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -
24** -
25** In addition, as a special exception, Digia gives you certain additional -
26** rights. These rights are described in the Digia Qt LGPL Exception -
27** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -
28** -
29** GNU General Public License Usage -
30** Alternatively, this file may be used under the terms of the GNU -
31** General Public License version 3.0 as published by the Free Software -
32** Foundation and appearing in the file LICENSE.GPL included in the -
33** packaging of this file. Please review the following information to -
34** ensure the GNU General Public License version 3.0 requirements will be -
35** met: http://www.gnu.org/copyleft/gpl.html. -
36** -
37** -
38** $QT_END_LICENSE$ -
39** -
40****************************************************************************/ -
41 -
42/* -
43 -
44| *property* | *Used for type* | -
45| period | QEasingCurve::{In,Out,InOut,OutIn}Elastic | -
46| amplitude | QEasingCurve::{In,Out,InOut,OutIn}Bounce, QEasingCurve::{In,Out,InOut,OutIn}Elastic | -
47| overshoot | QEasingCurve::{In,Out,InOut,OutIn}Back | -
48 -
49*/ -
50 -
51 -
52 -
53 -
54/*! -
55 \class QEasingCurve -
56 \inmodule QtCore -
57 \since 4.6 -
58 \ingroup animation -
59 \brief The QEasingCurve class provides easing curves for controlling animation. -
60 -
61 Easing curves describe a function that controls how the speed of the interpolation -
62 between 0 and 1 should be. Easing curves allow transitions from -
63 one value to another to appear more natural than a simple constant speed would allow. -
64 The QEasingCurve class is usually used in conjunction with the QVariantAnimation and -
65 QPropertyAnimation classes but can be used on its own. It is usually used to accelerate -
66 the interpolation from zero velocity (ease in) or decelerate to zero velocity (ease out). -
67 Ease in and ease out can also be combined in the same easing curve. -
68 -
69 To calculate the speed of the interpolation, the easing curve provides the function -
70 valueForProgress(), where the \a progress argument specifies the progress of the -
71 interpolation: 0 is the start value of the interpolation, 1 is the end value of the -
72 interpolation. The returned value is the effective progress of the interpolation. -
73 If the returned value is the same as the input value for all input values the easing -
74 curve is a linear curve. This is the default behaviour. -
75 -
76 For example, -
77 \code -
78 QEasingCurve easing(QEasingCurve::InOutQuad); -
79 -
80 for(qreal t = 0.0; t < 1.0; t+=0.1) -
81 qWarning() << "Effective progress" << t << " is -
82 << easing.valueForProgress(t); -
83 \endcode -
84 will print the effective progress of the interpolation between 0 and 1. -
85 -
86 When using a QPropertyAnimation, the associated easing curve will be used to control the -
87 progress of the interpolation between startValue and endValue: -
88 \code -
89 QPropertyAnimation animation; -
90 animation.setStartValue(0); -
91 animation.setEndValue(1000); -
92 animation.setDuration(1000); -
93 animation.setEasingCurve(QEasingCurve::InOutQuad); -
94 \endcode -
95 -
96 The ability to set an amplitude, overshoot, or period depends on -
97 the QEasingCurve type. Amplitude access is available to curves -
98 that behave as springs such as elastic and bounce curves. Changing -
99 the amplitude changes the height of the curve. Period access is -
100 only available to elastic curves and setting a higher period slows -
101 the rate of bounce. Only curves that have "boomerang" behaviors -
102 such as the InBack, OutBack, InOutBack, and OutInBack have -
103 overshoot settings. These curves will interpolate beyond the end -
104 points and return to the end point, acting similar to a boomerang. -
105 -
106 The \l{Easing Curves Example} contains samples of QEasingCurve -
107 types and lets you change the curve settings. -
108 -
109 */ -
110 -
111/*! -
112 \enum QEasingCurve::Type -
113 -
114 The type of easing curve. -
115 -
116 \value Linear \image qeasingcurve-linear.png -
117 \caption Easing curve for a linear (t) function: -
118 velocity is constant. -
119 \value InQuad \image qeasingcurve-inquad.png -
120 \caption Easing curve for a quadratic (t^2) function: -
121 accelerating from zero velocity. -
122 \value OutQuad \image qeasingcurve-outquad.png -
123 \caption Easing curve for a quadratic (t^2) function: -
124 decelerating to zero velocity. -
125 \value InOutQuad \image qeasingcurve-inoutquad.png -
126 \caption Easing curve for a quadratic (t^2) function: -
127 acceleration until halfway, then deceleration. -
128 \value OutInQuad \image qeasingcurve-outinquad.png -
129 \caption Easing curve for a quadratic (t^2) function: -
130 deceleration until halfway, then acceleration. -
131 \value InCubic \image qeasingcurve-incubic.png -
132 \caption Easing curve for a cubic (t^3) function: -
133 accelerating from zero velocity. -
134 \value OutCubic \image qeasingcurve-outcubic.png -
135 \caption Easing curve for a cubic (t^3) function: -
136 decelerating to zero velocity. -
137 \value InOutCubic \image qeasingcurve-inoutcubic.png -
138 \caption Easing curve for a cubic (t^3) function: -
139 acceleration until halfway, then deceleration. -
140 \value OutInCubic \image qeasingcurve-outincubic.png -
141 \caption Easing curve for a cubic (t^3) function: -
142 deceleration until halfway, then acceleration. -
143 \value InQuart \image qeasingcurve-inquart.png -
144 \caption Easing curve for a quartic (t^4) function: -
145 accelerating from zero velocity. -
146 \value OutQuart \image qeasingcurve-outquart.png -
147 \caption -
148 Easing curve for a quartic (t^4) function: -
149 decelerating to zero velocity. -
150 \value InOutQuart \image qeasingcurve-inoutquart.png -
151 \caption -
152 Easing curve for a quartic (t^4) function: -
153 acceleration until halfway, then deceleration. -
154 \value OutInQuart \image qeasingcurve-outinquart.png -
155 \caption -
156 Easing curve for a quartic (t^4) function: -
157 deceleration until halfway, then acceleration. -
158 \value InQuint \image qeasingcurve-inquint.png -
159 \caption -
160 Easing curve for a quintic (t^5) easing -
161 in: accelerating from zero velocity. -
162 \value OutQuint \image qeasingcurve-outquint.png -
163 \caption -
164 Easing curve for a quintic (t^5) function: -
165 decelerating to zero velocity. -
166 \value InOutQuint \image qeasingcurve-inoutquint.png -
167 \caption -
168 Easing curve for a quintic (t^5) function: -
169 acceleration until halfway, then deceleration. -
170 \value OutInQuint \image qeasingcurve-outinquint.png -
171 \caption -
172 Easing curve for a quintic (t^5) function: -
173 deceleration until halfway, then acceleration. -
174 \value InSine \image qeasingcurve-insine.png -
175 \caption -
176 Easing curve for a sinusoidal (sin(t)) function: -
177 accelerating from zero velocity. -
178 \value OutSine \image qeasingcurve-outsine.png -
179 \caption -
180 Easing curve for a sinusoidal (sin(t)) function: -
181 decelerating from zero velocity. -
182 \value InOutSine \image qeasingcurve-inoutsine.png -
183 \caption -
184 Easing curve for a sinusoidal (sin(t)) function: -
185 acceleration until halfway, then deceleration. -
186 \value OutInSine \image qeasingcurve-outinsine.png -
187 \caption -
188 Easing curve for a sinusoidal (sin(t)) function: -
189 deceleration until halfway, then acceleration. -
190 \value InExpo \image qeasingcurve-inexpo.png -
191 \caption -
192 Easing curve for an exponential (2^t) function: -
193 accelerating from zero velocity. -
194 \value OutExpo \image qeasingcurve-outexpo.png -
195 \caption -
196 Easing curve for an exponential (2^t) function: -
197 decelerating from zero velocity. -
198 \value InOutExpo \image qeasingcurve-inoutexpo.png -
199 \caption -
200 Easing curve for an exponential (2^t) function: -
201 acceleration until halfway, then deceleration. -
202 \value OutInExpo \image qeasingcurve-outinexpo.png -
203 \caption -
204 Easing curve for an exponential (2^t) function: -
205 deceleration until halfway, then acceleration. -
206 \value InCirc \image qeasingcurve-incirc.png -
207 \caption -
208 Easing curve for a circular (sqrt(1-t^2)) function: -
209 accelerating from zero velocity. -
210 \value OutCirc \image qeasingcurve-outcirc.png -
211 \caption -
212 Easing curve for a circular (sqrt(1-t^2)) function: -
213 decelerating from zero velocity. -
214 \value InOutCirc \image qeasingcurve-inoutcirc.png -
215 \caption -
216 Easing curve for a circular (sqrt(1-t^2)) function: -
217 acceleration until halfway, then deceleration. -
218 \value OutInCirc \image qeasingcurve-outincirc.png -
219 \caption -
220 Easing curve for a circular (sqrt(1-t^2)) function: -
221 deceleration until halfway, then acceleration. -
222 \value InElastic \image qeasingcurve-inelastic.png -
223 \caption -
224 Easing curve for an elastic -
225 (exponentially decaying sine wave) function: -
226 accelerating from zero velocity. The peak amplitude -
227 can be set with the \e amplitude parameter, and the -
228 period of decay by the \e period parameter. -
229 \value OutElastic \image qeasingcurve-outelastic.png -
230 \caption -
231 Easing curve for an elastic -
232 (exponentially decaying sine wave) function: -
233 decelerating from zero velocity. The peak amplitude -
234 can be set with the \e amplitude parameter, and the -
235 period of decay by the \e period parameter. -
236 \value InOutElastic \image qeasingcurve-inoutelastic.png -
237 \caption -
238 Easing curve for an elastic -
239 (exponentially decaying sine wave) function: -
240 acceleration until halfway, then deceleration. -
241 \value OutInElastic \image qeasingcurve-outinelastic.png -
242 \caption -
243 Easing curve for an elastic -
244 (exponentially decaying sine wave) function: -
245 deceleration until halfway, then acceleration. -
246 \value InBack \image qeasingcurve-inback.png -
247 \caption -
248 Easing curve for a back (overshooting -
249 cubic function: (s+1)*t^3 - s*t^2) easing in: -
250 accelerating from zero velocity. -
251 \value OutBack \image qeasingcurve-outback.png -
252 \caption -
253 Easing curve for a back (overshooting -
254 cubic function: (s+1)*t^3 - s*t^2) easing out: -
255 decelerating to zero velocity. -
256 \value InOutBack \image qeasingcurve-inoutback.png -
257 \caption -
258 Easing curve for a back (overshooting -
259 cubic function: (s+1)*t^3 - s*t^2) easing in/out: -
260 acceleration until halfway, then deceleration. -
261 \value OutInBack \image qeasingcurve-outinback.png -
262 \caption -
263 Easing curve for a back (overshooting -
264 cubic easing: (s+1)*t^3 - s*t^2) easing out/in: -
265 deceleration until halfway, then acceleration. -
266 \value InBounce \image qeasingcurve-inbounce.png -
267 \caption -
268 Easing curve for a bounce (exponentially -
269 decaying parabolic bounce) function: accelerating -
270 from zero velocity. -
271 \value OutBounce \image qeasingcurve-outbounce.png -
272 \caption -
273 Easing curve for a bounce (exponentially -
274 decaying parabolic bounce) function: decelerating -
275 from zero velocity. -
276 \value InOutBounce \image qeasingcurve-inoutbounce.png -
277 \caption -
278 Easing curve for a bounce (exponentially -
279 decaying parabolic bounce) function easing in/out: -
280 acceleration until halfway, then deceleration. -
281 \value OutInBounce \image qeasingcurve-outinbounce.png -
282 \caption -
283 Easing curve for a bounce (exponentially -
284 decaying parabolic bounce) function easing out/in: -
285 deceleration until halfway, then acceleration. -
286 \omitvalue InCurve -
287 \omitvalue OutCurve -
288 \omitvalue SineCurve -
289 \omitvalue CosineCurve -
290 \value BezierSpline Allows defining a custom easing curve using a cubic bezier spline -
291 \sa addCubicBezierSegment() -
292 \value TCBSpline Allows defining a custom easing curve using a TCB spline -
293 \sa addTCBSegment -
294 \value Custom This is returned if the user specified a custom curve type with -
295 setCustomType(). Note that you cannot call setType() with this value, -
296 but type() can return it. -
297 \omitvalue NCurveTypes -
298*/ -
299 -
300/*! -
301 \typedef QEasingCurve::EasingFunction -
302 -
303 This is a typedef for a pointer to a function with the following -
304 signature: -
305 -
306 \snippet code/src_corelib_tools_qeasingcurve.cpp 0 -
307*/ -
308 -
309#include "qeasingcurve.h" -
310#include <cmath> -
311 -
312#ifndef QT_NO_DEBUG_STREAM -
313#include <QtCore/qdebug.h> -
314#include <QtCore/qstring.h> -
315#endif -
316 -
317#ifndef QT_NO_DATASTREAM -
318#include <QtCore/qdatastream.h> -
319#endif -
320 -
321#include <QtCore/qpoint.h> -
322#include <QtCore/qvector.h> -
323 -
324QT_BEGIN_NAMESPACE -
325 -
326static bool isConfigFunction(QEasingCurve::Type type) -
327{ -
328 return (type >= QEasingCurve::InElastic
executed: return (type >= QEasingCurve::InElastic && type <= QEasingCurve::OutInBounce) || type == QEasingCurve::BezierSpline || type == QEasingCurve::TCBSpline;
Execution Count:1184
1184
329 && type <= QEasingCurve::OutInBounce) ||
executed: return (type >= QEasingCurve::InElastic && type <= QEasingCurve::OutInBounce) || type == QEasingCurve::BezierSpline || type == QEasingCurve::TCBSpline;
Execution Count:1184
1184
330 type == QEasingCurve::BezierSpline ||
executed: return (type >= QEasingCurve::InElastic && type <= QEasingCurve::OutInBounce) || type == QEasingCurve::BezierSpline || type == QEasingCurve::TCBSpline;
Execution Count:1184
1184
331 type == QEasingCurve::TCBSpline;
executed: return (type >= QEasingCurve::InElastic && type <= QEasingCurve::OutInBounce) || type == QEasingCurve::BezierSpline || type == QEasingCurve::TCBSpline;
Execution Count:1184
1184
332} -
333 -
334struct TCBPoint { -
335 QPointF _point; -
336 qreal _t; -
337 qreal _c; -
338 qreal _b; -
339 -
340 TCBPoint() {} -
341 TCBPoint(QPointF point, qreal t, qreal c, qreal b) : _point(point), _t(t), _c(c), _b(b) {}
executed: }
Execution Count:12
12
342 -
343 bool operator==(const TCBPoint &other) const -
344 { -
345 return _point == other._point &&
never executed: return _point == other._point && qFuzzyCompare(_t, other._t) && qFuzzyCompare(_c, other._c) && qFuzzyCompare(_b, other._b);
0
346 qFuzzyCompare(_t, other._t) &&
never executed: return _point == other._point && qFuzzyCompare(_t, other._t) && qFuzzyCompare(_c, other._c) && qFuzzyCompare(_b, other._b);
0
347 qFuzzyCompare(_c, other._c) &&
never executed: return _point == other._point && qFuzzyCompare(_t, other._t) && qFuzzyCompare(_c, other._c) && qFuzzyCompare(_b, other._b);
0
348 qFuzzyCompare(_b, other._b);
never executed: return _point == other._point && qFuzzyCompare(_t, other._t) && qFuzzyCompare(_c, other._c) && qFuzzyCompare(_b, other._b);
0
349 } -
350}; -
351 -
352 -
353typedef QVector<TCBPoint> TCBPoints; -
354 -
355class QEasingCurveFunction -
356{ -
357public: -
358 enum Type { In, Out, InOut, OutIn }; -
359 -
360 QEasingCurveFunction(QEasingCurveFunction::Type type = In, qreal period = 0.3, qreal amplitude = 1.0, -
361 qreal overshoot = 1.70158) -
362 : _t(type), _p(period), _a(amplitude), _o(overshoot) -
363 { }
executed: }
Execution Count:118
118
364 virtual ~QEasingCurveFunction() {} -
365 virtual qreal value(qreal t); -
366 virtual QEasingCurveFunction *copy() const; -
367 bool operator==(const QEasingCurveFunction &other) const; -
368 -
369 Type _t; -
370 qreal _p; -
371 qreal _a; -
372 qreal _o; -
373 QVector<QPointF> _bezierCurves; -
374 TCBPoints _tcbPoints; -
375 -
376}; -
377 -
378qreal QEasingCurveFunction::value(qreal t) -
379{ -
380 return t;
never executed: return t;
0
381} -
382 -
383QEasingCurveFunction *QEasingCurveFunction::copy() const -
384{ -
385 QEasingCurveFunction *rv = new QEasingCurveFunction(_t, _p, _a, _o);
never executed (the execution status of this line is deduced): QEasingCurveFunction *rv = new QEasingCurveFunction(_t, _p, _a, _o);
-
386 rv->_bezierCurves = _bezierCurves;
never executed (the execution status of this line is deduced): rv->_bezierCurves = _bezierCurves;
-
387 rv->_tcbPoints = _tcbPoints;
never executed (the execution status of this line is deduced): rv->_tcbPoints = _tcbPoints;
-
388 return rv;
never executed: return rv;
0
389} -
390 -
391bool QEasingCurveFunction::operator==(const QEasingCurveFunction &other) const -
392{ -
393 return _t == other._t &&
executed: return _t == other._t && qFuzzyCompare(_p, other._p) && qFuzzyCompare(_a, other._a) && qFuzzyCompare(_o, other._o) && _bezierCurves == other._bezierCurves && _tcbPoints == other._tcbPoints;
Execution Count:27
27
394 qFuzzyCompare(_p, other._p) &&
executed: return _t == other._t && qFuzzyCompare(_p, other._p) && qFuzzyCompare(_a, other._a) && qFuzzyCompare(_o, other._o) && _bezierCurves == other._bezierCurves && _tcbPoints == other._tcbPoints;
Execution Count:27
27
395 qFuzzyCompare(_a, other._a) &&
executed: return _t == other._t && qFuzzyCompare(_p, other._p) && qFuzzyCompare(_a, other._a) && qFuzzyCompare(_o, other._o) && _bezierCurves == other._bezierCurves && _tcbPoints == other._tcbPoints;
Execution Count:27
27
396 qFuzzyCompare(_o, other._o) &&
executed: return _t == other._t && qFuzzyCompare(_p, other._p) && qFuzzyCompare(_a, other._a) && qFuzzyCompare(_o, other._o) && _bezierCurves == other._bezierCurves && _tcbPoints == other._tcbPoints;
Execution Count:27
27
397 _bezierCurves == other._bezierCurves &&
executed: return _t == other._t && qFuzzyCompare(_p, other._p) && qFuzzyCompare(_a, other._a) && qFuzzyCompare(_o, other._o) && _bezierCurves == other._bezierCurves && _tcbPoints == other._tcbPoints;
Execution Count:27
27
398 _tcbPoints == other._tcbPoints;
executed: return _t == other._t && qFuzzyCompare(_p, other._p) && qFuzzyCompare(_a, other._a) && qFuzzyCompare(_o, other._o) && _bezierCurves == other._bezierCurves && _tcbPoints == other._tcbPoints;
Execution Count:27
27
399} -
400 -
401QT_BEGIN_INCLUDE_NAMESPACE -
402#include "../../3rdparty/easing/easing.cpp" -
403QT_END_INCLUDE_NAMESPACE -
404 -
405class QEasingCurvePrivate -
406{ -
407public: -
408 QEasingCurvePrivate() -
409 : type(QEasingCurve::Linear), -
410 config(0), -
411 func(&easeNone) -
412 { }
executed: }
Execution Count:2554
2554
413 QEasingCurvePrivate(const QEasingCurvePrivate &other) -
414 : type(other.type), -
415 config(other.config ? other.config->copy() : 0), -
416 func(other.func) -
417 { }
executed: }
Execution Count:1239
1239
418 ~QEasingCurvePrivate() { delete config; }
executed: }
Execution Count:3681
3681
419 void setType_helper(QEasingCurve::Type); -
420 -
421 QEasingCurve::Type type; -
422 QEasingCurveFunction *config; -
423 QEasingCurve::EasingFunction func; -
424}; -
425 -
426struct BezierEase : public QEasingCurveFunction -
427{ -
428 struct SingleCubicBezier { -
429 qreal p0x, p0y; -
430 qreal p1x, p1y; -
431 qreal p2x, p2y; -
432 qreal p3x, p3y; -
433 }; -
434 -
435 bool _init; -
436 bool _valid; -
437 QVector<SingleCubicBezier> _curves; -
438 int _curveCount; -
439 QVector<qreal> _intervals; -
440 -
441 BezierEase() -
442 : QEasingCurveFunction(InOut), _init(false), _valid(false), _curves(10), _intervals(10) -
443 { }
executed: }
Execution Count:7
7
444 -
445 void init() -
446 { -
447 if (_bezierCurves.last() == QPointF(1.0, 1.0)) {
partially evaluated: _bezierCurves.last() == QPointF(1.0, 1.0)
TRUEFALSE
yes
Evaluation Count:7
no
Evaluation Count:0
0-7
448 _init = true;
executed (the execution status of this line is deduced): _init = true;
-
449 _curveCount = _bezierCurves.count() / 3;
executed (the execution status of this line is deduced): _curveCount = _bezierCurves.count() / 3;
-
450 -
451 for (int i=0; i < _curveCount; i++) {
evaluated: i < _curveCount
TRUEFALSE
yes
Evaluation Count:19
yes
Evaluation Count:7
7-19
452 _intervals[i] = _bezierCurves.at(i * 3 + 2).x();
executed (the execution status of this line is deduced): _intervals[i] = _bezierCurves.at(i * 3 + 2).x();
-
453 -
454 if (i == 0) {
evaluated: i == 0
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:12
7-12
455 _curves[0].p0x = 0.0;
executed (the execution status of this line is deduced): _curves[0].p0x = 0.0;
-
456 _curves[0].p0y = 0.0;
executed (the execution status of this line is deduced): _curves[0].p0y = 0.0;
-
457 -
458 _curves[0].p1x = _bezierCurves.at(0).x();
executed (the execution status of this line is deduced): _curves[0].p1x = _bezierCurves.at(0).x();
-
459 _curves[0].p1y = _bezierCurves.at(0).y();
executed (the execution status of this line is deduced): _curves[0].p1y = _bezierCurves.at(0).y();
-
460 -
461 _curves[0].p2x = _bezierCurves.at(1).x();
executed (the execution status of this line is deduced): _curves[0].p2x = _bezierCurves.at(1).x();
-
462 _curves[0].p2y = _bezierCurves.at(1).y();
executed (the execution status of this line is deduced): _curves[0].p2y = _bezierCurves.at(1).y();
-
463 -
464 _curves[0].p3x = _bezierCurves.at(2).x();
executed (the execution status of this line is deduced): _curves[0].p3x = _bezierCurves.at(2).x();
-
465 _curves[0].p3y = _bezierCurves.at(2).y();
executed (the execution status of this line is deduced): _curves[0].p3y = _bezierCurves.at(2).y();
-
466 -
467 } else if (i == (_curveCount - 1)) {
executed: }
Execution Count:7
evaluated: i == (_curveCount - 1)
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:5
5-7
468 _curves[i].p0x = _bezierCurves.at(_bezierCurves.count() - 4).x();
executed (the execution status of this line is deduced): _curves[i].p0x = _bezierCurves.at(_bezierCurves.count() - 4).x();
-
469 _curves[i].p0y = _bezierCurves.at(_bezierCurves.count() - 4).y();
executed (the execution status of this line is deduced): _curves[i].p0y = _bezierCurves.at(_bezierCurves.count() - 4).y();
-
470 -
471 _curves[i].p1x = _bezierCurves.at(_bezierCurves.count() - 3).x();
executed (the execution status of this line is deduced): _curves[i].p1x = _bezierCurves.at(_bezierCurves.count() - 3).x();
-
472 _curves[i].p1y = _bezierCurves.at(_bezierCurves.count() - 3).y();
executed (the execution status of this line is deduced): _curves[i].p1y = _bezierCurves.at(_bezierCurves.count() - 3).y();
-
473 -
474 _curves[i].p2x = _bezierCurves.at(_bezierCurves.count() - 2).x();
executed (the execution status of this line is deduced): _curves[i].p2x = _bezierCurves.at(_bezierCurves.count() - 2).x();
-
475 _curves[i].p2y = _bezierCurves.at(_bezierCurves.count() - 2).y();
executed (the execution status of this line is deduced): _curves[i].p2y = _bezierCurves.at(_bezierCurves.count() - 2).y();
-
476 -
477 _curves[i].p3x = _bezierCurves.at(_bezierCurves.count() - 1).x();
executed (the execution status of this line is deduced): _curves[i].p3x = _bezierCurves.at(_bezierCurves.count() - 1).x();
-
478 _curves[i].p3y = _bezierCurves.at(_bezierCurves.count() - 1).y();
executed (the execution status of this line is deduced): _curves[i].p3y = _bezierCurves.at(_bezierCurves.count() - 1).y();
-
479 } else {
executed: }
Execution Count:7
7
480 _curves[i].p0x = _bezierCurves.at(i * 3 - 1).x();
executed (the execution status of this line is deduced): _curves[i].p0x = _bezierCurves.at(i * 3 - 1).x();
-
481 _curves[i].p0y = _bezierCurves.at(i * 3 - 1).y();
executed (the execution status of this line is deduced): _curves[i].p0y = _bezierCurves.at(i * 3 - 1).y();
-
482 -
483 _curves[i].p1x = _bezierCurves.at(i * 3).x();
executed (the execution status of this line is deduced): _curves[i].p1x = _bezierCurves.at(i * 3).x();
-
484 _curves[i].p1y = _bezierCurves.at(i * 3).y();
executed (the execution status of this line is deduced): _curves[i].p1y = _bezierCurves.at(i * 3).y();
-
485 -
486 _curves[i].p2x = _bezierCurves.at(i * 3 + 1).x();
executed (the execution status of this line is deduced): _curves[i].p2x = _bezierCurves.at(i * 3 + 1).x();
-
487 _curves[i].p2y = _bezierCurves.at(i * 3 + 1).y();
executed (the execution status of this line is deduced): _curves[i].p2y = _bezierCurves.at(i * 3 + 1).y();
-
488 -
489 _curves[i].p3x = _bezierCurves.at(i * 3 + 2).x();
executed (the execution status of this line is deduced): _curves[i].p3x = _bezierCurves.at(i * 3 + 2).x();
-
490 _curves[i].p3y = _bezierCurves.at(i * 3 + 2).y();
executed (the execution status of this line is deduced): _curves[i].p3y = _bezierCurves.at(i * 3 + 2).y();
-
491 }
executed: }
Execution Count:5
5
492 } -
493 _valid = true;
executed (the execution status of this line is deduced): _valid = true;
-
494 } else {
executed: }
Execution Count:7
7
495 _valid = false;
never executed (the execution status of this line is deduced): _valid = false;
-
496 }
never executed: }
0
497 } -
498 -
499 QEasingCurveFunction *copy() const -
500 { -
501 BezierEase *rv = new BezierEase();
never executed (the execution status of this line is deduced): BezierEase *rv = new BezierEase();
-
502 rv->_t = _t;
never executed (the execution status of this line is deduced): rv->_t = _t;
-
503 rv->_p = _p;
never executed (the execution status of this line is deduced): rv->_p = _p;
-
504 rv->_a = _a;
never executed (the execution status of this line is deduced): rv->_a = _a;
-
505 rv->_o = _o;
never executed (the execution status of this line is deduced): rv->_o = _o;
-
506 rv->_bezierCurves = _bezierCurves;
never executed (the execution status of this line is deduced): rv->_bezierCurves = _bezierCurves;
-
507 rv->_tcbPoints = _tcbPoints;
never executed (the execution status of this line is deduced): rv->_tcbPoints = _tcbPoints;
-
508 return rv;
never executed: return rv;
0
509 } -
510 -
511 void getBezierSegment(SingleCubicBezier * &singleCubicBezier, qreal x) -
512 { -
513 -
514 int currentSegment = 0;
executed (the execution status of this line is deduced): int currentSegment = 0;
-
515 -
516 while (currentSegment < _curveCount) {
partially evaluated: currentSegment < _curveCount
TRUEFALSE
yes
Evaluation Count:88
no
Evaluation Count:0
0-88
517 if (x <= _intervals.data()[currentSegment])
evaluated: x <= _intervals.data()[currentSegment]
TRUEFALSE
yes
Evaluation Count:47
yes
Evaluation Count:41
41-47
518 break;
executed: break;
Execution Count:47
47
519 currentSegment++;
executed (the execution status of this line is deduced): currentSegment++;
-
520 }
executed: }
Execution Count:41
41
521 -
522 singleCubicBezier = &_curves.data()[currentSegment];
executed (the execution status of this line is deduced): singleCubicBezier = &_curves.data()[currentSegment];
-
523 }
executed: }
Execution Count:47
47
524 -
525 -
526 qreal static inline newtonIteration(const SingleCubicBezier &singleCubicBezier, qreal t, qreal x) -
527 { -
528 qreal currentXValue = evaluateForX(singleCubicBezier, t);
never executed (the execution status of this line is deduced): qreal currentXValue = evaluateForX(singleCubicBezier, t);
-
529 -
530 const qreal newT = t - (currentXValue - x) / evaluateDerivateForX(singleCubicBezier, t);
never executed (the execution status of this line is deduced): const qreal newT = t - (currentXValue - x) / evaluateDerivateForX(singleCubicBezier, t);
-
531 -
532 return newT;
never executed: return newT;
0
533 } -
534 -
535 qreal value(qreal x) -
536 { -
537 Q_ASSERT(_bezierCurves.count() % 3 == 0);
executed (the execution status of this line is deduced): qt_noop();
-
538 -
539 if (_bezierCurves.isEmpty()) {
partially evaluated: _bezierCurves.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:47
0-47
540 return x;
never executed: return x;
0
541 } -
542 -
543 if (!_init)
evaluated: !_init
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:40
7-40
544 init();
executed: init();
Execution Count:7
7
545 -
546 if (!_valid) {
partially evaluated: !_valid
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:47
0-47
547 qWarning("QEasingCurve: Invalid bezier curve");
never executed (the execution status of this line is deduced): QMessageLogger("tools/qeasingcurve.cpp", 547, __PRETTY_FUNCTION__).warning("QEasingCurve: Invalid bezier curve");
-
548 return x;
never executed: return x;
0
549 } -
550 SingleCubicBezier *singleCubicBezier = 0;
executed (the execution status of this line is deduced): SingleCubicBezier *singleCubicBezier = 0;
-
551 getBezierSegment(singleCubicBezier, x);
executed (the execution status of this line is deduced): getBezierSegment(singleCubicBezier, x);
-
552 -
553 return evaluateSegmentForY(*singleCubicBezier, findTForX(*singleCubicBezier, x));
executed: return evaluateSegmentForY(*singleCubicBezier, findTForX(*singleCubicBezier, x));
Execution Count:47
47
554 } -
555 -
556 qreal static inline evaluateSegmentForY(const SingleCubicBezier &singleCubicBezier, qreal t) -
557 { -
558 const qreal p0 = singleCubicBezier.p0y;
executed (the execution status of this line is deduced): const qreal p0 = singleCubicBezier.p0y;
-
559 const qreal p1 = singleCubicBezier.p1y;
executed (the execution status of this line is deduced): const qreal p1 = singleCubicBezier.p1y;
-
560 const qreal p2 = singleCubicBezier.p2y;
executed (the execution status of this line is deduced): const qreal p2 = singleCubicBezier.p2y;
-
561 const qreal p3 = singleCubicBezier.p3y;
executed (the execution status of this line is deduced): const qreal p3 = singleCubicBezier.p3y;
-
562 -
563 const qreal s = 1 - t;
executed (the execution status of this line is deduced): const qreal s = 1 - t;
-
564 -
565 const qreal s_squared = s*s;
executed (the execution status of this line is deduced): const qreal s_squared = s*s;
-
566 const qreal t_squared = t*t;
executed (the execution status of this line is deduced): const qreal t_squared = t*t;
-
567 -
568 const qreal s_cubic = s_squared * s;
executed (the execution status of this line is deduced): const qreal s_cubic = s_squared * s;
-
569 const qreal t_cubic = t_squared * t;
executed (the execution status of this line is deduced): const qreal t_cubic = t_squared * t;
-
570 -
571 return s_cubic * p0 + 3 * s_squared * t * p1 + 3 * s * t_squared * p2 + t_cubic * p3;
executed: return s_cubic * p0 + 3 * s_squared * t * p1 + 3 * s * t_squared * p2 + t_cubic * p3;
Execution Count:47
47
572 } -
573 -
574 qreal static inline evaluateForX(const SingleCubicBezier &singleCubicBezier, qreal t) -
575 { -
576 const qreal p0 = singleCubicBezier.p0x;
never executed (the execution status of this line is deduced): const qreal p0 = singleCubicBezier.p0x;
-
577 const qreal p1 = singleCubicBezier.p1x;
never executed (the execution status of this line is deduced): const qreal p1 = singleCubicBezier.p1x;
-
578 const qreal p2 = singleCubicBezier.p2x;
never executed (the execution status of this line is deduced): const qreal p2 = singleCubicBezier.p2x;
-
579 const qreal p3 = singleCubicBezier.p3x;
never executed (the execution status of this line is deduced): const qreal p3 = singleCubicBezier.p3x;
-
580 -
581 const qreal s = 1 - t;
never executed (the execution status of this line is deduced): const qreal s = 1 - t;
-
582 -
583 const qreal s_squared = s*s;
never executed (the execution status of this line is deduced): const qreal s_squared = s*s;
-
584 const qreal t_squared = t*t;
never executed (the execution status of this line is deduced): const qreal t_squared = t*t;
-
585 -
586 const qreal s_cubic = s_squared * s;
never executed (the execution status of this line is deduced): const qreal s_cubic = s_squared * s;
-
587 const qreal t_cubic = t_squared * t;
never executed (the execution status of this line is deduced): const qreal t_cubic = t_squared * t;
-
588 -
589 return s_cubic * p0 + 3 * s_squared * t * p1 + 3 * s * t_squared * p2 + t_cubic * p3;
never executed: return s_cubic * p0 + 3 * s_squared * t * p1 + 3 * s * t_squared * p2 + t_cubic * p3;
0
590 } -
591 -
592 qreal static inline evaluateDerivateForX(const SingleCubicBezier &singleCubicBezier, qreal t) -
593 { -
594 const qreal p0 = singleCubicBezier.p0x;
never executed (the execution status of this line is deduced): const qreal p0 = singleCubicBezier.p0x;
-
595 const qreal p1 = singleCubicBezier.p1x;
never executed (the execution status of this line is deduced): const qreal p1 = singleCubicBezier.p1x;
-
596 const qreal p2 = singleCubicBezier.p2x;
never executed (the execution status of this line is deduced): const qreal p2 = singleCubicBezier.p2x;
-
597 const qreal p3 = singleCubicBezier.p3x;
never executed (the execution status of this line is deduced): const qreal p3 = singleCubicBezier.p3x;
-
598 -
599 const qreal t_squared = t*t;
never executed (the execution status of this line is deduced): const qreal t_squared = t*t;
-
600 -
601 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;
never executed: 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;
0
602 } -
603 -
604 qreal static inline _cbrt(qreal d) -
605 { -
606 qreal sign = 1;
executed (the execution status of this line is deduced): qreal sign = 1;
-
607 if (d < 0)
evaluated: d < 0
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:10
10-14
608 sign = -1;
executed: sign = -1;
Execution Count:14
14
609 d = d * sign;
executed (the execution status of this line is deduced): d = d * sign;
-
610 -
611 qreal t_i = _fast_cbrt(d);
executed (the execution status of this line is deduced): qreal t_i = _fast_cbrt(d);
-
612 -
613 //one step of Halley's Method to get a better approximation -
614 const qreal t_i_cubic = t_i * t_i * t_i;
executed (the execution status of this line is deduced): const qreal t_i_cubic = t_i * t_i * t_i;
-
615 qreal t = t_i * (t_i_cubic + d + d) / (t_i_cubic + t_i_cubic + d);
executed (the execution status of this line is deduced): qreal t = t_i * (t_i_cubic + d + d) / (t_i_cubic + t_i_cubic + d);
-
616 -
617 //another step -
618 /*t_i = t; -
619 t_i_cubic = pow(t_i, 3); -
620 t = t_i * (t_i_cubic + d + d) / (t_i_cubic + t_i_cubic + d);*/ -
621 -
622 return t * sign;
executed: return t * sign;
Execution Count:24
24
623 } -
624 -
625 float static inline _fast_cbrt(float x) -
626 { -
627 union {
never executed (the execution status of this line is deduced): union {
-
628 float f;
never executed (the execution status of this line is deduced): float f;
-
629 quint32 i;
never executed (the execution status of this line is deduced): quint32 i;
-
630 } ux;
never executed (the execution status of this line is deduced): } ux;
-
631 -
632 const unsigned int B1 = 709921077;
never executed (the execution status of this line is deduced): const unsigned int B1 = 709921077;
-
633 -
634 ux.f = x;
never executed (the execution status of this line is deduced): ux.f = x;
-
635 ux.i = (ux.i / 3 + B1);
never executed (the execution status of this line is deduced): ux.i = (ux.i / 3 + B1);
-
636 -
637 return ux.f;
never executed: return ux.f;
0
638 } -
639 -
640 double static inline _fast_cbrt(double d) -
641 { -
642 union {
executed (the execution status of this line is deduced): union {
-
643 double d;
executed (the execution status of this line is deduced): double d;
-
644 quint32 pt[2];
executed (the execution status of this line is deduced): quint32 pt[2];
-
645 } ut, ux;
executed (the execution status of this line is deduced): } ut, ux;
-
646 -
647 const unsigned int B1 = 715094163;
executed (the execution status of this line is deduced): const unsigned int B1 = 715094163;
-
648 -
649#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN -
650 const int h0 = 1;
executed (the execution status of this line is deduced): const int h0 = 1;
-
651#else -
652 const int h0 = 0; -
653#endif -
654 ut.d = 0.0;
executed (the execution status of this line is deduced): ut.d = 0.0;
-
655 ux.d = d;
executed (the execution status of this line is deduced): ux.d = d;
-
656 -
657 quint32 hx = ux.pt[h0]; //high word of d
executed (the execution status of this line is deduced): quint32 hx = ux.pt[h0];
-
658 ut.pt[h0] = hx / 3 + B1;
executed (the execution status of this line is deduced): ut.pt[h0] = hx / 3 + B1;
-
659 -
660 return ut.d;
executed: return ut.d;
Execution Count:24
24
661 } -
662 -
663 qreal static inline _acos(qreal x) -
664 { -
665 return sqrt(1-x)*(1.5707963267948966192313216916398f + x*(-0.213300989f + x*(0.077980478f + x*-0.02164095f)));
never executed: return sqrt(1-x)*(1.5707963267948966192313216916398f + x*(-0.213300989f + x*(0.077980478f + x*-0.02164095f)));
0
666 } -
667 -
668 qreal static inline _cos(qreal x) //super fast _cos -
669 { -
670 const qreal pi_times2 = 2 * M_PI;
never executed (the execution status of this line is deduced): const qreal pi_times2 = 2 * 3.14159265358979323846;
-
671 const qreal pi_neg = -1 * M_PI;
never executed (the execution status of this line is deduced): const qreal pi_neg = -1 * 3.14159265358979323846;
-
672 const qreal pi_by2 = M_PI / 2.0;
never executed (the execution status of this line is deduced): const qreal pi_by2 = 3.14159265358979323846 / 2.0;
-
673 -
674 x += pi_by2; //the polynom is for sin
never executed (the execution status of this line is deduced): x += pi_by2;
-
675 -
676 if (x < pi_neg)
never evaluated: x < pi_neg
0
677 x += pi_times2;
never executed: x += pi_times2;
0
678 else if (x > M_PI)
never evaluated: x > 3.14159265358979323846
0
679 x -= pi_times2;
never executed: x -= pi_times2;
0
680 -
681 const qreal a = 0.405284735;
never executed (the execution status of this line is deduced): const qreal a = 0.405284735;
-
682 const qreal b = 1.27323954;
never executed (the execution status of this line is deduced): const qreal b = 1.27323954;
-
683 -
684 const qreal x_squared = x * x;
never executed (the execution status of this line is deduced): const qreal x_squared = x * x;
-
685 -
686 if (x < 0) {
never evaluated: x < 0
0
687 qreal cos = b * x + a * x_squared;
never executed (the execution status of this line is deduced): qreal cos = b * x + a * x_squared;
-
688 -
689 if (cos < 0)
never evaluated: cos < 0
0
690 return 0.225 * (cos * -1 * cos - cos) + cos;
never executed: return 0.225 * (cos * -1 * cos - cos) + cos;
0
691 return 0.225 * (cos * cos - cos) + cos;
never executed: return 0.225 * (cos * cos - cos) + cos;
0
692 } //else -
693 -
694 qreal cos = b * x - a * x_squared;
never executed (the execution status of this line is deduced): qreal cos = b * x - a * x_squared;
-
695 -
696 if (cos < 0)
never evaluated: cos < 0
0
697 return 0.225 * (cos * 1 *-cos - cos) + cos;
never executed: return 0.225 * (cos * 1 *-cos - cos) + cos;
0
698 return 0.225 * (cos * cos - cos) + cos;
never executed: return 0.225 * (cos * cos - cos) + cos;
0
699 } -
700 -
701 bool static inline inRange(qreal f) -
702 { -
703 return (f >= -0.01 && f <= 1.01);
executed: return (f >= -0.01 && f <= 1.01);
Execution Count:40
40
704 } -
705 -
706 void static inline cosacos(qreal x, qreal &s1, qreal &s2, qreal &s3 ) -
707 { -
708 //This function has no proper algebraic representation in real numbers. -
709 //We use approximations instead -
710 -
711 const qreal x_squared = x * x;
executed (the execution status of this line is deduced): const qreal x_squared = x * x;
-
712 const qreal x_plus_one_sqrt = sqrt(1.0 + x);
executed (the execution status of this line is deduced): const qreal x_plus_one_sqrt = sqrt(1.0 + x);
-
713 const qreal one_minus_x_sqrt = sqrt(1.0 - x);
executed (the execution status of this line is deduced): const qreal one_minus_x_sqrt = sqrt(1.0 - x);
-
714 -
715 //cos(acos(x) / 3) -
716 //s1 = _cos(_acos(x) / 3); -
717 s1 = 0.463614 - 0.0347815 * x + 0.00218245 * x_squared + 0.402421 * x_plus_one_sqrt;
executed (the execution status of this line is deduced): s1 = 0.463614 - 0.0347815 * x + 0.00218245 * x_squared + 0.402421 * x_plus_one_sqrt;
-
718 -
719 //cos(acos((x) - M_PI) / 3) -
720 //s3 = _cos((_acos(x) - M_PI) / 3); -
721 s3 = 0.463614 + 0.402421 * one_minus_x_sqrt + 0.0347815 * x + 0.00218245 * x_squared;
executed (the execution status of this line is deduced): s3 = 0.463614 + 0.402421 * one_minus_x_sqrt + 0.0347815 * x + 0.00218245 * x_squared;
-
722 -
723 //cos((acos(x) + M_PI) / 3) -
724 //s2 = _cos((_acos(x) + M_PI) / 3); -
725 s2 = -0.401644 * one_minus_x_sqrt - 0.0686804 * x + 0.401644 * x_plus_one_sqrt;
executed (the execution status of this line is deduced): s2 = -0.401644 * one_minus_x_sqrt - 0.0686804 * x + 0.401644 * x_plus_one_sqrt;
-
726 }
executed: }
Execution Count:28
28
727 -
728 qreal static inline singleRealSolutionForCubic(qreal a, qreal b, qreal c) -
729 { -
730 //returns the real solutiuon in [0..1] -
731 //We use the Cardano formula -
732 -
733 //substituiton: x = z - a/3 -
734 // z^3+pz+q=0 -
735 -
736 if (c < 0.000001 && c > -0.000001)
evaluated: c < 0.000001
TRUEFALSE
yes
Evaluation Count:18
yes
Evaluation Count:29
evaluated: c > -0.000001
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:11
7-29
737 return 0;
executed: return 0;
Execution Count:7
7
738 -
739 const qreal a_by3 = a / 3.0;
executed (the execution status of this line is deduced): const qreal a_by3 = a / 3.0;
-
740 -
741 const qreal a_cubic = a * a * a;
executed (the execution status of this line is deduced): const qreal a_cubic = a * a * a;
-
742 -
743 const qreal p = b - a * a_by3;
executed (the execution status of this line is deduced): const qreal p = b - a * a_by3;
-
744 const qreal q = 2.0 * a_cubic / 27.0 - a * b / 3.0 + c;
executed (the execution status of this line is deduced): const qreal q = 2.0 * a_cubic / 27.0 - a * b / 3.0 + c;
-
745 -
746 const qreal q_squared = q * q;
executed (the execution status of this line is deduced): const qreal q_squared = q * q;
-
747 const qreal p_cubic = p * p * p;
executed (the execution status of this line is deduced): const qreal p_cubic = p * p * p;
-
748 const qreal D = 0.25 * q_squared + p_cubic / 27.0;
executed (the execution status of this line is deduced): const qreal D = 0.25 * q_squared + p_cubic / 27.0;
-
749 -
750 if (D >= 0) {
evaluated: D >= 0
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:28
12-28
751 const qreal D_sqrt = sqrt(D);
executed (the execution status of this line is deduced): const qreal D_sqrt = sqrt(D);
-
752 qreal u = _cbrt( -q * 0.5 + D_sqrt);
executed (the execution status of this line is deduced): qreal u = _cbrt( -q * 0.5 + D_sqrt);
-
753 qreal v = _cbrt( -q * 0.5 - D_sqrt);
executed (the execution status of this line is deduced): qreal v = _cbrt( -q * 0.5 - D_sqrt);
-
754 qreal z1 = u + v;
executed (the execution status of this line is deduced): qreal z1 = u + v;
-
755 -
756 qreal t1 = z1 - a_by3;
executed (the execution status of this line is deduced): qreal t1 = z1 - a_by3;
-
757 -
758 if (inRange(t1))
evaluated: inRange(t1)
TRUEFALSE
yes
Evaluation Count:11
yes
Evaluation Count:1
1-11
759 return t1;
executed: return t1;
Execution Count:11
11
760 qreal z2 = -1 *u;
executed (the execution status of this line is deduced): qreal z2 = -1 *u;
-
761 qreal t2 = z2 - a_by3;
executed (the execution status of this line is deduced): qreal t2 = z2 - a_by3;
-
762 return t2;
executed: return t2;
Execution Count:1
1
763 } -
764 -
765 //casus irreducibilis -
766 const qreal p_minus_sqrt = sqrt(-p);
executed (the execution status of this line is deduced): const qreal p_minus_sqrt = sqrt(-p);
-
767 -
768 //const qreal f = sqrt(4.0 / 3.0 * -p); -
769 const qreal f = sqrt(4.0 / 3.0) * p_minus_sqrt;
executed (the execution status of this line is deduced): const qreal f = sqrt(4.0 / 3.0) * p_minus_sqrt;
-
770 -
771 //const qreal sqrtP = sqrt(27.0 / -p_cubic); -
772 const qreal sqrtP = -3.0*sqrt(3.0) / (p_minus_sqrt * p);
executed (the execution status of this line is deduced): const qreal sqrtP = -3.0*sqrt(3.0) / (p_minus_sqrt * p);
-
773 -
774 -
775 const qreal g = -q * 0.5 * sqrtP;
executed (the execution status of this line is deduced): const qreal g = -q * 0.5 * sqrtP;
-
776 -
777 qreal s1;
executed (the execution status of this line is deduced): qreal s1;
-
778 qreal s2;
executed (the execution status of this line is deduced): qreal s2;
-
779 qreal s3;
executed (the execution status of this line is deduced): qreal s3;
-
780 -
781 cosacos(g, s1, s2, s3);
executed (the execution status of this line is deduced): cosacos(g, s1, s2, s3);
-
782 -
783 qreal z1 = -1* f * s2;
executed (the execution status of this line is deduced): qreal z1 = -1* f * s2;
-
784 qreal t1 = z1 - a_by3;
executed (the execution status of this line is deduced): qreal t1 = z1 - a_by3;
-
785 if (inRange(t1))
partially evaluated: inRange(t1)
TRUEFALSE
yes
Evaluation Count:28
no
Evaluation Count:0
0-28
786 return t1;
executed: return t1;
Execution Count:28
28
787 -
788 qreal z2 = f * s1;
never executed (the execution status of this line is deduced): qreal z2 = f * s1;
-
789 qreal t2 = z2 - a_by3;
never executed (the execution status of this line is deduced): qreal t2 = z2 - a_by3;
-
790 if (inRange(t2))
never evaluated: inRange(t2)
0
791 return t2;
never executed: return t2;
0
792 -
793 qreal z3 = -1 * f * s3;
never executed (the execution status of this line is deduced): qreal z3 = -1 * f * s3;
-
794 qreal t3 = z3 - a_by3;
never executed (the execution status of this line is deduced): qreal t3 = z3 - a_by3;
-
795 return t3;
never executed: return t3;
0
796 } -
797 -
798 qreal static inline findTForX(const SingleCubicBezier &singleCubicBezier, qreal x) -
799 { -
800 const qreal p0 = singleCubicBezier.p0x;
executed (the execution status of this line is deduced): const qreal p0 = singleCubicBezier.p0x;
-
801 const qreal p1 = singleCubicBezier.p1x;
executed (the execution status of this line is deduced): const qreal p1 = singleCubicBezier.p1x;
-
802 const qreal p2 = singleCubicBezier.p2x;
executed (the execution status of this line is deduced): const qreal p2 = singleCubicBezier.p2x;
-
803 const qreal p3 = singleCubicBezier.p3x;
executed (the execution status of this line is deduced): const qreal p3 = singleCubicBezier.p3x;
-
804 -
805 const qreal factorT3 = p3 - p0 + 3 * p1 - 3 * p2;
executed (the execution status of this line is deduced): const qreal factorT3 = p3 - p0 + 3 * p1 - 3 * p2;
-
806 const qreal factorT2 = 3 * p0 - 6 * p1 + 3 * p2;
executed (the execution status of this line is deduced): const qreal factorT2 = 3 * p0 - 6 * p1 + 3 * p2;
-
807 const qreal factorT1 = -3 * p0 + 3 * p1;
executed (the execution status of this line is deduced): const qreal factorT1 = -3 * p0 + 3 * p1;
-
808 const qreal factorT0 = p0 - x;
executed (the execution status of this line is deduced): const qreal factorT0 = p0 - x;
-
809 -
810 const qreal a = factorT2 / factorT3;
executed (the execution status of this line is deduced): const qreal a = factorT2 / factorT3;
-
811 const qreal b = factorT1 / factorT3;
executed (the execution status of this line is deduced): const qreal b = factorT1 / factorT3;
-
812 const qreal c = factorT0 / factorT3;
executed (the execution status of this line is deduced): const qreal c = factorT0 / factorT3;
-
813 -
814 return singleRealSolutionForCubic(a, b, c);
executed: return singleRealSolutionForCubic(a, b, c);
Execution Count:47
47
815 -
816 //one new iteration to increase numeric stability -
817 //return newtonIteration(singleCubicBezier, t, x); -
818 } -
819}; -
820 -
821struct TCBEase : public BezierEase -
822{ -
823 qreal value(qreal x) -
824 { -
825 Q_ASSERT(_bezierCurves.count() % 3 == 0);
executed (the execution status of this line is deduced): qt_noop();
-
826 -
827 if (_bezierCurves.isEmpty()) {
partially evaluated: _bezierCurves.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:28
0-28
828 qWarning("QEasingCurve: Invalid tcb curve");
never executed (the execution status of this line is deduced): QMessageLogger("tools/qeasingcurve.cpp", 828, __PRETTY_FUNCTION__).warning("QEasingCurve: Invalid tcb curve");
-
829 return x;
never executed: return x;
0
830 } -
831 -
832 return BezierEase::value(x);
executed: return BezierEase::value(x);
Execution Count:28
28
833 } -
834 -
835}; -
836 -
837struct ElasticEase : public QEasingCurveFunction -
838{ -
839 ElasticEase(Type type) -
840 : QEasingCurveFunction(type, qreal(0.3), qreal(1.0)) -
841 { }
executed: }
Execution Count:39
39
842 -
843 QEasingCurveFunction *copy() const -
844 { -
845 ElasticEase *rv = new ElasticEase(_t);
executed (the execution status of this line is deduced): ElasticEase *rv = new ElasticEase(_t);
-
846 rv->_p = _p;
executed (the execution status of this line is deduced): rv->_p = _p;
-
847 rv->_a = _a;
executed (the execution status of this line is deduced): rv->_a = _a;
-
848 rv->_bezierCurves = _bezierCurves;
executed (the execution status of this line is deduced): rv->_bezierCurves = _bezierCurves;
-
849 rv->_tcbPoints = _tcbPoints;
executed (the execution status of this line is deduced): rv->_tcbPoints = _tcbPoints;
-
850 return rv;
executed: return rv;
Execution Count:4
4
851 } -
852 -
853 qreal value(qreal t) -
854 { -
855 qreal p = (_p < 0) ? qreal(0.3) : _p;
partially evaluated: (_p < 0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:44
0-44
856 qreal a = (_a < 0) ? qreal(1.0) : _a;
partially evaluated: (_a < 0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:44
0-44
857 switch(_t) { -
858 case In: -
859 return easeInElastic(t, a, p);
executed: return easeInElastic(t, a, p);
Execution Count:11
11
860 case Out: -
861 return easeOutElastic(t, a, p);
executed: return easeOutElastic(t, a, p);
Execution Count:11
11
862 case InOut: -
863 return easeInOutElastic(t, a, p);
executed: return easeInOutElastic(t, a, p);
Execution Count:11
11
864 case OutIn: -
865 return easeOutInElastic(t, a, p);
executed: return easeOutInElastic(t, a, p);
Execution Count:11
11
866 default: -
867 return t;
never executed: return t;
0
868 } -
869 }
never executed: }
0
870}; -
871 -
872struct BounceEase : public QEasingCurveFunction -
873{ -
874 BounceEase(Type type) -
875 : QEasingCurveFunction(type, qreal(0.3), qreal(1.0)) -
876 { }
executed: }
Execution Count:5
5
877 -
878 QEasingCurveFunction *copy() const -
879 { -
880 BounceEase *rv = new BounceEase(_t);
never executed (the execution status of this line is deduced): BounceEase *rv = new BounceEase(_t);
-
881 rv->_a = _a;
never executed (the execution status of this line is deduced): rv->_a = _a;
-
882 rv->_bezierCurves = _bezierCurves;
never executed (the execution status of this line is deduced): rv->_bezierCurves = _bezierCurves;
-
883 rv->_tcbPoints = _tcbPoints;
never executed (the execution status of this line is deduced): rv->_tcbPoints = _tcbPoints;
-
884 return rv;
never executed: return rv;
0
885 } -
886 -
887 qreal value(qreal t) -
888 { -
889 qreal a = (_a < 0) ? qreal(1.0) : _a;
partially evaluated: (_a < 0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:44
0-44
890 switch(_t) { -
891 case In: -
892 return easeInBounce(t, a);
executed: return easeInBounce(t, a);
Execution Count:11
11
893 case Out: -
894 return easeOutBounce(t, a);
executed: return easeOutBounce(t, a);
Execution Count:11
11
895 case InOut: -
896 return easeInOutBounce(t, a);
executed: return easeInOutBounce(t, a);
Execution Count:11
11
897 case OutIn: -
898 return easeOutInBounce(t, a);
executed: return easeOutInBounce(t, a);
Execution Count:11
11
899 default: -
900 return t;
never executed: return t;
0
901 } -
902 }
never executed: }
0
903}; -
904 -
905struct BackEase : public QEasingCurveFunction -
906{ -
907 BackEase(Type type) -
908 : QEasingCurveFunction(type, qreal(0.3), qreal(1.0), qreal(1.70158)) -
909 { }
executed: }
Execution Count:60
60
910 -
911 QEasingCurveFunction *copy() const -
912 { -
913 BackEase *rv = new BackEase(_t);
executed (the execution status of this line is deduced): BackEase *rv = new BackEase(_t);
-
914 rv->_o = _o;
executed (the execution status of this line is deduced): rv->_o = _o;
-
915 rv->_bezierCurves = _bezierCurves;
executed (the execution status of this line is deduced): rv->_bezierCurves = _bezierCurves;
-
916 rv->_tcbPoints = _tcbPoints;
executed (the execution status of this line is deduced): rv->_tcbPoints = _tcbPoints;
-
917 return rv;
executed: return rv;
Execution Count:5
5
918 } -
919 -
920 qreal value(qreal t) -
921 { -
922 qreal o = (_o < 0) ? qreal(1.70158) : _o;
partially evaluated: (_o < 0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:44
0-44
923 switch(_t) { -
924 case In: -
925 return easeInBack(t, o);
executed: return easeInBack(t, o);
Execution Count:11
11
926 case Out: -
927 return easeOutBack(t, o);
executed: return easeOutBack(t, o);
Execution Count:11
11
928 case InOut: -
929 return easeInOutBack(t, o);
executed: return easeInOutBack(t, o);
Execution Count:11
11
930 case OutIn: -
931 return easeOutInBack(t, o);
executed: return easeOutInBack(t, o);
Execution Count:11
11
932 default: -
933 return t;
never executed: return t;
0
934 } -
935 }
never executed: }
0
936}; -
937 -
938static QEasingCurve::EasingFunction curveToFunc(QEasingCurve::Type curve) -
939{ -
940 switch(curve) { -
941 case QEasingCurve::Linear: -
942 return &easeNone;
executed: return &easeNone;
Execution Count:2
2
943 case QEasingCurve::InQuad: -
944 return &easeInQuad;
executed: return &easeInQuad;
Execution Count:5
5
945 case QEasingCurve::OutQuad: -
946 return &easeOutQuad;
executed: return &easeOutQuad;
Execution Count:13
13
947 case QEasingCurve::InOutQuad: -
948 return &easeInOutQuad;
executed: return &easeInOutQuad;
Execution Count:952
952
949 case QEasingCurve::OutInQuad: -
950 return &easeOutInQuad;
executed: return &easeOutInQuad;
Execution Count:1
1
951 case QEasingCurve::InCubic: -
952 return &easeInCubic;
executed: return &easeInCubic;
Execution Count:2
2
953 case QEasingCurve::OutCubic: -
954 return &easeOutCubic;
executed: return &easeOutCubic;
Execution Count:19
19
955 case QEasingCurve::InOutCubic: -
956 return &easeInOutCubic;
executed: return &easeInOutCubic;
Execution Count:1
1
957 case QEasingCurve::OutInCubic: -
958 return &easeOutInCubic;
executed: return &easeOutInCubic;
Execution Count:1
1
959 case QEasingCurve::InQuart: -
960 return &easeInQuart;
executed: return &easeInQuart;
Execution Count:1
1
961 case QEasingCurve::OutQuart: -
962 return &easeOutQuart;
executed: return &easeOutQuart;
Execution Count:2
2
963 case QEasingCurve::InOutQuart: -
964 return &easeInOutQuart;
executed: return &easeInOutQuart;
Execution Count:1
1
965 case QEasingCurve::OutInQuart: -
966 return &easeOutInQuart;
executed: return &easeOutInQuart;
Execution Count:1
1
967 case QEasingCurve::InQuint: -
968 return &easeInQuint;
executed: return &easeInQuint;
Execution Count:1
1
969 case QEasingCurve::OutQuint: -
970 return &easeOutQuint;
executed: return &easeOutQuint;
Execution Count:1
1
971 case QEasingCurve::InOutQuint: -
972 return &easeInOutQuint;
executed: return &easeInOutQuint;
Execution Count:1
1
973 case QEasingCurve::OutInQuint: -
974 return &easeOutInQuint;
executed: return &easeOutInQuint;
Execution Count:1
1
975 case QEasingCurve::InSine: -
976 return &easeInSine;
executed: return &easeInSine;
Execution Count:1
1
977 case QEasingCurve::OutSine: -
978 return &easeOutSine;
executed: return &easeOutSine;
Execution Count:1
1
979 case QEasingCurve::InOutSine: -
980 return &easeInOutSine;
executed: return &easeInOutSine;
Execution Count:47
47
981 case QEasingCurve::OutInSine: -
982 return &easeOutInSine;
executed: return &easeOutInSine;
Execution Count:1
1
983 case QEasingCurve::InExpo: -
984 return &easeInExpo;
executed: return &easeInExpo;
Execution Count:1
1
985 case QEasingCurve::OutExpo: -
986 return &easeOutExpo;
executed: return &easeOutExpo;
Execution Count:1
1
987 case QEasingCurve::InOutExpo: -
988 return &easeInOutExpo;
executed: return &easeInOutExpo;
Execution Count:1
1
989 case QEasingCurve::OutInExpo: -
990 return &easeOutInExpo;
executed: return &easeOutInExpo;
Execution Count:1
1
991 case QEasingCurve::InCirc: -
992 return &easeInCirc;
executed: return &easeInCirc;
Execution Count:1
1
993 case QEasingCurve::OutCirc: -
994 return &easeOutCirc;
executed: return &easeOutCirc;
Execution Count:1
1
995 case QEasingCurve::InOutCirc: -
996 return &easeInOutCirc;
executed: return &easeInOutCirc;
Execution Count:1
1
997 case QEasingCurve::OutInCirc: -
998 return &easeOutInCirc;
executed: return &easeOutInCirc;
Execution Count:1
1
999 // Internal for, compatibility with QTimeLine only ?? -
1000 case QEasingCurve::InCurve: -
1001 return &easeInCurve;
executed: return &easeInCurve;
Execution Count:1
1
1002 case QEasingCurve::OutCurve: -
1003 return &easeOutCurve;
executed: return &easeOutCurve;
Execution Count:19
19
1004 case QEasingCurve::SineCurve: -
1005 return &easeSineCurve;
executed: return &easeSineCurve;
Execution Count:3
3
1006 case QEasingCurve::CosineCurve: -
1007 return &easeCosineCurve;
executed: return &easeCosineCurve;
Execution Count:3
3
1008 default: -
1009 return 0;
never executed: return 0;
0
1010 }; -
1011}
never executed: }
0
1012 -
1013static QEasingCurveFunction *curveToFunctionObject(QEasingCurve::Type type) -
1014{ -
1015 QEasingCurveFunction *curveFunc = 0;
executed (the execution status of this line is deduced): QEasingCurveFunction *curveFunc = 0;
-
1016 switch(type) { -
1017 case QEasingCurve::InElastic: -
1018 curveFunc = new ElasticEase(ElasticEase::In);
executed (the execution status of this line is deduced): curveFunc = new ElasticEase(ElasticEase::In);
-
1019 break;
executed: break;
Execution Count:6
6
1020 case QEasingCurve::OutElastic: -
1021 curveFunc = new ElasticEase(ElasticEase::Out);
executed (the execution status of this line is deduced): curveFunc = new ElasticEase(ElasticEase::Out);
-
1022 break;
executed: break;
Execution Count:1
1
1023 case QEasingCurve::InOutElastic: -
1024 curveFunc = new ElasticEase(ElasticEase::InOut);
executed (the execution status of this line is deduced): curveFunc = new ElasticEase(ElasticEase::InOut);
-
1025 break;
executed: break;
Execution Count:27
27
1026 case QEasingCurve::OutInElastic: -
1027 curveFunc = new ElasticEase(ElasticEase::OutIn);
executed (the execution status of this line is deduced): curveFunc = new ElasticEase(ElasticEase::OutIn);
-
1028 break;
executed: break;
Execution Count:1
1
1029 case QEasingCurve::OutBounce: -
1030 curveFunc = new BounceEase(BounceEase::Out);
executed (the execution status of this line is deduced): curveFunc = new BounceEase(BounceEase::Out);
-
1031 break;
executed: break;
Execution Count:1
1
1032 case QEasingCurve::InBounce: -
1033 curveFunc = new BounceEase(BounceEase::In);
executed (the execution status of this line is deduced): curveFunc = new BounceEase(BounceEase::In);
-
1034 break;
executed: break;
Execution Count:2
2
1035 case QEasingCurve::OutInBounce: -
1036 curveFunc = new BounceEase(BounceEase::OutIn);
executed (the execution status of this line is deduced): curveFunc = new BounceEase(BounceEase::OutIn);
-
1037 break;
executed: break;
Execution Count:1
1
1038 case QEasingCurve::InOutBounce: -
1039 curveFunc = new BounceEase(BounceEase::InOut);
executed (the execution status of this line is deduced): curveFunc = new BounceEase(BounceEase::InOut);
-
1040 break;
executed: break;
Execution Count:1
1
1041 case QEasingCurve::InBack: -
1042 curveFunc = new BackEase(BackEase::In);
executed (the execution status of this line is deduced): curveFunc = new BackEase(BackEase::In);
-
1043 break;
executed: break;
Execution Count:3
3
1044 case QEasingCurve::OutBack: -
1045 curveFunc = new BackEase(BackEase::Out);
executed (the execution status of this line is deduced): curveFunc = new BackEase(BackEase::Out);
-
1046 break;
executed: break;
Execution Count:1
1
1047 case QEasingCurve::InOutBack: -
1048 curveFunc = new BackEase(BackEase::InOut);
executed (the execution status of this line is deduced): curveFunc = new BackEase(BackEase::InOut);
-
1049 break;
executed: break;
Execution Count:26
26
1050 case QEasingCurve::OutInBack: -
1051 curveFunc = new BackEase(BackEase::OutIn);
executed (the execution status of this line is deduced): curveFunc = new BackEase(BackEase::OutIn);
-
1052 break;
executed: break;
Execution Count:25
25
1053 case QEasingCurve::BezierSpline: -
1054 curveFunc = new BezierEase();
executed (the execution status of this line is deduced): curveFunc = new BezierEase();
-
1055 break;
executed: break;
Execution Count:3
3
1056 case QEasingCurve::TCBSpline: -
1057 curveFunc = new TCBEase();
executed (the execution status of this line is deduced): curveFunc = new TCBEase();
-
1058 break;
executed: break;
Execution Count:4
4
1059 default: -
1060 curveFunc = new QEasingCurveFunction(QEasingCurveFunction::In, qreal(0.3), qreal(1.0), qreal(1.70158));
executed (the execution status of this line is deduced): curveFunc = new QEasingCurveFunction(QEasingCurveFunction::In, qreal(0.3), qreal(1.0), qreal(1.70158));
-
1061 }
executed: }
Execution Count:7
7
1062 -
1063 return curveFunc;
executed: return curveFunc;
Execution Count:109
109
1064} -
1065 -
1066/*! -
1067 Constructs an easing curve of the given \a type. -
1068 */ -
1069QEasingCurve::QEasingCurve(Type type) -
1070 : d_ptr(new QEasingCurvePrivate) -
1071{ -
1072 setType(type);
executed (the execution status of this line is deduced): setType(type);
-
1073}
executed: }
Execution Count:2554
2554
1074 -
1075/*! -
1076 Construct a copy of \a other. -
1077 */ -
1078QEasingCurve::QEasingCurve(const QEasingCurve &other) -
1079 : d_ptr(new QEasingCurvePrivate(*other.d_ptr)) -
1080{ -
1081 // ### non-atomic, requires malloc on shallow copy -
1082}
executed: }
Execution Count:1239
1239
1083 -
1084/*! -
1085 Destructor. -
1086 */ -
1087 -
1088QEasingCurve::~QEasingCurve() -
1089{ -
1090 delete d_ptr;
executed (the execution status of this line is deduced): delete d_ptr;
-
1091}
executed: }
Execution Count:3681
3681
1092 -
1093/*! -
1094 \fn QEasingCurve &QEasingCurve::operator=(const QEasingCurve &other) -
1095 Copy \a other. -
1096 */ -
1097 -
1098/*! -
1099 \fn void QEasingCurve::swap(QEasingCurve &other) -
1100 \since 5.0 -
1101 -
1102 Swaps curve \a other with this curve. This operation is very -
1103 fast and never fails. -
1104*/ -
1105 -
1106/*! -
1107 Compare this easing curve with \a other and returns true if they are -
1108 equal. It will also compare the properties of a curve. -
1109 */ -
1110bool QEasingCurve::operator==(const QEasingCurve &other) const -
1111{ -
1112 bool res = d_ptr->func == other.d_ptr->func
partially evaluated: d_ptr->func == other.d_ptr->func
TRUEFALSE
yes
Evaluation Count:73
no
Evaluation Count:0
0-73
1113 && d_ptr->type == other.d_ptr->type;
evaluated: d_ptr->type == other.d_ptr->type
TRUEFALSE
yes
Evaluation Count:72
yes
Evaluation Count:1
1-72
1114 if (res) {
evaluated: res
TRUEFALSE
yes
Evaluation Count:72
yes
Evaluation Count:1
1-72
1115 if (d_ptr->config && other.d_ptr->config) {
evaluated: d_ptr->config
TRUEFALSE
yes
Evaluation Count:27
yes
Evaluation Count:45
partially evaluated: other.d_ptr->config
TRUEFALSE
yes
Evaluation Count:27
no
Evaluation Count:0
0-45
1116 // catch the config content -
1117 res = d_ptr->config->operator==(*(other.d_ptr->config));
executed (the execution status of this line is deduced): res = d_ptr->config->operator==(*(other.d_ptr->config));
-
1118 -
1119 } else if (d_ptr->config || other.d_ptr->config) {
executed: }
Execution Count:27
partially evaluated: d_ptr->config
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:45
evaluated: other.d_ptr->config
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:43
0-45
1120 // one one has a config object, which could contain default values -
1121 res = qFuzzyCompare(amplitude(), other.amplitude()) &&
evaluated: qFuzzyCompare(amplitude(), other.amplitude())
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1
1122 qFuzzyCompare(period(), other.period()) &&
partially evaluated: qFuzzyCompare(period(), other.period())
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
1123 qFuzzyCompare(overshoot(), other.overshoot());
partially evaluated: qFuzzyCompare(overshoot(), other.overshoot())
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
1124 }
executed: }
Execution Count:2
2
1125 } -
1126 return res;
executed: return res;
Execution Count:73
73
1127} -
1128 -
1129/*! -
1130 \fn bool QEasingCurve::operator!=(const QEasingCurve &other) const -
1131 Compare this easing curve with \a other and returns true if they are not equal. -
1132 It will also compare the properties of a curve. -
1133 -
1134 \sa operator==() -
1135*/ -
1136 -
1137/*! -
1138 Returns the amplitude. This is not applicable for all curve types. -
1139 It is only applicable for bounce and elastic curves (curves of type() -
1140 QEasingCurve::InBounce, QEasingCurve::OutBounce, QEasingCurve::InOutBounce, -
1141 QEasingCurve::OutInBounce, QEasingCurve::InElastic, QEasingCurve::OutElastic, -
1142 QEasingCurve::InOutElastic or QEasingCurve::OutInElastic). -
1143 */ -
1144qreal QEasingCurve::amplitude() const -
1145{ -
1146 return d_ptr->config ? d_ptr->config->_a : qreal(1.0);
executed: return d_ptr->config ? d_ptr->config->_a : qreal(1.0);
Execution Count:19
19
1147} -
1148 -
1149/*! -
1150 Sets the amplitude to \a amplitude. -
1151 -
1152 This will set the amplitude of the bounce or the amplitude of the -
1153 elastic "spring" effect. The higher the number, the higher the amplitude. -
1154 \sa amplitude() -
1155*/ -
1156void QEasingCurve::setAmplitude(qreal amplitude) -
1157{ -
1158 if (!d_ptr->config)
evaluated: !d_ptr->config
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:15
2-15
1159 d_ptr->config = curveToFunctionObject(d_ptr->type);
executed: d_ptr->config = curveToFunctionObject(d_ptr->type);
Execution Count:2
2
1160 d_ptr->config->_a = amplitude;
executed (the execution status of this line is deduced): d_ptr->config->_a = amplitude;
-
1161}
executed: }
Execution Count:17
17
1162 -
1163/*! -
1164 Returns the period. This is not applicable for all curve types. -
1165 It is only applicable if type() is QEasingCurve::InElastic, QEasingCurve::OutElastic, -
1166 QEasingCurve::InOutElastic or QEasingCurve::OutInElastic. -
1167 */ -
1168qreal QEasingCurve::period() const -
1169{ -
1170 return d_ptr->config ? d_ptr->config->_p : qreal(0.3);
executed: return d_ptr->config ? d_ptr->config->_p : qreal(0.3);
Execution Count:16
16
1171} -
1172 -
1173/*! -
1174 Sets the period to \a period. -
1175 Setting a small period value will give a high frequency of the curve. A -
1176 large period will give it a small frequency. -
1177 -
1178 \sa period() -
1179*/ -
1180void QEasingCurve::setPeriod(qreal period) -
1181{ -
1182 if (!d_ptr->config)
evaluated: !d_ptr->config
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:13
1-13
1183 d_ptr->config = curveToFunctionObject(d_ptr->type);
executed: d_ptr->config = curveToFunctionObject(d_ptr->type);
Execution Count:1
1
1184 d_ptr->config->_p = period;
executed (the execution status of this line is deduced): d_ptr->config->_p = period;
-
1185}
executed: }
Execution Count:14
14
1186 -
1187/*! -
1188 Returns the overshoot. This is not applicable for all curve types. -
1189 It is only applicable if type() is QEasingCurve::InBack, QEasingCurve::OutBack, -
1190 QEasingCurve::InOutBack or QEasingCurve::OutInBack. -
1191 */ -
1192qreal QEasingCurve::overshoot() const -
1193{ -
1194 return d_ptr->config ? d_ptr->config->_o : qreal(1.70158) ;
executed: return d_ptr->config ? d_ptr->config->_o : qreal(1.70158) ;
Execution Count:17
17
1195} -
1196 -
1197/*! -
1198 Sets the overshoot to \a overshoot. -
1199 -
1200 0 produces no overshoot, and the default value of 1.70158 produces an overshoot of 10 percent. -
1201 -
1202 \sa overshoot() -
1203*/ -
1204void QEasingCurve::setOvershoot(qreal overshoot) -
1205{ -
1206 if (!d_ptr->config)
partially evaluated: !d_ptr->config
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:17
0-17
1207 d_ptr->config = curveToFunctionObject(d_ptr->type);
never executed: d_ptr->config = curveToFunctionObject(d_ptr->type);
0
1208 d_ptr->config->_o = overshoot;
executed (the execution status of this line is deduced): d_ptr->config->_o = overshoot;
-
1209}
executed: }
Execution Count:17
17
1210 -
1211/*! -
1212 Adds a segment of a cubic bezier spline to define a custom easing curve. -
1213 It is only applicable if type() is QEasingCurve::BezierSpline. -
1214 Note that the spline implicitly starts at (0.0, 0.0) and has to end at (1.0, 1.0) to -
1215 be a valid easing curve. -
1216 */ -
1217void QEasingCurve::addCubicBezierSegment(const QPointF & c1, const QPointF & c2, const QPointF & endPoint) -
1218{ -
1219 if (!d_ptr->config)
partially evaluated: !d_ptr->config
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:11
0-11
1220 d_ptr->config = curveToFunctionObject(d_ptr->type);
never executed: d_ptr->config = curveToFunctionObject(d_ptr->type);
0
1221 d_ptr->config->_bezierCurves << c1 << c2 << endPoint;
executed (the execution status of this line is deduced): d_ptr->config->_bezierCurves << c1 << c2 << endPoint;
-
1222}
executed: }
Execution Count:11
11
1223 -
1224QVector<QPointF> static inline tcbToBezier(const TCBPoints &tcbPoints) -
1225{ -
1226 const int count = tcbPoints.count();
executed (the execution status of this line is deduced): const int count = tcbPoints.count();
-
1227 QVector<QPointF> bezierPoints;
executed (the execution status of this line is deduced): QVector<QPointF> bezierPoints;
-
1228 -
1229 for (int i = 1; i < count; i++) {
evaluated: i < count
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:4
4-8
1230 const qreal t_0 = tcbPoints.at(i - 1)._t;
executed (the execution status of this line is deduced): const qreal t_0 = tcbPoints.at(i - 1)._t;
-
1231 const qreal c_0 = tcbPoints.at(i - 1)._c;
executed (the execution status of this line is deduced): const qreal c_0 = tcbPoints.at(i - 1)._c;
-
1232 qreal b_0 = -1;
executed (the execution status of this line is deduced): qreal b_0 = -1;
-
1233 -
1234 qreal const t_1 = tcbPoints.at(i)._t;
executed (the execution status of this line is deduced): qreal const t_1 = tcbPoints.at(i)._t;
-
1235 qreal const c_1 = tcbPoints.at(i)._c;
executed (the execution status of this line is deduced): qreal const c_1 = tcbPoints.at(i)._c;
-
1236 qreal b_1 = 1;
executed (the execution status of this line is deduced): qreal b_1 = 1;
-
1237 -
1238 QPointF c_minusOne; //P1 last segment - not available for the first point
executed (the execution status of this line is deduced): QPointF c_minusOne;
-
1239 const QPointF c0(tcbPoints.at(i - 1)._point); //P0 Hermite/TBC
executed (the execution status of this line is deduced): const QPointF c0(tcbPoints.at(i - 1)._point);
-
1240 const QPointF c3(tcbPoints.at(i)._point); //P1 Hermite/TBC
executed (the execution status of this line is deduced): const QPointF c3(tcbPoints.at(i)._point);
-
1241 QPointF c4; //P0 next segment - not available for the last point
executed (the execution status of this line is deduced): QPointF c4;
-
1242 -
1243 if (i > 1) { //first point no left tangent
evaluated: i > 1
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:4
4
1244 c_minusOne = tcbPoints.at(i - 2)._point;
executed (the execution status of this line is deduced): c_minusOne = tcbPoints.at(i - 2)._point;
-
1245 b_0 = tcbPoints.at(i - 1)._b;
executed (the execution status of this line is deduced): b_0 = tcbPoints.at(i - 1)._b;
-
1246 }
executed: }
Execution Count:4
4
1247 -
1248 if (i < (count - 1)) { //last point no right tangent
evaluated: i < (count - 1)
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:4
4
1249 c4 = tcbPoints.at(i + 1)._point;
executed (the execution status of this line is deduced): c4 = tcbPoints.at(i + 1)._point;
-
1250 b_1 = tcbPoints.at(i)._b;
executed (the execution status of this line is deduced): b_1 = tcbPoints.at(i)._b;
-
1251 }
executed: }
Execution Count:4
4
1252 -
1253 const qreal dx_0 = 0.5 * (1-t_0) * ((1 + b_0) * (1 + c_0) * (c0.x() - c_minusOne.x()) + (1- b_0) * (1 - c_0) * (c3.x() - c0.x()));
executed (the execution status of this line is deduced): const qreal dx_0 = 0.5 * (1-t_0) * ((1 + b_0) * (1 + c_0) * (c0.x() - c_minusOne.x()) + (1- b_0) * (1 - c_0) * (c3.x() - c0.x()));
-
1254 const qreal dy_0 = 0.5 * (1-t_0) * ((1 + b_0) * (1 + c_0) * (c0.y() - c_minusOne.y()) + (1- b_0) * (1 - c_0) * (c3.y() - c0.y()));
executed (the execution status of this line is deduced): const qreal dy_0 = 0.5 * (1-t_0) * ((1 + b_0) * (1 + c_0) * (c0.y() - c_minusOne.y()) + (1- b_0) * (1 - c_0) * (c3.y() - c0.y()));
-
1255 -
1256 const qreal dx_1 = 0.5 * (1-t_1) * ((1 + b_1) * (1 - c_1) * (c3.x() - c0.x()) + (1 - b_1) * (1 + c_1) * (c4.x() - c3.x()));
executed (the execution status of this line is deduced): const qreal dx_1 = 0.5 * (1-t_1) * ((1 + b_1) * (1 - c_1) * (c3.x() - c0.x()) + (1 - b_1) * (1 + c_1) * (c4.x() - c3.x()));
-
1257 const qreal dy_1 = 0.5 * (1-t_1) * ((1 + b_1) * (1 - c_1) * (c3.y() - c0.y()) + (1 - b_1) * (1 + c_1) * (c4.y() - c3.y()));
executed (the execution status of this line is deduced): const qreal dy_1 = 0.5 * (1-t_1) * ((1 + b_1) * (1 - c_1) * (c3.y() - c0.y()) + (1 - b_1) * (1 + c_1) * (c4.y() - c3.y()));
-
1258 -
1259 const QPointF d_0 = QPointF(dx_0, dy_0);
executed (the execution status of this line is deduced): const QPointF d_0 = QPointF(dx_0, dy_0);
-
1260 const QPointF d_1 = QPointF(dx_1, dy_1);
executed (the execution status of this line is deduced): const QPointF d_1 = QPointF(dx_1, dy_1);
-
1261 -
1262 QPointF c1 = (3 * c0 + d_0) / 3;
executed (the execution status of this line is deduced): QPointF c1 = (3 * c0 + d_0) / 3;
-
1263 QPointF c2 = (3 * c3 - d_1) / 3;
executed (the execution status of this line is deduced): QPointF c2 = (3 * c3 - d_1) / 3;
-
1264 bezierPoints << c1 << c2 << c3;
executed (the execution status of this line is deduced): bezierPoints << c1 << c2 << c3;
-
1265 }
executed: }
Execution Count:8
8
1266 return bezierPoints;
executed: return bezierPoints;
Execution Count:4
4
1267} -
1268 -
1269/*! -
1270 Adds a segment of a TCB bezier spline to define a custom easing curve. -
1271 It is only applicable if type() is QEasingCurve::TCBSpline. -
1272 The spline has to start explitly at (0.0, 0.0) and has to end at (1.0, 1.0) to -
1273 be a valid easing curve. -
1274 The three parameters are called tension, continuity and bias. All three parameters are -
1275 valid between -1 and 1 and define the tangent of the control point. -
1276 If all three parameters are 0 the resulting spline is a Catmull-Rom spline. -
1277 The begin and endpoint always have a bias of -1 and 1, since the outer tangent is not defined. -
1278 */ -
1279void QEasingCurve::addTCBSegment(const QPointF &nextPoint, qreal t, qreal c, qreal b) -
1280{ -
1281 if (!d_ptr->config)
partially evaluated: !d_ptr->config
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:12
0-12
1282 d_ptr->config = curveToFunctionObject(d_ptr->type);
never executed: d_ptr->config = curveToFunctionObject(d_ptr->type);
0
1283 -
1284 d_ptr->config->_tcbPoints.append(TCBPoint(nextPoint, t, c ,b));
executed (the execution status of this line is deduced): d_ptr->config->_tcbPoints.append(TCBPoint(nextPoint, t, c ,b));
-
1285 -
1286 if (nextPoint == QPointF(1.0, 1.0)) {
evaluated: nextPoint == QPointF(1.0, 1.0)
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:8
4-8
1287 d_ptr->config->_bezierCurves = tcbToBezier(d_ptr->config->_tcbPoints);
executed (the execution status of this line is deduced): d_ptr->config->_bezierCurves = tcbToBezier(d_ptr->config->_tcbPoints);
-
1288 d_ptr->config->_tcbPoints.clear();
executed (the execution status of this line is deduced): d_ptr->config->_tcbPoints.clear();
-
1289 }
executed: }
Execution Count:4
4
1290 -
1291}
executed: }
Execution Count:12
12
1292 -
1293/*! -
1294 \fn QList<QPointF> QEasingCurve::cubicBezierSpline() const -
1295 \obsolete Use toCubicSpline() instead. -
1296 */ -
1297 -
1298/*! -
1299 \since 5.0 -
1300 -
1301 Returns the cubicBezierSpline that defines a custom easing curve. -
1302 If the easing curve does not have a custom bezier easing curve the list -
1303 is empty. -
1304*/ -
1305QVector<QPointF> QEasingCurve::toCubicSpline() const -
1306{ -
1307 return d_ptr->config ? d_ptr->config->_bezierCurves : QVector<QPointF>();
never executed: return d_ptr->config ? d_ptr->config->_bezierCurves : QVector<QPointF>();
0
1308} -
1309 -
1310/*! -
1311 Returns the type of the easing curve. -
1312*/ -
1313QEasingCurve::Type QEasingCurve::type() const -
1314{ -
1315 return d_ptr->type;
executed: return d_ptr->type;
Execution Count:36
36
1316} -
1317 -
1318void QEasingCurvePrivate::setType_helper(QEasingCurve::Type newType) -
1319{ -
1320 qreal amp = -1.0;
executed (the execution status of this line is deduced): qreal amp = -1.0;
-
1321 qreal period = -1.0;
executed (the execution status of this line is deduced): qreal period = -1.0;
-
1322 qreal overshoot = -1.0;
executed (the execution status of this line is deduced): qreal overshoot = -1.0;
-
1323 QVector<QPointF> bezierCurves;
executed (the execution status of this line is deduced): QVector<QPointF> bezierCurves;
-
1324 QVector<TCBPoint> tcbPoints;
executed (the execution status of this line is deduced): QVector<TCBPoint> tcbPoints;
-
1325 -
1326 if (config) {
evaluated: config
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:1175
9-1175
1327 amp = config->_a;
executed (the execution status of this line is deduced): amp = config->_a;
-
1328 period = config->_p;
executed (the execution status of this line is deduced): period = config->_p;
-
1329 overshoot = config->_o;
executed (the execution status of this line is deduced): overshoot = config->_o;
-
1330 bezierCurves = config->_bezierCurves;
executed (the execution status of this line is deduced): bezierCurves = config->_bezierCurves;
-
1331 tcbPoints = config->_tcbPoints;
executed (the execution status of this line is deduced): tcbPoints = config->_tcbPoints;
-
1332 -
1333 delete config;
executed (the execution status of this line is deduced): delete config;
-
1334 config = 0;
executed (the execution status of this line is deduced): config = 0;
-
1335 }
executed: }
Execution Count:9
9
1336 -
1337 if (isConfigFunction(newType) || (amp != -1.0) || (period != -1.0) || (overshoot != -1.0) ||
evaluated: isConfigFunction(newType)
TRUEFALSE
yes
Evaluation Count:84
yes
Evaluation Count:1100
evaluated: (amp != -1.0)
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:1096
partially evaluated: (period != -1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1096
partially evaluated: (overshoot != -1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1096
0-1100
1338 !bezierCurves.isEmpty()) {
partially evaluated: !bezierCurves.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1096
0-1096
1339 config = curveToFunctionObject(newType);
executed (the execution status of this line is deduced): config = curveToFunctionObject(newType);
-
1340 if (amp != -1.0)
evaluated: amp != -1.0
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:79
9-79
1341 config->_a = amp;
executed: config->_a = amp;
Execution Count:9
9
1342 if (period != -1.0)
evaluated: period != -1.0
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:79
9-79
1343 config->_p = period;
executed: config->_p = period;
Execution Count:9
9
1344 if (overshoot != -1.0)
evaluated: overshoot != -1.0
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:79
9-79
1345 config->_o = overshoot;
executed: config->_o = overshoot;
Execution Count:9
9
1346 config->_bezierCurves = bezierCurves;
executed (the execution status of this line is deduced): config->_bezierCurves = bezierCurves;
-
1347 config->_tcbPoints = tcbPoints;
executed (the execution status of this line is deduced): config->_tcbPoints = tcbPoints;
-
1348 func = 0;
executed (the execution status of this line is deduced): func = 0;
-
1349 } else if (newType != QEasingCurve::Custom) {
executed: }
Execution Count:88
evaluated: newType != QEasingCurve::Custom
TRUEFALSE
yes
Evaluation Count:1089
yes
Evaluation Count:7
7-1089
1350 func = curveToFunc(newType);
executed (the execution status of this line is deduced): func = curveToFunc(newType);
-
1351 }
executed: }
Execution Count:1089
1089
1352 Q_ASSERT((func == 0) == (config != 0));
executed (the execution status of this line is deduced): qt_noop();
-
1353 type = newType;
executed (the execution status of this line is deduced): type = newType;
-
1354}
executed: }
Execution Count:1184
1184
1355 -
1356/*! -
1357 Sets the type of the easing curve to \a type. -
1358*/ -
1359void QEasingCurve::setType(Type type) -
1360{ -
1361 if (d_ptr->type == type)
evaluated: d_ptr->type == type
TRUEFALSE
yes
Evaluation Count:1539
yes
Evaluation Count:1182
1182-1539
1362 return;
executed: return;
Execution Count:1539
1539
1363 if (type < Linear || type >= NCurveTypes - 1) {
evaluated: type < Linear
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1180
evaluated: type >= NCurveTypes - 1
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:1177
2-1180
1364 qWarning("QEasingCurve: Invalid curve type %d", type);
executed (the execution status of this line is deduced): QMessageLogger("tools/qeasingcurve.cpp", 1364, __PRETTY_FUNCTION__).warning("QEasingCurve: Invalid curve type %d", type);
-
1365 return;
executed: return;
Execution Count:5
5
1366 } -
1367 -
1368 d_ptr->setType_helper(type);
executed (the execution status of this line is deduced): d_ptr->setType_helper(type);
-
1369}
executed: }
Execution Count:1177
1177
1370 -
1371/*! -
1372 Sets a custom easing curve that is defined by the user in the function \a func. -
1373 The signature of the function is qreal myEasingFunction(qreal progress), -
1374 where \e progress and the return value is considered to be normalized between 0 and 1. -
1375 (In some cases the return value can be outside that range) -
1376 After calling this function type() will return QEasingCurve::Custom. -
1377 \a func cannot be zero. -
1378 -
1379 \sa customType() -
1380 \sa valueForProgress() -
1381*/ -
1382void QEasingCurve::setCustomType(EasingFunction func) -
1383{ -
1384 if (!func) {
partially evaluated: !func
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7
0-7
1385 qWarning("Function pointer must not be null");
never executed (the execution status of this line is deduced): QMessageLogger("tools/qeasingcurve.cpp", 1385, __PRETTY_FUNCTION__).warning("Function pointer must not be null");
-
1386 return;
never executed: return;
0
1387 } -
1388 d_ptr->func = func;
executed (the execution status of this line is deduced): d_ptr->func = func;
-
1389 d_ptr->setType_helper(Custom);
executed (the execution status of this line is deduced): d_ptr->setType_helper(Custom);
-
1390}
executed: }
Execution Count:7
7
1391 -
1392/*! -
1393 Returns the function pointer to the custom easing curve. -
1394 If type() does not return QEasingCurve::Custom, this function -
1395 will return 0. -
1396*/ -
1397QEasingCurve::EasingFunction QEasingCurve::customType() const -
1398{ -
1399 return d_ptr->type == Custom ? d_ptr->func : 0;
never executed: return d_ptr->type == Custom ? d_ptr->func : 0;
0
1400} -
1401 -
1402/*! -
1403 Return the effective progress for the easing curve at \a progress. -
1404 While \a progress must be between 0 and 1, the returned effective progress -
1405 can be outside those bounds. For instance, QEasingCurve::InBack will -
1406 return negative values in the beginning of the function. -
1407 */ -
1408qreal QEasingCurve::valueForProgress(qreal progress) const -
1409{ -
1410 progress = qBound<qreal>(0, progress, 1);
executed (the execution status of this line is deduced): progress = qBound<qreal>(0, progress, 1);
-
1411 if (d_ptr->func)
evaluated: d_ptr->func
TRUEFALSE
yes
Evaluation Count:11161
yes
Evaluation Count:179
179-11161
1412 return d_ptr->func(progress);
executed: return d_ptr->func(progress);
Execution Count:11161
11161
1413 else if (d_ptr->config)
partially evaluated: d_ptr->config
TRUEFALSE
yes
Evaluation Count:179
no
Evaluation Count:0
0-179
1414 return d_ptr->config->value(progress);
executed: return d_ptr->config->value(progress);
Execution Count:179
179
1415 else -
1416 return progress;
never executed: return progress;
0
1417} -
1418 -
1419#ifndef QT_NO_DEBUG_STREAM -
1420QDebug operator<<(QDebug debug, const QEasingCurve &item) -
1421{ -
1422 debug << "type:" << item.d_ptr->type
executed (the execution status of this line is deduced): debug << "type:" << item.d_ptr->type
-
1423 << "func:" << item.d_ptr->func;
executed (the execution status of this line is deduced): << "func:" << item.d_ptr->func;
-
1424 if (item.d_ptr->config) {
partially evaluated: item.d_ptr->config
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
1425 debug << QString::fromLatin1("period:%1").arg(item.d_ptr->config->_p, 0, 'f', 20)
never executed (the execution status of this line is deduced): debug << QString::fromLatin1("period:%1").arg(item.d_ptr->config->_p, 0, 'f', 20)
-
1426 << QString::fromLatin1("amp:%1").arg(item.d_ptr->config->_a, 0, 'f', 20)
never executed (the execution status of this line is deduced): << QString::fromLatin1("amp:%1").arg(item.d_ptr->config->_a, 0, 'f', 20)
-
1427 << QString::fromLatin1("overshoot:%1").arg(item.d_ptr->config->_o, 0, 'f', 20);
never executed (the execution status of this line is deduced): << QString::fromLatin1("overshoot:%1").arg(item.d_ptr->config->_o, 0, 'f', 20);
-
1428 }
never executed: }
0
1429 return debug;
executed: return debug;
Execution Count:1
1
1430} -
1431#endif // QT_NO_DEBUG_STREAM -
1432 -
1433#ifndef QT_NO_DATASTREAM -
1434/*! -
1435 \fn QDataStream &operator<<(QDataStream &stream, const QEasingCurve &easing) -
1436 \relates QEasingCurve -
1437 -
1438 Writes the given \a easing curve to the given \a stream and returns a -
1439 reference to the stream. -
1440 -
1441 \sa {Serializing Qt Data Types} -
1442*/ -
1443 -
1444QDataStream &operator<<(QDataStream &stream, const QEasingCurve &easing) -
1445{ -
1446 stream << quint8(easing.d_ptr->type);
executed (the execution status of this line is deduced): stream << quint8(easing.d_ptr->type);
-
1447 stream << quint64(quintptr(easing.d_ptr->func));
executed (the execution status of this line is deduced): stream << quint64(quintptr(easing.d_ptr->func));
-
1448 -
1449 bool hasConfig = easing.d_ptr->config;
executed (the execution status of this line is deduced): bool hasConfig = easing.d_ptr->config;
-
1450 stream << hasConfig;
executed (the execution status of this line is deduced): stream << hasConfig;
-
1451 if (hasConfig) {
evaluated: hasConfig
TRUEFALSE
yes
Evaluation Count:18
yes
Evaluation Count:31
18-31
1452 stream << easing.d_ptr->config->_p;
executed (the execution status of this line is deduced): stream << easing.d_ptr->config->_p;
-
1453 stream << easing.d_ptr->config->_a;
executed (the execution status of this line is deduced): stream << easing.d_ptr->config->_a;
-
1454 stream << easing.d_ptr->config->_o;
executed (the execution status of this line is deduced): stream << easing.d_ptr->config->_o;
-
1455 }
executed: }
Execution Count:18
18
1456 return stream;
executed: return stream;
Execution Count:49
49
1457} -
1458 -
1459/*! -
1460 \fn QDataStream &operator>>(QDataStream &stream, QEasingCurve &easing) -
1461 \relates QEasingCurve -
1462 -
1463 Reads an easing curve from the given \a stream into the given \a -
1464 easing curve and returns a reference to the stream. -
1465 -
1466 \sa {Serializing Qt Data Types} -
1467*/ -
1468 -
1469QDataStream &operator>>(QDataStream &stream, QEasingCurve &easing) -
1470{ -
1471 QEasingCurve::Type type;
executed (the execution status of this line is deduced): QEasingCurve::Type type;
-
1472 quint8 int_type;
executed (the execution status of this line is deduced): quint8 int_type;
-
1473 stream >> int_type;
executed (the execution status of this line is deduced): stream >> int_type;
-
1474 type = static_cast<QEasingCurve::Type>(int_type);
executed (the execution status of this line is deduced): type = static_cast<QEasingCurve::Type>(int_type);
-
1475 easing.setType(type);
executed (the execution status of this line is deduced): easing.setType(type);
-
1476 -
1477 quint64 ptr_func;
executed (the execution status of this line is deduced): quint64 ptr_func;
-
1478 stream >> ptr_func;
executed (the execution status of this line is deduced): stream >> ptr_func;
-
1479 easing.d_ptr->func = QEasingCurve::EasingFunction(quintptr(ptr_func));
executed (the execution status of this line is deduced): easing.d_ptr->func = QEasingCurve::EasingFunction(quintptr(ptr_func));
-
1480 -
1481 bool hasConfig;
executed (the execution status of this line is deduced): bool hasConfig;
-
1482 stream >> hasConfig;
executed (the execution status of this line is deduced): stream >> hasConfig;
-
1483 if (hasConfig) {
evaluated: hasConfig
TRUEFALSE
yes
Evaluation Count:18
yes
Evaluation Count:33
18-33
1484 QEasingCurveFunction *config = curveToFunctionObject(type);
executed (the execution status of this line is deduced): QEasingCurveFunction *config = curveToFunctionObject(type);
-
1485 stream >> config->_p;
executed (the execution status of this line is deduced): stream >> config->_p;
-
1486 stream >> config->_a;
executed (the execution status of this line is deduced): stream >> config->_a;
-
1487 stream >> config->_o;
executed (the execution status of this line is deduced): stream >> config->_o;
-
1488 easing.d_ptr->config = config;
executed (the execution status of this line is deduced): easing.d_ptr->config = config;
-
1489 }
executed: }
Execution Count:18
18
1490 return stream;
executed: return stream;
Execution Count:51
51
1491} -
1492#endif // QT_NO_DATASTREAM -
1493 -
1494QT_END_NAMESPACE -
1495 -
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial