OpenCoverage

qquickitemparticle.cpp

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/particles/qquickitemparticle.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3QQuickItemParticle::QQuickItemParticle(QQuickItem *parent) :-
4 QQuickParticlePainter(parent), m_fade(true), m_lastT(0), m_activeCount(0), m_delegate(nullptr)-
5{-
6 setFlag(QQuickItem::ItemHasContents);-
7 clock = new Clock(this);-
8 clock->start();-
9}
executed 8 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitemparticle
8
10-
11QQuickItemParticle::~QQuickItemParticle()-
12{-
13 delete clock;-
14}
executed 8 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitemparticle
8
15-
16void QQuickItemParticle::freeze(QQuickItem* item)-
17{-
18 m_stasis << item;-
19}
never executed: end of block
0
20-
21-
22void QQuickItemParticle::unfreeze(QQuickItem* item)-
23{-
24 m_stasis.remove(item);-
25}
never executed: end of block
0
26-
27void QQuickItemParticle::take(QQuickItem *item, bool prioritize)-
28{-
29 if (prioritize
prioritizeDescription
TRUEnever evaluated
FALSEevaluated 904 times by 1 test
Evaluated by:
  • tst_qquickitemparticle
)
0-904
30 m_pendingItems.push_front(item);
never executed: m_pendingItems.push_front(item);
0
31 else-
32 m_pendingItems.push_back(item);
executed 904 times by 1 test: m_pendingItems.push_back(item);
Executed by:
  • tst_qquickitemparticle
904
33}-
34-
35void QQuickItemParticle::give(QQuickItem *item)-
36{-
37-
38 (void)item;;-
39}
never executed: end of block
0
40-
41void QQuickItemParticle::initialize(int gIdx, int pIdx)-
42{-
43 m_loadables << m_system->groupData[gIdx]->data[pIdx];-
44}
executed 3392 times by 1 test: end of block
Executed by:
  • tst_qquickitemparticle
3392
45-
46void QQuickItemParticle::commit(int, int)-
47{-
48}-
49-
50void QQuickItemParticle::processDeletables()-
51{-
52 for (auto _container_ = QtPrivate::qMakeForeachContainer(m_deletables); _container_.control
_container_.controlDescription
TRUEevaluated 1966 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickitemparticle
FALSEnever evaluated
&& _container_.i != _container_.e
_container_.i != _container_.eDescription
TRUEevaluated 1716 times by 1 test
Evaluated by:
  • tst_qquickitemparticle
FALSEevaluated 250 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickitemparticle
; ++_container_.i, _container_.control ^= 1) for (QQuickItem* item = *_container_.i; _container_.control
_container_.controlDescription
TRUEevaluated 1716 times by 1 test
Evaluated by:
  • tst_qquickitemparticle
FALSEevaluated 1716 times by 1 test
Evaluated by:
  • tst_qquickitemparticle
; _container_.control = 0){
0-1966
53 if (m_fade
m_fadeDescription
TRUEevaluated 1716 times by 1 test
Evaluated by:
  • tst_qquickitemparticle
FALSEnever evaluated
)
0-1716
54 item->setOpacity(0.);
executed 1716 times by 1 test: item->setOpacity(0.);
Executed by:
  • tst_qquickitemparticle
1716
55 item->setVisible(false);-
56 QQuickItemParticleAttached* mpa;-
57 if ((
(mpa = qobject...ticle>(item)))Description
TRUEevaluated 1716 times by 1 test
Evaluated by:
  • tst_qquickitemparticle
FALSEnever evaluated
mpa = qobject_cast<QQuickItemParticleAttached*>(qmlAttachedPropertiesObject<QQuickItemParticle>(item)))
(mpa = qobject...ticle>(item)))Description
TRUEevaluated 1716 times by 1 test
Evaluated by:
  • tst_qquickitemparticle
FALSEnever evaluated
)
0-1716
58 mpa->detach();
executed 1716 times by 1 test: mpa->detach();
Executed by:
  • tst_qquickitemparticle
