OpenCoverage

qquickanimatorjob_p.h

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/util/qquickanimatorjob_p.h
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2016 The Qt Company Ltd.-
4** Copyright (C) 2016 Gunnar Sletta <gunnar@sletta.org>-
5** Contact: https://www.qt.io/licensing/-
6**-
7** This file is part of the QtQuick module of the Qt Toolkit.-
8**-
9** $QT_BEGIN_LICENSE:LGPL$-
10** Commercial License Usage-
11** Licensees holding valid commercial Qt licenses may use this file in-
12** accordance with the commercial license agreement provided with the-
13** Software or, alternatively, in accordance with the terms contained in-
14** a written agreement between you and The Qt Company. For licensing terms-
15** and conditions see https://www.qt.io/terms-conditions. For further-
16** information use the contact form at https://www.qt.io/contact-us.-
17**-
18** GNU Lesser General Public License Usage-
19** Alternatively, this file may be used under the terms of the GNU Lesser-
20** General Public License version 3 as published by the Free Software-
21** Foundation and appearing in the file LICENSE.LGPL3 included in the-
22** packaging of this file. Please review the following information to-
23** ensure the GNU Lesser General Public License version 3 requirements-
24** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.-
25**-
26** GNU General Public License Usage-
27** Alternatively, this file may be used under the terms of the GNU-
28** General Public License version 2.0 or (at your option) the GNU General-
29** Public license version 3 or any later version approved by the KDE Free-
30** Qt Foundation. The licenses are as published by the Free Software-
31** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3-
32** included in the packaging of this file. Please review the following-
33** information to ensure the GNU General Public License requirements will-
34** be met: https://www.gnu.org/licenses/gpl-2.0.html and-
35** https://www.gnu.org/licenses/gpl-3.0.html.-
36**-
37** $QT_END_LICENSE$-
38**-
39****************************************************************************/-
40-
41#ifndef QQUICKANIMATORJOB_P_H-
42#define QQUICKANIMATORJOB_P_H-
43-
44//-
45// W A R N I N G-
46// --------------
47//-
48// This file is not part of the Qt API. It exists purely as an-
49// implementation detail. This header file may change from version to-
50// version without notice, or even be removed.-
51//-
52// We mean it.-
53//-
54-
55#include <private/qabstractanimationjob_p.h>-
56#include <private/qquickanimator_p.h>-
57#include <private/qtquickglobal_p.h>-
58-
59#include <QtQuick/qquickitem.h>-
60-
61#include <QtCore/qeasingcurve.h>-
62-
63QT_BEGIN_NAMESPACE-
64-
65class QQuickAnimator;-
66class QQuickWindow;-
67class QQuickItem;-
68class QQuickAbstractAnimation;-
69-
70class QQuickAnimatorController;-
71class QQuickAnimatorProxyJobPrivate;-
72class QQuickOpenGLShaderEffectNode;-
73-
74class QSGOpacityNode;-
75-
76class Q_QUICK_PRIVATE_EXPORT QQuickAnimatorProxyJob : public QObject, public QAbstractAnimationJob-
77{-
78 Q_OBJECT-
79-
80public:-
81 QQuickAnimatorProxyJob(QAbstractAnimationJob *job, QObject *item);-
82 ~QQuickAnimatorProxyJob();-
83-
84 int duration() const override { return m_duration; }
executed 705 times by 2 tests: return m_duration;
Executed by:
  • tst_examples
  • tst_qquickanimations
705
85-
86 const QSharedPointer<QAbstractAnimationJob> &job() const { return m_job; }
executed 2 times by 1 test: return m_job;
Executed by:
  • tst_qquickanimations
2
87-
88protected:-
89 void updateCurrentTime(int) override;-
90 void updateState(QAbstractAnimationJob::State newState, QAbstractAnimationJob::State oldState) override;-
91 void debugAnimation(QDebug d) const override;-
92-
93public Q_SLOTS:-
94 void windowChanged(QQuickWindow *window);-
95 void sceneGraphInitialized();-
96-
97private:-
98 void syncBackCurrentValues();-
99 void readyToAnimate();-
100 void setWindow(QQuickWindow *window);-
101 static QObject *findAnimationContext(QQuickAbstractAnimation *);-
102-
103 QPointer<QQuickAnimatorController> m_controller;-
104 QQuickAbstractAnimation *m_animation;-
105 QSharedPointer<QAbstractAnimationJob> m_job;-
106 int m_duration;-
107-
108 enum InternalState {-
109 State_Starting, // Used when it should be running, but no we're still missing the controller.-
110 State_Running,-
111 State_Paused,-
112 State_Stopped-
113 };-
114-
115 InternalState m_internalState;-
116};-
117-
118class Q_QUICK_PRIVATE_EXPORT QQuickAnimatorJob : public QAbstractAnimationJob-
119{-
120public:-
121 virtual void setTarget(QQuickItem *target);-
122 QQuickItem *target() const { return m_target; }
executed 72 times by 2 tests: return m_target;
Executed by:
  • tst_examples
  • tst_qquickanimations
72
123-
124 void setFrom(qreal from) { m_from = from; }
executed 36 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickanimations
36
125 qreal from() const { return m_from; }
never executed: return m_from;
0
126-
127 void setTo(qreal to) { m_to = to; }
executed 36 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickanimations
36
128 qreal to() const { return m_to; }
never executed: return m_to;
0
129-
130 void setDuration(int duration) { m_duration = duration; }
executed 36 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickanimations
36
131 int duration() const override { return m_duration; }
executed 730 times by 2 tests: return m_duration;
Executed by:
  • tst_examples
  • tst_qquickanimations
730
132-
133 QEasingCurve easingCurve() const { return m_easing; }
never executed: return m_easing;
0
134 void setEasingCurve(const QEasingCurve &curve) { m_easing = curve; }
executed 36 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickanimations
36
135-
136 // Initialize is called on the GUI thread just before it is started-
137 // and taken over on the render thread.-
138 virtual void initialize(QQuickAnimatorController *controller);-
139-
140 // Called on the render thread during SG shutdown.-
141 virtual void invalidate() = 0;-
142-
143 // Called on the GUI thread after a complete render thread animation job-
144 // has been completed to write back a given animator's result to the-
145 // source item.-
146 virtual void writeBack() = 0;-
147-
148 // Called before the SG sync on the render thread. The GUI thread is-
149 // locked during this call.-
150 virtual void preSync() { }-
151-
152 // Called after the SG sync on the render thread. The GUI thread is-
153 // locked during this call.-
154 virtual void postSync() { }-
155-
156 // Called after animations have ticked on the render thread. No locks are-
157 // held at this time, so synchronization needs to be taken into account-
158 // if applicable.-
159 virtual void commit() { }-
160-
161 bool isTransform() const { return m_isTransform; }
never executed: return m_isTransform;
0
162 bool isUniform() const { return m_isUniform; }
never executed: return m_isUniform;
0
163-
164 qreal value() const;-
165-
166 QQuickAnimatorController *controller() const { return m_controller; }
never executed: return m_controller;
0
167-
168protected:-
169 QQuickAnimatorJob();-
170 void debugAnimation(QDebug d) const override;-
171-
172 qreal progress(int time) const;-
173-
174 QPointer<QQuickItem> m_target;-
175 QQuickAnimatorController *m_controller;-
176-
177 qreal m_from;-
178 qreal m_to;-
179 qreal m_value;-
180-
181 QEasingCurve m_easing;-
182-
183 int m_duration;-
184-
185 uint m_isTransform : 1;-
186 uint m_isUniform : 1;-
187};-
188-
189class QQuickTransformAnimatorJob : public QQuickAnimatorJob-
190{-
191public:-
192-
193 struct Helper-
194 {-
195 Helper()-
196 : ref(1)-
197 , node(nullptr)-
198 , ox(0)-
199 , oy(0)-
200 , dx(0)-
201 , dy(0)-
202 , scale(1)-
203 , rotation(0)-
204 , wasSynced(false)-
205 , wasChanged(false)-
206 {-
207 }
executed 22 times by 1 test: end of block
Executed by:
  • tst_examples
22
208-
209 void sync();-
210 void commit();-
211-
212 int ref;-
213 QQuickItem *item;-
214 QSGTransformNode *node;-
215-
216 // Origin-
217 float ox;-
218 float oy;-
219-
220 float dx;-
221 float dy;-
222 float scale;-
223 float rotation;-
224-
225 uint wasSynced : 1;-
226 uint wasChanged : 1;-
227 };-
228-
229 ~QQuickTransformAnimatorJob();-
230-
231 void commit() override;-
232 void preSync() override;-
233-
234 void setTarget(QQuickItem *item) override;-
235-
236protected:-
237 QQuickTransformAnimatorJob();-
238 void invalidate() override;-
239-
240 Helper *m_helper;-
241};-
242-
243class Q_QUICK_PRIVATE_EXPORT QQuickScaleAnimatorJob : public QQuickTransformAnimatorJob-
244{-
245public:-
246 void updateCurrentTime(int time) override;-
247 void writeBack() override;-
248};-
249-
250class Q_QUICK_PRIVATE_EXPORT QQuickXAnimatorJob : public QQuickTransformAnimatorJob-
251{-
252public:-
253 void updateCurrentTime(int time) override;-
254 void writeBack() override;-
255};-
256-
257class Q_QUICK_PRIVATE_EXPORT QQuickYAnimatorJob : public QQuickTransformAnimatorJob-
258{-
259public:-
260 void updateCurrentTime(int time) override;-
261 void writeBack() override;-
262};-
263-
264class Q_QUICK_PRIVATE_EXPORT QQuickRotationAnimatorJob : public QQuickTransformAnimatorJob-
265{-
266public:-
267 QQuickRotationAnimatorJob();-
268-
269 void updateCurrentTime(int time) override;-
270 void writeBack() override;-
271-
272 void setDirection(QQuickRotationAnimator::RotationDirection direction) { m_direction = direction; }
executed 4 times by 1 test: end of block
Executed by:
  • tst_examples
4
273 QQuickRotationAnimator::RotationDirection direction() const { return m_direction; }
never executed: return m_direction;
0
274-
275private:-
276 QQuickRotationAnimator::RotationDirection m_direction;-
277};-
278-
279class Q_QUICK_PRIVATE_EXPORT QQuickOpacityAnimatorJob : public QQuickAnimatorJob-
280{-
281public:-
282 QQuickOpacityAnimatorJob();-
283-
284 void invalidate() override;-
285 void updateCurrentTime(int time) override;-
286 void writeBack() override;-
287 void postSync() override;-
288-
289private:-
290 QSGOpacityNode *m_opacityNode;-
291};-
292#if QT_CONFIG(opengl)-
293class Q_QUICK_PRIVATE_EXPORT QQuickUniformAnimatorJob : public QQuickAnimatorJob-
294{-
295public:-
296 QQuickUniformAnimatorJob();-
297-
298 void setTarget(QQuickItem *target) override;-
299-
300 void setUniform(const QByteArray &uniform) { m_uniform = uniform; }
executed 4 times by 1 test: end of block
Executed by:
  • tst_examples
4
301 QByteArray uniform() const { return m_uniform; }
never executed: return m_uniform;
0
302-
303 void postSync() override;-
304-
305 void updateCurrentTime(int time) override;-
306 void writeBack() override;-
307-
308 void invalidate() override;-
309-
310private:-
311 QByteArray m_uniform;-
312 QQuickOpenGLShaderEffectNode *m_node;-
313-
314 int m_uniformIndex : 8;-
315 int m_uniformType : 8;-
316};-
317#endif-
318-
319QT_END_NAMESPACE-
320-
321#endif // QQUICKANIMATORJOB_P_H-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.0