Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/util/qquickanimatorjob.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||
2 | - | |||||||||||||||||||
3 | - | |||||||||||||||||||
4 | - | |||||||||||||||||||
5 | - | |||||||||||||||||||
6 | - | |||||||||||||||||||
7 | - | |||||||||||||||||||
8 | struct QQuickTransformAnimatorHelperStore | - | ||||||||||||||||||
9 | { | - | ||||||||||||||||||
10 | QHash<QQuickItem *, QQuickTransformAnimatorJob::Helper *> store; | - | ||||||||||||||||||
11 | QMutex mutex; | - | ||||||||||||||||||
12 | - | |||||||||||||||||||
13 | QQuickTransformAnimatorJob::Helper *acquire(QQuickItem *item) { | - | ||||||||||||||||||
14 | mutex.lock(); | - | ||||||||||||||||||
15 | QQuickTransformAnimatorJob::Helper *helper = store.value(item); | - | ||||||||||||||||||
16 | if (!helper
| 4-22 | ||||||||||||||||||
17 | helper = new QQuickTransformAnimatorJob::Helper(); | - | ||||||||||||||||||
18 | helper->item = item; | - | ||||||||||||||||||
19 | store[item] = helper; | - | ||||||||||||||||||
20 | } executed 22 times by 1 test: else {end of block Executed by:
| 22 | ||||||||||||||||||
21 | ++helper->ref; | - | ||||||||||||||||||
22 | } executed 4 times by 1 test: end of block Executed by:
| 4 | ||||||||||||||||||
23 | mutex.unlock(); | - | ||||||||||||||||||
24 | return executed 26 times by 1 test: helper;return helper; Executed by:
executed 26 times by 1 test: return helper; Executed by:
| 26 | ||||||||||||||||||
25 | } | - | ||||||||||||||||||
26 | - | |||||||||||||||||||
27 | void release(QQuickTransformAnimatorJob::Helper *helper) { | - | ||||||||||||||||||
28 | mutex.lock(); | - | ||||||||||||||||||
29 | if (--
| 4-22 | ||||||||||||||||||
30 | store.remove(helper->item); | - | ||||||||||||||||||
31 | delete helper; | - | ||||||||||||||||||
32 | } executed 22 times by 1 test: end of block Executed by:
| 22 | ||||||||||||||||||
33 | mutex.unlock(); | - | ||||||||||||||||||
34 | } executed 26 times by 1 test: end of block Executed by:
| 26 | ||||||||||||||||||
35 | }; | - | ||||||||||||||||||
36 | namespace { namespace Q_QGS_qquick_transform_animatorjob_helper_store { typedef QQuickTransformAnimatorHelperStore Type; QBasicAtomicInt guard = { QtGlobalStatic::Uninitialized }; __attribute__((visibility("hidden"))) inline Type *innerFunction() { struct HolderBase { ~HolderBase() noexcept { if (guard.load() == QtGlobalStatic::Initialized
executed 2 times by 1 test: }guard.store(QtGlobalStatic::Destroyed); Executed by:
executed 2 times by 1 test: }; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type ())) : value () { guard.store(QtGlobalStatic::Initialized); } } holder; returnend of block Executed by:
executed 52 times by 1 test: &holder.value;return &holder.value; Executed by:
executed 52 times by 1 test: } } } static QGlobalStatic<QQuickTransformAnimatorHelperStore, Q_QGS_qquick_transform_animatorjob_helper_store::innerFunction, Q_QGS_qquick_transform_animatorjob_helper_store::guard> qquick_transform_animatorjob_helper_store;;return &holder.value; Executed by:
| 0-52 | ||||||||||||||||||
37 | - | |||||||||||||||||||
38 | QQuickAnimatorProxyJob::QQuickAnimatorProxyJob(QAbstractAnimationJob *job, QObject *item) | - | ||||||||||||||||||
39 | : m_controller(nullptr) | - | ||||||||||||||||||
40 | , m_internalState(State_Stopped) | - | ||||||||||||||||||
41 | { | - | ||||||||||||||||||
42 | m_job.reset(job); | - | ||||||||||||||||||
43 | - | |||||||||||||||||||
44 | m_isRenderThreadProxy = true; | - | ||||||||||||||||||
45 | m_animation = qobject_cast<QQuickAbstractAnimation *>(item); | - | ||||||||||||||||||
46 | - | |||||||||||||||||||
47 | setLoopCount(job->loopCount()); | - | ||||||||||||||||||
48 | m_duration = -1; | - | ||||||||||||||||||
49 | - | |||||||||||||||||||
50 | QObject *ctx = findAnimationContext(m_animation); | - | ||||||||||||||||||
51 | if (!ctx
| 0-32 | ||||||||||||||||||
52 | QMessageLogger(__FILE__, 111, __PRETTY_FUNCTION__).warning("QtQuick: unable to find animation context for RT animation..."); | - | ||||||||||||||||||
53 | return; never executed: return; | 0 | ||||||||||||||||||
54 | } | - | ||||||||||||||||||
55 | - | |||||||||||||||||||
56 | QQuickWindow *window = qobject_cast<QQuickWindow *>(ctx); | - | ||||||||||||||||||
57 | if (window
| 0-32 | ||||||||||||||||||
58 | setWindow(window); | - | ||||||||||||||||||
59 | } never executed: else {end of block | 0 | ||||||||||||||||||
60 | QQuickItem *item = qobject_cast<QQuickItem *>(ctx); | - | ||||||||||||||||||
61 | if (item->window()
| 0-32 | ||||||||||||||||||
62 | setWindow(item->window()); executed 32 times by 2 tests: setWindow(item->window()); Executed by:
| 32 | ||||||||||||||||||
63 | connect(item, &QQuickItem::windowChanged, this, &QQuickAnimatorProxyJob::windowChanged); | - | ||||||||||||||||||
64 | } executed 32 times by 2 tests: end of block Executed by:
| 32 | ||||||||||||||||||
65 | } | - | ||||||||||||||||||
66 | - | |||||||||||||||||||
67 | QQuickAnimatorProxyJob::~QQuickAnimatorProxyJob() | - | ||||||||||||||||||
68 | { | - | ||||||||||||||||||
69 | if (m_job
| 0-32 | ||||||||||||||||||
70 | m_controller->cancel(m_job); never executed: m_controller->cancel(m_job); | 0 | ||||||||||||||||||
71 | m_job.reset(); | - | ||||||||||||||||||
72 | } executed 32 times by 2 tests: end of block Executed by:
| 32 | ||||||||||||||||||
73 | - | |||||||||||||||||||
74 | QObject *QQuickAnimatorProxyJob::findAnimationContext(QQuickAbstractAnimation *a) | - | ||||||||||||||||||
75 | { | - | ||||||||||||||||||
76 | QObject *p = a->parent(); | - | ||||||||||||||||||
77 | while (p != nullptr
| 0-32 | ||||||||||||||||||
78 | p = p->parent(); never executed: p = p->parent(); | 0 | ||||||||||||||||||
79 | return executed 32 times by 2 tests: p;return p; Executed by:
executed 32 times by 2 tests: return p; Executed by:
| 32 | ||||||||||||||||||
80 | } | - | ||||||||||||||||||
81 | - | |||||||||||||||||||
82 | void QQuickAnimatorProxyJob::updateCurrentTime(int) | - | ||||||||||||||||||
83 | { | - | ||||||||||||||||||
84 | if (m_internalState != State_Running
| 0-653 | ||||||||||||||||||
85 | return; never executed: return; | 0 | ||||||||||||||||||
86 | - | |||||||||||||||||||
87 | - | |||||||||||||||||||
88 | - | |||||||||||||||||||
89 | - | |||||||||||||||||||
90 | ((m_controller) ? static_cast<void>(0) : qt_assert("m_controller", __FILE__, 149)); | - | ||||||||||||||||||
91 | if (!m_controller->isPendingStart(m_job)
| 31-622 | ||||||||||||||||||
92 | && !m_job->isRunning()
| 0-622 | ||||||||||||||||||
93 | stop(); | - | ||||||||||||||||||
94 | } never executed: end of block | 0 | ||||||||||||||||||
95 | } executed 653 times by 2 tests: end of block Executed by:
| 653 | ||||||||||||||||||
96 | - | |||||||||||||||||||
97 | void QQuickAnimatorProxyJob::updateState(QAbstractAnimationJob::State newState, QAbstractAnimationJob::State) | - | ||||||||||||||||||
98 | { | - | ||||||||||||||||||
99 | if (m_state == Running
| 30 | ||||||||||||||||||
100 | m_internalState = State_Starting; | - | ||||||||||||||||||
101 | if (m_controller
| 0-30 | ||||||||||||||||||
102 | m_internalState = State_Running; | - | ||||||||||||||||||
103 | m_controller->start(m_job); | - | ||||||||||||||||||
104 | } executed 30 times by 2 tests: end of block Executed by:
| 30 | ||||||||||||||||||
105 | - | |||||||||||||||||||
106 | } executed 30 times by 2 tests: else if (newState == Stoppedend of block Executed by:
| 0-30 | ||||||||||||||||||
107 | m_internalState = State_Stopped; | - | ||||||||||||||||||
108 | if (m_controller
| 0-30 | ||||||||||||||||||
109 | syncBackCurrentValues(); | - | ||||||||||||||||||
110 | m_controller->cancel(m_job); | - | ||||||||||||||||||
111 | } never executed: end of block | 0 | ||||||||||||||||||
112 | } executed 30 times by 2 tests: end of block Executed by:
| 30 | ||||||||||||||||||
113 | } executed 60 times by 2 tests: end of block Executed by:
| 60 | ||||||||||||||||||
114 | - | |||||||||||||||||||
115 | void QQuickAnimatorProxyJob::debugAnimation(QDebug d) const | - | ||||||||||||||||||
116 | { | - | ||||||||||||||||||
117 | d << "QuickAnimatorProxyJob("<< hex << (const void *) this << dec | - | ||||||||||||||||||
118 | << "state:" << state() << "duration:" << duration() | - | ||||||||||||||||||
119 | << "proxying: (" << job() << ')'; | - | ||||||||||||||||||
120 | } never executed: end of block | 0 | ||||||||||||||||||
121 | - | |||||||||||||||||||
122 | void QQuickAnimatorProxyJob::windowChanged(QQuickWindow *window) | - | ||||||||||||||||||
123 | { | - | ||||||||||||||||||
124 | setWindow(window); | - | ||||||||||||||||||
125 | } executed 32 times by 2 tests: end of block Executed by:
| 32 | ||||||||||||||||||
126 | - | |||||||||||||||||||
127 | void QQuickAnimatorProxyJob::setWindow(QQuickWindow *window) | - | ||||||||||||||||||
128 | { | - | ||||||||||||||||||
129 | if (!window
| 32 | ||||||||||||||||||
130 | if (m_job
| 0-32 | ||||||||||||||||||
131 | disconnect(m_controller->window(), &QQuickWindow::sceneGraphInitialized, | - | ||||||||||||||||||
132 | this, &QQuickAnimatorProxyJob::sceneGraphInitialized); | - | ||||||||||||||||||
133 | m_controller->cancel(m_job); | - | ||||||||||||||||||
134 | } executed 4 times by 2 tests: end of block Executed by:
| 4 | ||||||||||||||||||
135 | - | |||||||||||||||||||
136 | m_controller = nullptr; | - | ||||||||||||||||||
137 | stop(); | - | ||||||||||||||||||
138 | - | |||||||||||||||||||
139 | } executed 32 times by 2 tests: else if (!m_controllerend of block Executed by:
| 0-32 | ||||||||||||||||||
140 | m_controller = QQuickWindowPrivate::get(window)->animationController; | - | ||||||||||||||||||
141 | if (window->isSceneGraphInitialized()
| 4-28 | ||||||||||||||||||
142 | readyToAnimate(); executed 28 times by 1 test: readyToAnimate(); Executed by:
| 28 | ||||||||||||||||||
143 | else | - | ||||||||||||||||||
144 | connect(window, &QQuickWindow::sceneGraphInitialized, this, &QQuickAnimatorProxyJob::sceneGraphInitialized); executed 4 times by 1 test: connect(window, &QQuickWindow::sceneGraphInitialized, this, &QQuickAnimatorProxyJob::sceneGraphInitialized); Executed by:
| 4 | ||||||||||||||||||
145 | } | - | ||||||||||||||||||
146 | } executed 64 times by 2 tests: end of block Executed by:
| 64 | ||||||||||||||||||
147 | - | |||||||||||||||||||
148 | void QQuickAnimatorProxyJob::sceneGraphInitialized() | - | ||||||||||||||||||
149 | { | - | ||||||||||||||||||
150 | disconnect(m_controller->window(), &QQuickWindow::sceneGraphInitialized, this, &QQuickAnimatorProxyJob::sceneGraphInitialized); | - | ||||||||||||||||||
151 | readyToAnimate(); | - | ||||||||||||||||||
152 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||
153 | - | |||||||||||||||||||
154 | void QQuickAnimatorProxyJob::readyToAnimate() | - | ||||||||||||||||||
155 | { | - | ||||||||||||||||||
156 | ((m_controller) ? static_cast<void>(0) : qt_assert("m_controller", __FILE__, 226)); | - | ||||||||||||||||||
157 | if (m_internalState == State_Starting
| 0-30 | ||||||||||||||||||
158 | m_internalState = State_Running; | - | ||||||||||||||||||
159 | m_controller->start(m_job); | - | ||||||||||||||||||
160 | } never executed: end of block | 0 | ||||||||||||||||||
161 | } executed 30 times by 2 tests: end of block Executed by:
| 30 | ||||||||||||||||||
162 | - | |||||||||||||||||||
163 | static void qquick_syncback_helper(QAbstractAnimationJob *job) | - | ||||||||||||||||||
164 | { | - | ||||||||||||||||||
165 | if (job->isRenderThreadJob()
| 0 | ||||||||||||||||||
166 | static_cast<QQuickAnimatorJob *>(job)->writeBack(); | - | ||||||||||||||||||
167 | - | |||||||||||||||||||
168 | } never executed: else if (job->isGroup()end of block
| 0 | ||||||||||||||||||
169 | QAnimationGroupJob *g = static_cast<QAnimationGroupJob *>(job); | - | ||||||||||||||||||
170 | for (QAbstractAnimationJob *a = g->firstChild(); a
| 0 | ||||||||||||||||||
171 | qquick_syncback_helper(a); never executed: qquick_syncback_helper(a); | 0 | ||||||||||||||||||
172 | } never executed: end of block | 0 | ||||||||||||||||||
173 | - | |||||||||||||||||||
174 | } never executed: end of block | 0 | ||||||||||||||||||
175 | - | |||||||||||||||||||
176 | void QQuickAnimatorProxyJob::syncBackCurrentValues() | - | ||||||||||||||||||
177 | { | - | ||||||||||||||||||
178 | if (m_job
| 0 | ||||||||||||||||||
179 | qquick_syncback_helper(m_job.data()); never executed: qquick_syncback_helper(m_job.data()); | 0 | ||||||||||||||||||
180 | } never executed: end of block | 0 | ||||||||||||||||||
181 | - | |||||||||||||||||||
182 | QQuickAnimatorJob::QQuickAnimatorJob() | - | ||||||||||||||||||
183 | : m_target(nullptr) | - | ||||||||||||||||||
184 | , m_controller(nullptr) | - | ||||||||||||||||||
185 | , m_from(0) | - | ||||||||||||||||||
186 | , m_to(0) | - | ||||||||||||||||||
187 | , m_value(0) | - | ||||||||||||||||||
188 | , m_duration(0) | - | ||||||||||||||||||
189 | , m_isTransform(false) | - | ||||||||||||||||||
190 | , m_isUniform(false) | - | ||||||||||||||||||
191 | { | - | ||||||||||||||||||
192 | m_isRenderThreadJob = true; | - | ||||||||||||||||||
193 | } executed 36 times by 2 tests: end of block Executed by:
| 36 | ||||||||||||||||||
194 | - | |||||||||||||||||||
195 | void QQuickAnimatorJob::debugAnimation(QDebug d) const | - | ||||||||||||||||||
196 | { | - | ||||||||||||||||||
197 | d << "QuickAnimatorJob(" << hex << (const void *) this << dec | - | ||||||||||||||||||
198 | << ") state:" << state() << "duration:" << duration() | - | ||||||||||||||||||
199 | << "target:" << m_target << "value:" << m_value; | - | ||||||||||||||||||
200 | } never executed: end of block | 0 | ||||||||||||||||||
201 | - | |||||||||||||||||||
202 | qreal QQuickAnimatorJob::progress(int time) const | - | ||||||||||||||||||
203 | { | - | ||||||||||||||||||
204 | return executed 22 times by 1 test: m_easing.valueForProgress((m_duration == 0) ? qreal(1) : qreal(time) / qreal(m_duration));return m_easing.valueForProgress((m_duration == 0) ? qreal(1) : qreal(time) / qreal(m_duration)); Executed by:
executed 22 times by 1 test: return m_easing.valueForProgress((m_duration == 0) ? qreal(1) : qreal(time) / qreal(m_duration)); Executed by:
| 22 | ||||||||||||||||||
205 | } | - | ||||||||||||||||||
206 | - | |||||||||||||||||||
207 | qreal QQuickAnimatorJob::value() const | - | ||||||||||||||||||
208 | { | - | ||||||||||||||||||
209 | qreal value = m_to; | - | ||||||||||||||||||
210 | if (m_controller
| 0 | ||||||||||||||||||
211 | m_controller->lock(); | - | ||||||||||||||||||
212 | value = m_value; | - | ||||||||||||||||||
213 | m_controller->unlock(); | - | ||||||||||||||||||
214 | } never executed: end of block | 0 | ||||||||||||||||||
215 | return never executed: value;return value; never executed: return value; | 0 | ||||||||||||||||||
216 | } | - | ||||||||||||||||||
217 | - | |||||||||||||||||||
218 | void QQuickAnimatorJob::setTarget(QQuickItem *target) | - | ||||||||||||||||||
219 | { | - | ||||||||||||||||||
220 | m_target = target; | - | ||||||||||||||||||
221 | } executed 42 times by 2 tests: end of block Executed by:
| 42 | ||||||||||||||||||
222 | - | |||||||||||||||||||
223 | void QQuickAnimatorJob::initialize(QQuickAnimatorController *controller) | - | ||||||||||||||||||
224 | { | - | ||||||||||||||||||
225 | m_controller = controller; | - | ||||||||||||||||||
226 | } executed 36 times by 2 tests: end of block Executed by:
| 36 | ||||||||||||||||||
227 | - | |||||||||||||||||||
228 | QQuickTransformAnimatorJob::QQuickTransformAnimatorJob() | - | ||||||||||||||||||
229 | : m_helper(nullptr) | - | ||||||||||||||||||
230 | { | - | ||||||||||||||||||
231 | m_isTransform = true; | - | ||||||||||||||||||
232 | } executed 26 times by 1 test: end of block Executed by:
| 26 | ||||||||||||||||||
233 | - | |||||||||||||||||||
234 | QQuickTransformAnimatorJob::~QQuickTransformAnimatorJob() | - | ||||||||||||||||||
235 | { | - | ||||||||||||||||||
236 | if (m_helper
| 0-26 | ||||||||||||||||||
237 | qquick_transform_animatorjob_helper_store()->release(m_helper); executed 26 times by 1 test: qquick_transform_animatorjob_helper_store()->release(m_helper); Executed by:
| 26 | ||||||||||||||||||
238 | } executed 26 times by 1 test: end of block Executed by:
| 26 | ||||||||||||||||||
239 | - | |||||||||||||||||||
240 | void QQuickTransformAnimatorJob::setTarget(QQuickItem *item) | - | ||||||||||||||||||
241 | { | - | ||||||||||||||||||
242 | - | |||||||||||||||||||
243 | - | |||||||||||||||||||
244 | - | |||||||||||||||||||
245 | if (m_helper
| 0-34 | ||||||||||||||||||
246 | m_helper->wasSynced = false; never executed: m_helper->wasSynced = false; | 0 | ||||||||||||||||||
247 | QQuickAnimatorJob::setTarget(item); | - | ||||||||||||||||||
248 | } executed 34 times by 1 test: end of block Executed by:
| 34 | ||||||||||||||||||
249 | - | |||||||||||||||||||
250 | void QQuickTransformAnimatorJob::preSync() | - | ||||||||||||||||||
251 | { | - | ||||||||||||||||||
252 | - | |||||||||||||||||||
253 | if (m_helper
| 0-26 | ||||||||||||||||||
254 | qquick_transform_animatorjob_helper_store()->release(m_helper); | - | ||||||||||||||||||
255 | m_helper = nullptr; | - | ||||||||||||||||||
256 | } never executed: end of block | 0 | ||||||||||||||||||
257 | - | |||||||||||||||||||
258 | if (!m_target
| 0-26 | ||||||||||||||||||
259 | invalidate(); | - | ||||||||||||||||||
260 | return; never executed: return; | 0 | ||||||||||||||||||
261 | } | - | ||||||||||||||||||
262 | - | |||||||||||||||||||
263 | if (!m_helper
| 0-26 | ||||||||||||||||||
264 | m_helper = qquick_transform_animatorjob_helper_store()->acquire(m_target); | - | ||||||||||||||||||
265 | m_helper->wasSynced = false; | - | ||||||||||||||||||
266 | } executed 26 times by 1 test: end of block Executed by:
| 26 | ||||||||||||||||||
267 | - | |||||||||||||||||||
268 | m_helper->sync(); | - | ||||||||||||||||||
269 | } executed 26 times by 1 test: end of block Executed by:
| 26 | ||||||||||||||||||
270 | - | |||||||||||||||||||
271 | void QQuickTransformAnimatorJob::invalidate() | - | ||||||||||||||||||
272 | { | - | ||||||||||||||||||
273 | if (m_helper
| 0-34 | ||||||||||||||||||
274 | m_helper->node = nullptr; executed 34 times by 1 test: m_helper->node = nullptr; Executed by:
| 34 | ||||||||||||||||||
275 | } executed 34 times by 1 test: end of block Executed by:
| 34 | ||||||||||||||||||
276 | - | |||||||||||||||||||
277 | void QQuickTransformAnimatorJob::Helper::sync() | - | ||||||||||||||||||
278 | { | - | ||||||||||||||||||
279 | const quint32 mask = QQuickItemPrivate::Position | - | ||||||||||||||||||
280 | | QQuickItemPrivate::BasicTransform | - | ||||||||||||||||||
281 | | QQuickItemPrivate::TransformOrigin | - | ||||||||||||||||||
282 | | QQuickItemPrivate::Size; | - | ||||||||||||||||||
283 | - | |||||||||||||||||||
284 | QQuickItemPrivate *d = QQuickItemPrivate::get(item); | - | ||||||||||||||||||
285 | - | |||||||||||||||||||
286 | if (d->extra.isAllocated()
| 10-16 | ||||||||||||||||||
287 | && d->extra->layer
| 0-10 | ||||||||||||||||||
288 | && d->extra->layer->enabled()
| 0 | ||||||||||||||||||
289 | d = QQuickItemPrivate::get(d->extra->layer->m_effectSource); | - | ||||||||||||||||||
290 | } never executed: end of block | 0 | ||||||||||||||||||
291 | - | |||||||||||||||||||
292 | - | |||||||||||||||||||
293 | quint32 dirty = mask & d->dirtyAttributes; | - | ||||||||||||||||||
294 | - | |||||||||||||||||||
295 | if (!wasSynced
| 0-26 | ||||||||||||||||||
296 | dirty = 0xffffffffu; | - | ||||||||||||||||||
297 | wasSynced = true; | - | ||||||||||||||||||
298 | } executed 26 times by 1 test: end of block Executed by:
| 26 | ||||||||||||||||||
299 | - | |||||||||||||||||||
300 | if (dirty == 0
| 0-26 | ||||||||||||||||||
301 | return; never executed: return; | 0 | ||||||||||||||||||
302 | - | |||||||||||||||||||
303 | node = d->itemNode(); | - | ||||||||||||||||||
304 | - | |||||||||||||||||||
305 | if (dirty & QQuickItemPrivate::Position
| 0-26 | ||||||||||||||||||
306 | dx = item->x(); | - | ||||||||||||||||||
307 | dy = item->y(); | - | ||||||||||||||||||
308 | } executed 26 times by 1 test: end of block Executed by:
| 26 | ||||||||||||||||||
309 | - | |||||||||||||||||||
310 | if (dirty & QQuickItemPrivate::BasicTransform
| 0-26 | ||||||||||||||||||
311 | scale = item->scale(); | - | ||||||||||||||||||
312 | rotation = item->rotation(); | - | ||||||||||||||||||
313 | } executed 26 times by 1 test: end of block Executed by:
| 26 | ||||||||||||||||||
314 | - | |||||||||||||||||||
315 | if (dirty & (QQuickItemPrivate::TransformOrigin | QQuickItemPrivate::Size)
| 0-26 | ||||||||||||||||||
316 | QPointF o = item->transformOriginPoint(); | - | ||||||||||||||||||
317 | ox = o.x(); | - | ||||||||||||||||||
318 | oy = o.y(); | - | ||||||||||||||||||
319 | } executed 26 times by 1 test: end of block Executed by:
| 26 | ||||||||||||||||||
320 | } executed 26 times by 1 test: end of block Executed by:
| 26 | ||||||||||||||||||
321 | - | |||||||||||||||||||
322 | void QQuickTransformAnimatorJob::Helper::commit() | - | ||||||||||||||||||
323 | { | - | ||||||||||||||||||
324 | if (!wasChanged
| 0-22 | ||||||||||||||||||
325 | return; executed 22 times by 1 test: return; Executed by:
| 22 | ||||||||||||||||||
326 | - | |||||||||||||||||||
327 | QMatrix4x4 m; | - | ||||||||||||||||||
328 | m.translate(dx, dy); | - | ||||||||||||||||||
329 | m.translate(ox, oy); | - | ||||||||||||||||||
330 | m.scale(scale); | - | ||||||||||||||||||
331 | m.rotate(rotation, 0, 0, 1); | - | ||||||||||||||||||
332 | m.translate(-ox, -oy); | - | ||||||||||||||||||
333 | node->setMatrix(m); | - | ||||||||||||||||||
334 | - | |||||||||||||||||||
335 | wasChanged = false; | - | ||||||||||||||||||
336 | } executed 22 times by 1 test: end of block Executed by:
| 22 | ||||||||||||||||||
337 | - | |||||||||||||||||||
338 | void QQuickTransformAnimatorJob::commit() | - | ||||||||||||||||||
339 | { | - | ||||||||||||||||||
340 | if (m_helper
| 0-44 | ||||||||||||||||||
341 | m_helper->commit(); executed 44 times by 1 test: m_helper->commit(); Executed by:
| 44 | ||||||||||||||||||
342 | } executed 44 times by 1 test: end of block Executed by:
| 44 | ||||||||||||||||||
343 | - | |||||||||||||||||||
344 | void QQuickXAnimatorJob::writeBack() | - | ||||||||||||||||||
345 | { | - | ||||||||||||||||||
346 | if (m_target
| 0 | ||||||||||||||||||
347 | m_target->setX(value()); never executed: m_target->setX(value()); | 0 | ||||||||||||||||||
348 | } never executed: end of block | 0 | ||||||||||||||||||
349 | - | |||||||||||||||||||
350 | void QQuickXAnimatorJob::updateCurrentTime(int time) | - | ||||||||||||||||||
351 | { | - | ||||||||||||||||||
352 | - | |||||||||||||||||||
353 | ((!m_controller || !m_controller->m_window->openglContext() || m_controller->m_window->openglContext()->thread() == QThread::currentThread()) ? static_cast<void>(0) : qt_assert("!m_controller || !m_controller->m_window->openglContext() || m_controller->m_window->openglContext()->thread() == QThread::currentThread()", __FILE__, 433)); | - | ||||||||||||||||||
354 | - | |||||||||||||||||||
355 | if (!m_helper
| 0-4 | ||||||||||||||||||
356 | return; never executed: return; | 0 | ||||||||||||||||||
357 | - | |||||||||||||||||||
358 | m_value = m_from + (m_to - m_from) * progress(time); | - | ||||||||||||||||||
359 | m_helper->dx = m_value; | - | ||||||||||||||||||
360 | m_helper->wasChanged = true; | - | ||||||||||||||||||
361 | } executed 4 times by 1 test: end of block Executed by:
| 4 | ||||||||||||||||||
362 | - | |||||||||||||||||||
363 | void QQuickYAnimatorJob::writeBack() | - | ||||||||||||||||||
364 | { | - | ||||||||||||||||||
365 | if (m_target
| 0 | ||||||||||||||||||
366 | m_target->setY(value()); never executed: m_target->setY(value()); | 0 | ||||||||||||||||||
367 | } never executed: end of block | 0 | ||||||||||||||||||
368 | - | |||||||||||||||||||
369 | void QQuickYAnimatorJob::updateCurrentTime(int time) | - | ||||||||||||||||||
370 | { | - | ||||||||||||||||||
371 | - | |||||||||||||||||||
372 | ((!m_controller || !m_controller->m_window->openglContext() || m_controller->m_window->openglContext()->thread() == QThread::currentThread()) ? static_cast<void>(0) : qt_assert("!m_controller || !m_controller->m_window->openglContext() || m_controller->m_window->openglContext()->thread() == QThread::currentThread()", __FILE__, 452)); | - | ||||||||||||||||||
373 | - | |||||||||||||||||||
374 | if (!m_helper
| 0-6 | ||||||||||||||||||
375 | return; never executed: return; | 0 | ||||||||||||||||||
376 | - | |||||||||||||||||||
377 | m_value = m_from + (m_to - m_from) * progress(time); | - | ||||||||||||||||||
378 | m_helper->dy = m_value; | - | ||||||||||||||||||
379 | m_helper->wasChanged = true; | - | ||||||||||||||||||
380 | } executed 6 times by 1 test: end of block Executed by:
| 6 | ||||||||||||||||||
381 | - | |||||||||||||||||||
382 | void QQuickScaleAnimatorJob::writeBack() | - | ||||||||||||||||||
383 | { | - | ||||||||||||||||||
384 | if (m_target
| 0 | ||||||||||||||||||
385 | m_target->setScale(value()); never executed: m_target->setScale(value()); | 0 | ||||||||||||||||||
386 | } never executed: end of block | 0 | ||||||||||||||||||
387 | - | |||||||||||||||||||
388 | void QQuickScaleAnimatorJob::updateCurrentTime(int time) | - | ||||||||||||||||||
389 | { | - | ||||||||||||||||||
390 | - | |||||||||||||||||||
391 | ((!m_controller || !m_controller->m_window->openglContext() || m_controller->m_window->openglContext()->thread() == QThread::currentThread()) ? static_cast<void>(0) : qt_assert("!m_controller || !m_controller->m_window->openglContext() || m_controller->m_window->openglContext()->thread() == QThread::currentThread()", __FILE__, 471)); | - | ||||||||||||||||||
392 | - | |||||||||||||||||||
393 | if (!m_helper
| 0-8 | ||||||||||||||||||
394 | return; never executed: return; | 0 | ||||||||||||||||||
395 | - | |||||||||||||||||||
396 | m_value = m_from + (m_to - m_from) * progress(time); | - | ||||||||||||||||||
397 | m_helper->scale = m_value; | - | ||||||||||||||||||
398 | m_helper->wasChanged = true; | - | ||||||||||||||||||
399 | } executed 8 times by 1 test: end of block Executed by:
| 8 | ||||||||||||||||||
400 | - | |||||||||||||||||||
401 | - | |||||||||||||||||||
402 | QQuickRotationAnimatorJob::QQuickRotationAnimatorJob() | - | ||||||||||||||||||
403 | : m_direction(QQuickRotationAnimator::Numerical) | - | ||||||||||||||||||
404 | { | - | ||||||||||||||||||
405 | } executed 4 times by 1 test: end of block Executed by:
| 4 | ||||||||||||||||||
406 | - | |||||||||||||||||||
407 | extern QVariant _q_interpolateShortestRotation(qreal &f, qreal &t, qreal progress); | - | ||||||||||||||||||
408 | extern QVariant _q_interpolateClockwiseRotation(qreal &f, qreal &t, qreal progress); | - | ||||||||||||||||||
409 | extern QVariant _q_interpolateCounterclockwiseRotation(qreal &f, qreal &t, qreal progress); | - | ||||||||||||||||||
410 | - | |||||||||||||||||||
411 | void QQuickRotationAnimatorJob::updateCurrentTime(int time) | - | ||||||||||||||||||
412 | { | - | ||||||||||||||||||
413 | - | |||||||||||||||||||
414 | ((!m_controller || !m_controller->m_window->openglContext() || m_controller->m_window->openglContext()->thread() == QThread::currentThread()) ? static_cast<void>(0) : qt_assert("!m_controller || !m_controller->m_window->openglContext() || m_controller->m_window->openglContext()->thread() == QThread::currentThread()", __FILE__, 494)); | - | ||||||||||||||||||
415 | - | |||||||||||||||||||
416 | if (!m_helper
| 0-4 | ||||||||||||||||||
417 | return; never executed: return; | 0 | ||||||||||||||||||
418 | - | |||||||||||||||||||
419 | float t = progress(time); | - | ||||||||||||||||||
420 | - | |||||||||||||||||||
421 | switch (m_direction) { | - | ||||||||||||||||||
422 | case never executed: QQuickRotationAnimator::Clockwise:case QQuickRotationAnimator::Clockwise: never executed: case QQuickRotationAnimator::Clockwise: | 0 | ||||||||||||||||||
423 | m_value = _q_interpolateClockwiseRotation(m_from, m_to, t).toFloat(); | - | ||||||||||||||||||
424 | - | |||||||||||||||||||
425 | - | |||||||||||||||||||
426 | - | |||||||||||||||||||
427 | if (t == 1
| 0 | ||||||||||||||||||
428 | m_value = m_to; never executed: m_value = m_to; | 0 | ||||||||||||||||||
429 | break; never executed: break; | 0 | ||||||||||||||||||
430 | case never executed: QQuickRotationAnimator::Counterclockwise:case QQuickRotationAnimator::Counterclockwise: never executed: case QQuickRotationAnimator::Counterclockwise: | 0 | ||||||||||||||||||
431 | m_value = _q_interpolateCounterclockwiseRotation(m_from, m_to, t).toFloat(); | - | ||||||||||||||||||
432 | break; never executed: break; | 0 | ||||||||||||||||||
433 | case never executed: QQuickRotationAnimator::Shortest:case QQuickRotationAnimator::Shortest: never executed: case QQuickRotationAnimator::Shortest: | 0 | ||||||||||||||||||
434 | m_value = _q_interpolateShortestRotation(m_from, m_to, t).toFloat(); | - | ||||||||||||||||||
435 | break; never executed: break; | 0 | ||||||||||||||||||
436 | case executed 4 times by 1 test: QQuickRotationAnimator::Numerical:case QQuickRotationAnimator::Numerical: Executed by:
executed 4 times by 1 test: case QQuickRotationAnimator::Numerical: Executed by:
| 4 | ||||||||||||||||||
437 | m_value = m_from + (m_to - m_from) * t; | - | ||||||||||||||||||
438 | break; executed 4 times by 1 test: break; Executed by:
| 4 | ||||||||||||||||||
439 | } | - | ||||||||||||||||||
440 | m_helper->rotation = m_value; | - | ||||||||||||||||||
441 | m_helper->wasChanged = true; | - | ||||||||||||||||||
442 | } executed 4 times by 1 test: end of block Executed by:
| 4 | ||||||||||||||||||
443 | - | |||||||||||||||||||
444 | void QQuickRotationAnimatorJob::writeBack() | - | ||||||||||||||||||
445 | { | - | ||||||||||||||||||
446 | if (m_target
| 0 | ||||||||||||||||||
447 | m_target->setRotation(value()); never executed: m_target->setRotation(value()); | 0 | ||||||||||||||||||
448 | } never executed: end of block | 0 | ||||||||||||||||||
449 | - | |||||||||||||||||||
450 | - | |||||||||||||||||||
451 | QQuickOpacityAnimatorJob::QQuickOpacityAnimatorJob() | - | ||||||||||||||||||
452 | : m_opacityNode(nullptr) | - | ||||||||||||||||||
453 | { | - | ||||||||||||||||||
454 | } executed 6 times by 2 tests: end of block Executed by:
| 6 | ||||||||||||||||||
455 | - | |||||||||||||||||||
456 | void QQuickOpacityAnimatorJob::postSync() | - | ||||||||||||||||||
457 | { | - | ||||||||||||||||||
458 | if (!m_target
| 8-847 | ||||||||||||||||||
459 | invalidate(); | - | ||||||||||||||||||
460 | return; executed 847 times by 1 test: return; Executed by:
| 847 | ||||||||||||||||||
461 | } | - | ||||||||||||||||||
462 | - | |||||||||||||||||||
463 | QQuickItemPrivate *d = QQuickItemPrivate::get(m_target); | - | ||||||||||||||||||
464 | - | |||||||||||||||||||
465 | if (d->extra.isAllocated()
| 4 | ||||||||||||||||||
466 | && d->extra->layer
| 0-4 | ||||||||||||||||||
467 | && d->extra->layer->enabled()
| 0 | ||||||||||||||||||
468 | d = QQuickItemPrivate::get(d->extra->layer->m_effectSource); | - | ||||||||||||||||||
469 | } never executed: end of block | 0 | ||||||||||||||||||
470 | - | |||||||||||||||||||
471 | - | |||||||||||||||||||
472 | m_opacityNode = d->opacityNode(); | - | ||||||||||||||||||
473 | - | |||||||||||||||||||
474 | if (!m_opacityNode
| 2-6 | ||||||||||||||||||
475 | m_opacityNode = new QSGOpacityNode(); | - | ||||||||||||||||||
476 | QSGNode *iNode = d->itemNode(); | - | ||||||||||||||||||
477 | QSGNode *child = d->childContainerNode(); | - | ||||||||||||||||||
478 | if (child != iNode
| 0-6 | ||||||||||||||||||
479 | if (child->parent()
| 0 | ||||||||||||||||||
480 | child->parent()->removeChildNode(child); never executed: child->parent()->removeChildNode(child); | 0 | ||||||||||||||||||
481 | m_opacityNode->appendChildNode(child); | - | ||||||||||||||||||
482 | iNode->appendChildNode(m_opacityNode); | - | ||||||||||||||||||
483 | } never executed: else {end of block | 0 | ||||||||||||||||||
484 | iNode->reparentChildNodesTo(m_opacityNode); | - | ||||||||||||||||||
485 | iNode->appendChildNode(m_opacityNode); | - | ||||||||||||||||||
486 | } executed 6 times by 2 tests: end of block Executed by:
| 6 | ||||||||||||||||||
487 | - | |||||||||||||||||||
488 | d->extra.value().opacityNode = m_opacityNode; | - | ||||||||||||||||||
489 | } executed 6 times by 2 tests: end of block Executed by:
| 6 | ||||||||||||||||||
490 | ((m_opacityNode) ? static_cast<void>(0) : qt_assert("m_opacityNode", __FILE__, 584)); | - | ||||||||||||||||||
491 | } executed 8 times by 2 tests: end of block Executed by:
| 8 | ||||||||||||||||||
492 | - | |||||||||||||||||||
493 | void QQuickOpacityAnimatorJob::invalidate() | - | ||||||||||||||||||
494 | { | - | ||||||||||||||||||
495 | m_opacityNode = nullptr; | - | ||||||||||||||||||
496 | } executed 853 times by 2 tests: end of block Executed by:
| 853 | ||||||||||||||||||
497 | - | |||||||||||||||||||
498 | void QQuickOpacityAnimatorJob::writeBack() | - | ||||||||||||||||||
499 | { | - | ||||||||||||||||||
500 | if (m_target
| 0 | ||||||||||||||||||
501 | m_target->setOpacity(value()); never executed: m_target->setOpacity(value()); | 0 | ||||||||||||||||||
502 | } never executed: end of block | 0 | ||||||||||||||||||
503 | - | |||||||||||||||||||
504 | void QQuickOpacityAnimatorJob::updateCurrentTime(int time) | - | ||||||||||||||||||
505 | { | - | ||||||||||||||||||
506 | - | |||||||||||||||||||
507 | ((!m_controller || !m_controller->m_window->openglContext() || m_controller->m_window->openglContext()->thread() == QThread::currentThread()) ? static_cast<void>(0) : qt_assert("!m_controller || !m_controller->m_window->openglContext() || m_controller->m_window->openglContext()->thread() == QThread::currentThread()", __FILE__, 601)); | - | ||||||||||||||||||
508 | - | |||||||||||||||||||
509 | - | |||||||||||||||||||
510 | if (!m_opacityNode
| 0-628 | ||||||||||||||||||
511 | return; executed 628 times by 2 tests: return; Executed by:
| 628 | ||||||||||||||||||
512 | - | |||||||||||||||||||
513 | m_value = m_from + (m_to - m_from) * progress(time); | - | ||||||||||||||||||
514 | m_opacityNode->setOpacity(m_value); | - | ||||||||||||||||||
515 | } never executed: end of block | 0 | ||||||||||||||||||
516 | - | |||||||||||||||||||
517 | - | |||||||||||||||||||
518 | - | |||||||||||||||||||
519 | QQuickUniformAnimatorJob::QQuickUniformAnimatorJob() | - | ||||||||||||||||||
520 | : m_node(nullptr) | - | ||||||||||||||||||
521 | , m_uniformIndex(-1) | - | ||||||||||||||||||
522 | , m_uniformType(-1) | - | ||||||||||||||||||
523 | { | - | ||||||||||||||||||
524 | m_isUniform = true; | - | ||||||||||||||||||
525 | } executed 4 times by 1 test: end of block Executed by:
| 4 | ||||||||||||||||||
526 | - | |||||||||||||||||||
527 | void QQuickUniformAnimatorJob::setTarget(QQuickItem *target) | - | ||||||||||||||||||
528 | { | - | ||||||||||||||||||
529 | QQuickShaderEffect* effect = qobject_cast<QQuickShaderEffect*>(target); | - | ||||||||||||||||||
530 | if (effect
| 0-4 | ||||||||||||||||||
531 | m_target = target; executed 4 times by 1 test: m_target = target; Executed by:
| 4 | ||||||||||||||||||
532 | } executed 6 times by 1 test: end of block Executed by:
| 6 | ||||||||||||||||||
533 | - | |||||||||||||||||||
534 | void QQuickUniformAnimatorJob::invalidate() | - | ||||||||||||||||||
535 | { | - | ||||||||||||||||||
536 | m_node = nullptr; | - | ||||||||||||||||||
537 | m_uniformIndex = -1; | - | ||||||||||||||||||
538 | m_uniformType = -1; | - | ||||||||||||||||||
539 | } executed 4 times by 1 test: end of block Executed by:
| 4 | ||||||||||||||||||
540 | - | |||||||||||||||||||
541 | void QQuickUniformAnimatorJob::postSync() | - | ||||||||||||||||||
542 | { | - | ||||||||||||||||||
543 | if (!m_target
| 0-4 | ||||||||||||||||||
544 | invalidate(); | - | ||||||||||||||||||
545 | return; never executed: return; | 0 | ||||||||||||||||||
546 | } | - | ||||||||||||||||||
547 | - | |||||||||||||||||||
548 | m_node = static_cast<QQuickOpenGLShaderEffectNode *>(QQuickItemPrivate::get(m_target)->paintNode); | - | ||||||||||||||||||
549 | - | |||||||||||||||||||
550 | if (m_node
| 0-4 | ||||||||||||||||||
551 | QQuickOpenGLShaderEffectMaterial *material = | - | ||||||||||||||||||
552 | static_cast<QQuickOpenGLShaderEffectMaterial *>(m_node->material()); | - | ||||||||||||||||||
553 | bool found = false; | - | ||||||||||||||||||
554 | for (int t=0; !found
| 0-8 | ||||||||||||||||||
555 | const QVector<QQuickOpenGLShaderEffectMaterial::UniformData> &uniforms = material->uniforms[t]; | - | ||||||||||||||||||
556 | for (int i=0; i<uniforms.size()
| 4-8 | ||||||||||||||||||
557 | if (uniforms.at(i).name == m_uniform
| 4 | ||||||||||||||||||
558 | m_uniformIndex = i; | - | ||||||||||||||||||
559 | m_uniformType = t; | - | ||||||||||||||||||
560 | found = true; | - | ||||||||||||||||||
561 | break; executed 4 times by 1 test: break; Executed by:
| 4 | ||||||||||||||||||
562 | } | - | ||||||||||||||||||
563 | } executed 4 times by 1 test: end of block Executed by:
| 4 | ||||||||||||||||||
564 | } executed 8 times by 1 test: end of block Executed by:
| 8 | ||||||||||||||||||
565 | } executed 4 times by 1 test: end of block Executed by:
| 4 | ||||||||||||||||||
566 | - | |||||||||||||||||||
567 | } executed 4 times by 1 test: end of block Executed by:
| 4 | ||||||||||||||||||
568 | - | |||||||||||||||||||
569 | void QQuickUniformAnimatorJob::updateCurrentTime(int time) | - | ||||||||||||||||||
570 | { | - | ||||||||||||||||||
571 | if (!m_controller
| 0-4 | ||||||||||||||||||
572 | return; never executed: return; | 0 | ||||||||||||||||||
573 | - | |||||||||||||||||||
574 | if (!m_node
| 0-4 | ||||||||||||||||||
575 | return; executed 4 times by 1 test: return; Executed by:
| 4 | ||||||||||||||||||
576 | - | |||||||||||||||||||
577 | m_value = m_from + (m_to - m_from) * progress(time); | - | ||||||||||||||||||
578 | - | |||||||||||||||||||
579 | QQuickOpenGLShaderEffectMaterial *material = | - | ||||||||||||||||||
580 | static_cast<QQuickOpenGLShaderEffectMaterial *>(m_node->material()); | - | ||||||||||||||||||
581 | material->uniforms[m_uniformType][m_uniformIndex].value = m_value; | - | ||||||||||||||||||
582 | - | |||||||||||||||||||
583 | - | |||||||||||||||||||
584 | - | |||||||||||||||||||
585 | m_node->markDirty(QSGNode::DirtyMaterial); | - | ||||||||||||||||||
586 | } never executed: end of block | 0 | ||||||||||||||||||
587 | - | |||||||||||||||||||
588 | void QQuickUniformAnimatorJob::writeBack() | - | ||||||||||||||||||
589 | { | - | ||||||||||||||||||
590 | if (m_target
| 0 | ||||||||||||||||||
591 | m_target->setProperty(m_uniform, value()); never executed: m_target->setProperty(m_uniform, value()); | 0 | ||||||||||||||||||
592 | } never executed: end of block | 0 | ||||||||||||||||||
593 | - | |||||||||||||||||||
594 | - | |||||||||||||||||||
595 | - | |||||||||||||||||||
596 | - | |||||||||||||||||||
Switch to Source code | Preprocessed file |