1716
59 int idx = -1;-
60 if ((
(idx = m_manag...f(item)) != -1Description
TRUEevaluated 1012 times by 1 test
Evaluated by:
  • tst_qquickitemparticle
FALSEevaluated 704 times by 1 test
Evaluated by:
  • tst_qquickitemparticle
idx = m_managed.indexOf(item)) != -1
(idx = m_manag...f(item)) != -1Description
TRUEevaluated 1012 times by 1 test
Evaluated by:
  • tst_qquickitemparticle
FALSEevaluated 704 times by 1 test
Evaluated by:
  • tst_qquickitemparticle
) {
704-1012
61 m_managed.takeAt(idx);-
62 delete item;-
63 }
executed 1012 times by 1 test: end of block
Executed by:
  • tst_qquickitemparticle
1012
64 m_activeCount--;-
65 }
executed 1716 times by 1 test: end of block
Executed by:
  • tst_qquickitemparticle
1716
66 m_deletables.clear();-
67}
executed 250 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitemparticle
250
68-
69void QQuickItemParticle::tick(int time)-
70{-
71 (void)time;;-
72 processDeletables();-
73-
74 for (auto _container_ = QtPrivate::qMakeForeachContainer(m_loadables); _container_.control
_container_.controlDescription
TRUEevaluated 3522 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickitemparticle
FALSEnever evaluated
&& _container_.i != _container_.e
_container_.i != _container_.eDescription
TRUEevaluated 3296 times by 1 test
Evaluated by:
  • tst_qquickitemparticle
FALSEevaluated 226 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickitemparticle
; ++_container_.i, _container_.control ^= 1) for (QQuickParticleData* d = *_container_.i; _container_.control
_container_.controlDescription
TRUEevaluated 3296 times by 1 test
Evaluated by:
  • tst_qquickitemparticle
FALSEevaluated 3296 times by 1 test
Evaluated by:
  • tst_qquickitemparticle
; _container_.control = 0){
0-3522
75 ((d) ? static_cast<void>(0) : qt_assert("d", __FILE__, 192));-
76 if (m_stasis.contains(d->delegate)
m_stasis.contains(d->delegate)Description
TRUEnever evaluated
FALSEevaluated 3296 times by 1 test
Evaluated by:
  • tst_qquickitemparticle
)
0-3296
77 QMessageLogger(__FILE__, 194, __PRETTY_FUNCTION__).warning() << "Current model particles prefers overwrite:false";
never executed: QMessageLogger(__FILE__, 194, __PRETTY_FUNCTION__).warning() << "Current model particles prefers overwrite:false";
0
78-
79 if (d->delegate
d->delegateDescription
TRUEevaluated 1812 times by 1 test
Evaluated by:
  • tst_qquickitemparticle
FALSEevaluated 1484 times by 1 test
Evaluated by:
  • tst_qquickitemparticle
) {
1484-1812
80 m_deletables << d->delegate;-
81 d->delegate = nullptr;-
82 }
executed 1812 times by 1 test: end of block
Executed by:
  • tst_qquickitemparticle
1812
83 if (!m_pendingItems.isEmpty()
!m_pendingItems.isEmpty()Description
TRUEevaluated 904 times by 1 test
Evaluated by:
  • tst_qquickitemparticle
FALSEevaluated 2392 times by 1 test
Evaluated by:
  • tst_qquickitemparticle
){
904-2392
84 d->delegate = m_pendingItems.front();-
85 m_pendingItems.pop_front();-
86 }
executed 904 times by 1 test: end of block
Executed by:
  • tst_qquickitemparticle
else if (m_delegate
m_delegateDescription
TRUEevaluated 2272 times by 1 test
Evaluated by:
  • tst_qquickitemparticle
FALSEevaluated 120 times by 1 test
Evaluated by:
  • tst_qquickitemparticle
){
120-2272
87 d->delegate = qobject_cast<QQuickItem*>(m_delegate->create(qmlContext(this)));-
88 if (d->delegate
d->delegateDescription
TRUEevaluated 2272 times by 1 test
Evaluated by:
  • tst_qquickitemparticle
FALSEnever evaluated
)
0-2272
89 m_managed << d->delegate;
executed 2272 times by 1 test: m_managed << d->delegate;
Executed by:
  • tst_qquickitemparticle
2272
90 }
executed 2272 times by 1 test: end of block
Executed by:
  • tst_qquickitemparticle
2272
91 if (d
dDescription
TRUEevaluated 3296 times by 1 test
Evaluated by:
  • tst_qquickitemparticle
FALSEnever evaluated
&& d->delegate
d->delegateDescription
TRUEevaluated 3176 times by 1 test
Evaluated by:
  • tst_qquickitemparticle
FALSEevaluated 120 times by 1 test
Evaluated by:
  • tst_qquickitemparticle
){
0-3296
92 d->delegate->setX(d->curX(m_system) - d->delegate->width() / 2);-
93 d->delegate->setY(d->curY(m_system) - d->delegate->height() / 2);-
94 QQuickItemParticleAttached* mpa = qobject_cast<QQuickItemParticleAttached*>(qmlAttachedPropertiesObject<QQuickItemParticle>(d->delegate));-
95 if (mpa
mpaDescription
TRUEevaluated 3176 times by 1 test
Evaluated by:
  • tst_qquickitemparticle
FALSEnever evaluated
){
0-3176
96 mpa->m_mp = this;-
97 mpa->attach();-
98 }
executed 3176 times by 1 test: end of block
Executed by:
  • tst_qquickitemparticle
3176
99 d->delegate->setParentItem(this);-
100 if (m_fade
m_fadeDescription
TRUEevaluated 3176 times by 1 test
Evaluated by:
  • tst_qquickitemparticle
FALSEnever evaluated
)
0-3176
101 d->delegate->setOpacity(0.);
executed 3176 times by 1 test: d->delegate->setOpacity(0.);
Executed by:
  • tst_qquickitemparticle
3176
102 d->delegate->setVisible(false);-
103 m_activeCount++;-
104 }
executed 3176 times by 1 test: end of block
Executed by:
  • tst_qquickitemparticle
3176
105 }
executed 3296 times by 1 test: end of block
Executed by:
  • tst_qquickitemparticle
3296
106 m_loadables.clear();-
107}
executed 226 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitemparticle
226
108-
109void QQuickItemParticle::reset()-
110{-
111 QQuickParticlePainter::reset();-
112 m_loadables.clear();-
113-
114-
115-
116 QSet<QQuickItem*> lost = QSet<QQuickItem*>::fromList(m_managed);-
117 for (auto groupId : groupIds()) {-
118 for (QQuickParticleData* d : qAsConst(m_system->groupData[groupId]->data)) {-
119 lost.remove(d->delegate);-
120 }
executed 2824 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitemparticle
2824
121 }
executed 16 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitemparticle
16
122 m_deletables.append(lost.toList());-
123-
124 processDeletables();-
125}
executed 24 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitemparticle
24
126-
127-
128QSGNode* QQuickItemParticle::updatePaintNode(QSGNode* n, UpdatePaintNodeData* d)-
129{-
130-
131 if (m_pleaseReset
m_pleaseResetDescription
TRUEevaluated 8 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickitemparticle
FALSEevaluated 346 times by 1 test
Evaluated by:
  • tst_qquickitemparticle
){
8-346
132 m_pleaseReset = false;-
133-
134-
135 for (auto groupId : groupIds()) {-
136 for (QQuickParticleData* d : qAsConst(m_system->groupData[groupId]->data)) {-
137 if (!d->delegate
!d->delegateDescription
TRUEevaluated 1412 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickitemparticle
FALSEnever evaluated
&& d->t != -1
d->t != -1Description
TRUEnever evaluated
FALSEevaluated 1412 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickitemparticle
&& d->stillAlive(m_system)
d->stillAlive(m_system)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0-1412
138 m_loadables << d;-
139 }
never executed: end of block
0
140 }
executed 1412 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitemparticle
1412
141 }
executed 8 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitemparticle
8
142 }
executed 8 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitemparticle
8
143 prepareNextFrame();-
144-
145 update();-
146 if (n
nDescription
TRUEnever evaluated
FALSEevaluated 354 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickitemparticle
)
0-354
147 n->markDirty(QSGNode::DirtyMaterial);
never executed: n->markDirty(QSGNode::DirtyMaterial);
0
148 return
executed 354 times by 2 tests: return QQuickItem::updatePaintNode(n,d);
Executed by:
  • tst_examples
  • tst_qquickitemparticle
QQuickItem::updatePaintNode(n,d);
executed 354 times by 2 tests: return QQuickItem::updatePaintNode(n,d);
Executed by:
  • tst_examples
  • tst_qquickitemparticle
354
149}-
150-
151void QQuickItemParticle::prepareNextFrame()-
152{-
153 if (!m_system
!m_systemDescription
TRUEnever evaluated
FALSEevaluated 354 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickitemparticle
)
0-354
154 return;
never executed: return;
0
155 qint64 timeStamp = m_system->systemSync(this);-
156 qreal curT = timeStamp/1000.0;-
157 qreal dt = curT - m_lastT;-
158 m_lastT = curT;-
159 if (!m_activeCount
!m_activeCountDescription
TRUEevaluated 33 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickitemparticle
FALSEevaluated 321 times by 1 test
Evaluated by:
  • tst_qquickitemparticle
)
33-321
160 return;
executed 33 times by 2 tests: return;
Executed by:
  • tst_examples
  • tst_qquickitemparticle
33
161-
162-
163 for (auto groupId : groupIds()) {-
164 for (QQuickParticleData* data : qAsConst(m_system->groupData[groupId]->data)) {-
165 QQuickItem* item = data->delegate;-
166 if (!item
!itemDescription
TRUEevaluated 29113 times by 1 test
Evaluated by:
  • tst_qquickitemparticle
FALSEevaluated 52987 times by 1 test
Evaluated by:
  • tst_qquickitemparticle
)
29113-52987
167 continue;
executed 29113 times by 1 test: continue;
Executed by:
  • tst_qquickitemparticle
29113
168 float t = ((timeStamp / 1000.0f) - data->t) / data->lifeSpan;-
169 if (m_stasis.contains(item)
m_stasis.contains(item)Description
TRUEnever evaluated
FALSEevaluated 52987 times by 1 test
Evaluated by:
  • tst_qquickitemparticle
) {
0-52987
170 data->t += dt;-
171 continue;
never executed: continue;
0
172 }-
173 if (t >= 1.0f
t >= 1.0fDescription
TRUEnever evaluated
FALSEevaluated 52987 times by 1 test
Evaluated by:
  • tst_qquickitemparticle
){
0-52987
174 m_deletables << item;-
175 data->delegate = nullptr;-
176 }
never executed: end of block
else{
0
177 data->delegate->setVisible(true);-
178 if (m_fade
m_fadeDescription
TRUEevaluated 52987 times by 1 test
Evaluated by:
  • tst_qquickitemparticle
FALSEnever evaluated
){
0-52987
179 float o = 1.f;-
180 if (t <0.2f
t <0.2fDescription
TRUEevaluated 13262 times by 1 test
Evaluated by:
  • tst_qquickitemparticle
FALSEevaluated 39725 times by 1 test
Evaluated by:
  • tst_qquickitemparticle
)
13262-39725
181 o = t * 5;
executed 13262 times by 1 test: o = t * 5;
Executed by:
  • tst_qquickitemparticle
13262
182 if (t > 0.8f
t > 0.8fDescription
TRUEevaluated 5907 times by 1 test
Evaluated by:
  • tst_qquickitemparticle
FALSEevaluated 47080 times by 1 test
Evaluated by:
  • tst_qquickitemparticle
)
5907-47080
183 o = (1-t)*5;
executed 5907 times by 1 test: o = (1-t)*5;
Executed by:
  • tst_qquickitemparticle
5907
184 item->setOpacity(o);-
185 }
executed 52987 times by 1 test: end of block
Executed by:
  • tst_qquickitemparticle
52987
186 }
executed 52987 times by 1 test: end of block
Executed by:
  • tst_qquickitemparticle
52987
187 item->setX(data->curX(m_system) - item->width() / 2 - m_systemOffset.x());-
188 item->setY(data->curY(m_system) - item->height() / 2 - m_systemOffset.y());-
189 }
executed 52987 times by 1 test: end of block
Executed by:
  • tst_qquickitemparticle
52987
190 }
executed 321 times by 1 test: end of block
Executed by:
  • tst_qquickitemparticle
321
191}
executed 321 times by 1 test: end of block
Executed by:
  • tst_qquickitemparticle
321
192-
193QQuickItemParticleAttached *QQuickItemParticle::qmlAttachedProperties(QObject *object)-
194{-
195 return
executed 2472 times by 1 test: return new QQuickItemParticleAttached(object);
Executed by:
  • tst_qquickitemparticle
new QQuickItemParticleAttached(object);
executed 2472 times by 1 test: return new QQuickItemParticleAttached(object);
Executed by:
  • tst_qquickitemparticle
2472
196}-
197-
198-
199-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.0