Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/particles/qquickparticlesystem_p.h |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||
2 | - | |||||||||||||
3 | - | |||||||||||||
4 | template<class T, int Prealloc> | - | ||||||||||||
5 | class QQuickParticleVarLengthArray: public QVarLengthArray<T, Prealloc> | - | ||||||||||||
6 | { | - | ||||||||||||
7 | public: | - | ||||||||||||
8 | void insert(const T &element) | - | ||||||||||||
9 | { | - | ||||||||||||
10 | if (!this->contains(element)
| 0 | ||||||||||||
11 | this->append(element); | - | ||||||||||||
12 | } never executed: end of block | 0 | ||||||||||||
13 | } never executed: end of block | 0 | ||||||||||||
14 | - | |||||||||||||
15 | bool removeOne(const T &element) | - | ||||||||||||
16 | { | - | ||||||||||||
17 | for (int i = 0; i < this->size()
| 1100-1182 | ||||||||||||
18 | if (this->at(i) == element
| 464-636 | ||||||||||||
19 | this->remove(i); | - | ||||||||||||
20 | return executed 464 times by 24 tests: true;return true; Executed by:
executed 464 times by 24 tests: return true; Executed by:
| 464 | ||||||||||||
21 | } | - | ||||||||||||
22 | } executed 636 times by 1 test: end of block Executed by:
| 636 | ||||||||||||
23 | - | |||||||||||||
24 | return executed 1182 times by 24 tests: false;return false; Executed by:
executed 1182 times by 24 tests: return false; Executed by:
| 1182 | ||||||||||||
25 | } | - | ||||||||||||
26 | }; | - | ||||||||||||
27 | - | |||||||||||||
28 | class QQuickParticleSystem; | - | ||||||||||||
29 | class QQuickParticleAffector; | - | ||||||||||||
30 | class QQuickParticleEmitter; | - | ||||||||||||
31 | class QQuickParticlePainter; | - | ||||||||||||
32 | class QQuickParticleData; | - | ||||||||||||
33 | class QQuickParticleSystemAnimation; | - | ||||||||||||
34 | class QQuickStochasticEngine; | - | ||||||||||||
35 | class QQuickSprite; | - | ||||||||||||
36 | class QQuickV4ParticleData; | - | ||||||||||||
37 | class QQuickParticleGroup; | - | ||||||||||||
38 | class QQuickImageParticle; | - | ||||||||||||
39 | - | |||||||||||||
40 | struct QQuickParticleDataHeapNode{ | - | ||||||||||||
41 | int time; | - | ||||||||||||
42 | QSet<QQuickParticleData*> data; | - | ||||||||||||
43 | }; | - | ||||||||||||
44 | - | |||||||||||||
45 | class __attribute__((visibility("default"))) QQuickParticleDataHeap { | - | ||||||||||||
46 | - | |||||||||||||
47 | - | |||||||||||||
48 | public: | - | ||||||||||||
49 | QQuickParticleDataHeap(); | - | ||||||||||||
50 | void insert(QQuickParticleData* data); | - | ||||||||||||
51 | void insertTimed(QQuickParticleData* data, int time); | - | ||||||||||||
52 | - | |||||||||||||
53 | int top(); | - | ||||||||||||
54 | - | |||||||||||||
55 | QSet<QQuickParticleData*> pop(); | - | ||||||||||||
56 | - | |||||||||||||
57 | void clear(); | - | ||||||||||||
58 | - | |||||||||||||
59 | bool contains(QQuickParticleData*); | - | ||||||||||||
60 | private: | - | ||||||||||||
61 | void grow(); | - | ||||||||||||
62 | void swap(int, int); | - | ||||||||||||
63 | void bubbleUp(int); | - | ||||||||||||
64 | void bubbleDown(int); | - | ||||||||||||
65 | int m_size; | - | ||||||||||||
66 | int m_end; | - | ||||||||||||
67 | QQuickParticleDataHeapNode m_tmp; | - | ||||||||||||
68 | QVector<QQuickParticleDataHeapNode> m_data; | - | ||||||||||||
69 | QHash<int,int> m_lookups; | - | ||||||||||||
70 | }; | - | ||||||||||||
71 | - | |||||||||||||
72 | class __attribute__((visibility("default"))) QQuickParticleGroupData { | - | ||||||||||||
73 | class FreeList | - | ||||||||||||
74 | { | - | ||||||||||||
75 | public: | - | ||||||||||||
76 | FreeList() {} | - | ||||||||||||
77 | - | |||||||||||||
78 | void resize(int newSize) | - | ||||||||||||
79 | { | - | ||||||||||||
80 | ((newSize >= 0) ? static_cast<void>(0) : qt_assert("newSize >= 0", __FILE__, 144)); | - | ||||||||||||
81 | int oldSize = isUnused.size(); | - | ||||||||||||
82 | isUnused.resize(newSize, true); | - | ||||||||||||
83 | if (newSize > oldSize
| 0-470 | ||||||||||||
84 | if (firstUnused ==
| 32-438 | ||||||||||||
85 | (0x7fffffff * 2U + 1U)
| 32-438 | ||||||||||||
86 | ) { | - | ||||||||||||
87 | firstUnused = oldSize; | - | ||||||||||||
88 | } executed 438 times by 24 tests: else {end of block Executed by:
| 438 | ||||||||||||
89 | firstUnused = std::min(firstUnused, unsigned(oldSize)); | - | ||||||||||||
90 | } executed 32 times by 2 tests: end of block Executed by:
| 32 | ||||||||||||
91 | } else if (firstUnused >= unsigned(newSize)
| 0 | ||||||||||||
92 | firstUnused = | - | ||||||||||||
93 | (0x7fffffff * 2U + 1U) | - | ||||||||||||
94 | ; | - | ||||||||||||
95 | } never executed: end of block | 0 | ||||||||||||
96 | } executed 470 times by 24 tests: end of block Executed by:
| 470 | ||||||||||||
97 | - | |||||||||||||
98 | void free(int index) | - | ||||||||||||
99 | { | - | ||||||||||||
100 | isUnused.setBit(index); | - | ||||||||||||
101 | firstUnused = std::min(firstUnused, unsigned(index)); | - | ||||||||||||
102 | --allocated; | - | ||||||||||||
103 | } executed 14020 times by 23 tests: end of block Executed by:
| 14020 | ||||||||||||
104 | - | |||||||||||||
105 | int count() const | - | ||||||||||||
106 | { return executed 3483 times by 23 tests: allocated;return allocated; Executed by:
executed 3483 times by 23 tests: }return allocated; Executed by:
| 3483 | ||||||||||||
107 | - | |||||||||||||
108 | bool hasUnusedEntries() const | - | ||||||||||||
109 | { return executed 108572 times by 23 tests: firstUnused != return firstUnused != (0x7fffffff * 2U + 1U) ; Executed by:
executed 108572 times by 23 tests: return firstUnused != (0x7fffffff * 2U + 1U) ; Executed by:
| 108572 | ||||||||||||
110 | (0x7fffffff * 2U + 1U) executed 108572 times by 23 tests: return firstUnused != (0x7fffffff * 2U + 1U) ; Executed by:
| 108572 | ||||||||||||
111 | ; executed 108572 times by 23 tests: }return firstUnused != (0x7fffffff * 2U + 1U) ; Executed by:
| 108572 | ||||||||||||
112 | - | |||||||||||||
113 | int alloc() | - | ||||||||||||
114 | { | - | ||||||||||||
115 | if (hasUnusedEntries()
| 0-54286 | ||||||||||||
116 | int nextFree = firstUnused; | - | ||||||||||||
117 | isUnused.clearBit(firstUnused); | - | ||||||||||||
118 | firstUnused = isUnused.findNext(firstUnused, true, false); | - | ||||||||||||
119 | if (firstUnused >= unsigned(isUnused.size())
| 226-54060 | ||||||||||||
120 | firstUnused = | - | ||||||||||||
121 | (0x7fffffff * 2U + 1U) | - | ||||||||||||
122 | ; | - | ||||||||||||
123 | } executed 226 times by 3 tests: end of block Executed by:
| 226 | ||||||||||||
124 | ++allocated; | - | ||||||||||||
125 | return executed 54286 times by 23 tests: nextFree;return nextFree; Executed by:
executed 54286 times by 23 tests: return nextFree; Executed by:
| 54286 | ||||||||||||
126 | } else { | - | ||||||||||||
127 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||
128 | } | - | ||||||||||||
129 | } | - | ||||||||||||
130 | - | |||||||||||||
131 | private: | - | ||||||||||||
132 | QV4::BitVector isUnused; | - | ||||||||||||
133 | unsigned firstUnused = | - | ||||||||||||
134 | (0x7fffffff * 2U + 1U) | - | ||||||||||||
135 | ; | - | ||||||||||||
136 | int allocated = 0; | - | ||||||||||||
137 | }; | - | ||||||||||||
138 | - | |||||||||||||
139 | public: | - | ||||||||||||
140 | typedef int ID; | - | ||||||||||||
141 | enum { InvalidID = -1, DefaultGroupID = 0 }; | - | ||||||||||||
142 | - | |||||||||||||
143 | public: | - | ||||||||||||
144 | QQuickParticleGroupData(const QString &name, QQuickParticleSystem* sys); | - | ||||||||||||
145 | ~QQuickParticleGroupData(); | - | ||||||||||||
146 | - | |||||||||||||
147 | int size() | - | ||||||||||||
148 | { return executed 1618 times by 24 tests: m_size;return m_size; Executed by:
executed 1618 times by 24 tests: }return m_size; Executed by:
| 1618 | ||||||||||||
149 | - | |||||||||||||
150 | QString name(); | - | ||||||||||||
151 | - | |||||||||||||
152 | void setSize(int newSize); | - | ||||||||||||
153 | - | |||||||||||||
154 | const ID index; | - | ||||||||||||
155 | QQuickParticleVarLengthArray<QQuickParticlePainter*, 4> painters; | - | ||||||||||||
156 | - | |||||||||||||
157 | - | |||||||||||||
158 | QVector<QQuickParticleData*> data; | - | ||||||||||||
159 | FreeList freeList; | - | ||||||||||||
160 | QQuickParticleDataHeap dataHeap; | - | ||||||||||||
161 | bool recycle(); | - | ||||||||||||
162 | - | |||||||||||||
163 | void initList(); | - | ||||||||||||
164 | void kill(QQuickParticleData* d); | - | ||||||||||||
165 | - | |||||||||||||
166 | - | |||||||||||||
167 | QQuickParticleData* newDatum(bool respectsLimits); | - | ||||||||||||
168 | - | |||||||||||||
169 | - | |||||||||||||
170 | void prepareRecycler(QQuickParticleData* d); | - | ||||||||||||
171 | - | |||||||||||||
172 | private: | - | ||||||||||||
173 | int m_size; | - | ||||||||||||
174 | QQuickParticleSystem* m_system; | - | ||||||||||||
175 | }; | - | ||||||||||||
176 | - | |||||||||||||
177 | struct Color4ub { | - | ||||||||||||
178 | uchar r; | - | ||||||||||||
179 | uchar g; | - | ||||||||||||
180 | uchar b; | - | ||||||||||||
181 | uchar a; | - | ||||||||||||
182 | }; | - | ||||||||||||
183 | - | |||||||||||||
184 | class __attribute__((visibility("default"))) QQuickParticleData { | - | ||||||||||||
185 | public: | - | ||||||||||||
186 | - | |||||||||||||
187 | QQuickParticleData(); | - | ||||||||||||
188 | ~QQuickParticleData(); | - | ||||||||||||
189 | - | |||||||||||||
190 | QQuickParticleData(const QQuickParticleData &other); | - | ||||||||||||
191 | QQuickParticleData &operator=(const QQuickParticleData &other); | - | ||||||||||||
192 | - | |||||||||||||
193 | - | |||||||||||||
194 | - | |||||||||||||
195 | - | |||||||||||||
196 | - | |||||||||||||
197 | void setInstantaneousAX(float ax, QQuickParticleSystem *particleSystem); | - | ||||||||||||
198 | - | |||||||||||||
199 | void setInstantaneousVX(float vx, QQuickParticleSystem *particleSystem); | - | ||||||||||||
200 | - | |||||||||||||
201 | void setInstantaneousX(float x, QQuickParticleSystem *particleSystem); | - | ||||||||||||
202 | - | |||||||||||||
203 | void setInstantaneousAY(float ay, QQuickParticleSystem *particleSystem); | - | ||||||||||||
204 | - | |||||||||||||
205 | void setInstantaneousVY(float vy, QQuickParticleSystem *particleSystem); | - | ||||||||||||
206 | - | |||||||||||||
207 | void setInstantaneousY(float y, QQuickParticleSystem *particleSystem); | - | ||||||||||||
208 | - | |||||||||||||
209 | - | |||||||||||||
210 | float curX(QQuickParticleSystem *particleSystem) const; | - | ||||||||||||
211 | float curVX(QQuickParticleSystem *particleSystem) const; | - | ||||||||||||
212 | float curAX() const { return executed 27584 times by 2 tests: ax;return ax; Executed by:
executed 27584 times by 2 tests: }return ax; Executed by:
| 27584 | ||||||||||||
213 | float curAX(QQuickParticleSystem *) const { return never executed: ax;return ax; never executed: }return ax; | 0 | ||||||||||||
214 | float curY(QQuickParticleSystem *particleSystem) const; | - | ||||||||||||
215 | float curVY(QQuickParticleSystem *particleSystem) const; | - | ||||||||||||
216 | float curAY() const { return executed 27584 times by 2 tests: ay;return ay; Executed by:
executed 27584 times by 2 tests: }return ay; Executed by:
| 27584 | ||||||||||||
217 | float curAY(QQuickParticleSystem *) const { return never executed: ay;return ay; never executed: }return ay; | 0 | ||||||||||||
218 | - | |||||||||||||
219 | int index; | - | ||||||||||||
220 | int systemIndex; | - | ||||||||||||
221 | - | |||||||||||||
222 | - | |||||||||||||
223 | float x; | - | ||||||||||||
224 | float y; | - | ||||||||||||
225 | float t; | - | ||||||||||||
226 | float lifeSpan; | - | ||||||||||||
227 | float size; | - | ||||||||||||
228 | float endSize; | - | ||||||||||||
229 | float vx; | - | ||||||||||||
230 | float vy; | - | ||||||||||||
231 | float ax; | - | ||||||||||||
232 | float ay; | - | ||||||||||||
233 | - | |||||||||||||
234 | - | |||||||||||||
235 | - | |||||||||||||
236 | Color4ub color; | - | ||||||||||||
237 | - | |||||||||||||
238 | float xx; | - | ||||||||||||
239 | float xy; | - | ||||||||||||
240 | float yx; | - | ||||||||||||
241 | float yy; | - | ||||||||||||
242 | float rotation; | - | ||||||||||||
243 | float rotationVelocity; | - | ||||||||||||
244 | float autoRotate; | - | ||||||||||||
245 | - | |||||||||||||
246 | float animIdx; | - | ||||||||||||
247 | float frameDuration; | - | ||||||||||||
248 | float frameAt; | - | ||||||||||||
249 | float frameCount; | - | ||||||||||||
250 | float animT; | - | ||||||||||||
251 | float animX; | - | ||||||||||||
252 | float animY; | - | ||||||||||||
253 | float animWidth; | - | ||||||||||||
254 | float animHeight; | - | ||||||||||||
255 | - | |||||||||||||
256 | QQuickParticleGroupData::ID groupId; | - | ||||||||||||
257 | - | |||||||||||||
258 | - | |||||||||||||
259 | QQuickImageParticle* colorOwner; | - | ||||||||||||
260 | QQuickImageParticle* rotationOwner; | - | ||||||||||||
261 | QQuickImageParticle* deformationOwner; | - | ||||||||||||
262 | QQuickImageParticle* animationOwner; | - | ||||||||||||
263 | - | |||||||||||||
264 | - | |||||||||||||
265 | QQuickItem* delegate; | - | ||||||||||||
266 | int modelIndex; | - | ||||||||||||
267 | - | |||||||||||||
268 | float update; | - | ||||||||||||
269 | - | |||||||||||||
270 | float r; | - | ||||||||||||
271 | - | |||||||||||||
272 | - | |||||||||||||
273 | - | |||||||||||||
274 | - | |||||||||||||
275 | void debugDump(QQuickParticleSystem *particleSystem) const; | - | ||||||||||||
276 | bool stillAlive(QQuickParticleSystem *particleSystem) const; | - | ||||||||||||
277 | bool alive(QQuickParticleSystem *particleSystem) const; | - | ||||||||||||
278 | float lifeLeft(QQuickParticleSystem *particleSystem) const; | - | ||||||||||||
279 | - | |||||||||||||
280 | float curSize(QQuickParticleSystem *particleSystem) const; | - | ||||||||||||
281 | void clone(const QQuickParticleData& other); | - | ||||||||||||
282 | QQmlV4Handle v4Value(QQuickParticleSystem *particleSystem); | - | ||||||||||||
283 | void extendLife(float time, QQuickParticleSystem *particleSystem); | - | ||||||||||||
284 | - | |||||||||||||
285 | static inline constexpr float EPSILON() noexcept { return 0.001f; } | - | ||||||||||||
286 | - | |||||||||||||
287 | private: | - | ||||||||||||
288 | QQuickV4ParticleData* v8Datum; | - | ||||||||||||
289 | }; | - | ||||||||||||
290 | - | |||||||||||||
291 | class __attribute__((visibility("default"))) QQuickParticleSystem : public QQuickItem | - | ||||||||||||
292 | { | - | ||||||||||||
293 | public: | - | ||||||||||||
294 | #pragma GCC diagnostic push | - | ||||||||||||
295 | - | |||||||||||||
296 | #pragma GCC diagnostic ignored "-Wsuggest-override" | - | ||||||||||||
297 | static const QMetaObject staticMetaObject; virtual const QMetaObject *metaObject() const; virtual void *qt_metacast(const char *); virtual int qt_metacall(QMetaObject::Call, int, void **); static inline QString tr(const char *s, const char *c = nullptr, int n = -1) { return staticMetaObject.tr(s, c, n); } __attribute__ ((__deprecated__)) static inline QString trUtf8(const char *s, const char *c = nullptr, int n = -1) { return staticMetaObject.tr(s, c, n); } private: | - | ||||||||||||
298 | #pragma GCC diagnostic ignored "-Wattributes" | - | ||||||||||||
299 | __attribute__((visibility("hidden"))) static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **); | - | ||||||||||||
300 | #pragma GCC diagnostic pop | - | ||||||||||||
301 | struct QPrivateSignal {}; | - | ||||||||||||
302 | - | |||||||||||||
303 | - | |||||||||||||
304 | - | |||||||||||||
305 | - | |||||||||||||
306 | public: | - | ||||||||||||
307 | explicit QQuickParticleSystem(QQuickItem *parent = nullptr); | - | ||||||||||||
308 | ~QQuickParticleSystem(); | - | ||||||||||||
309 | - | |||||||||||||
310 | bool isRunning() const | - | ||||||||||||
311 | { | - | ||||||||||||
312 | return executed 4598 times by 23 tests: m_running;return m_running; Executed by:
executed 4598 times by 23 tests: return m_running; Executed by:
| 4598 | ||||||||||||
313 | } | - | ||||||||||||
314 | - | |||||||||||||
315 | int count(){ return never executed: particleCount;return particleCount; never executed: }return particleCount; | 0 | ||||||||||||
316 | - | |||||||||||||
317 | static const int maxLife = 600000; | - | ||||||||||||
318 | - | |||||||||||||
319 | public : | - | ||||||||||||
320 | - | |||||||||||||
321 | void systemInitialized(); | - | ||||||||||||
322 | void runningChanged(bool arg); | - | ||||||||||||
323 | void pausedChanged(bool arg); | - | ||||||||||||
324 | void emptyChanged(bool arg); | - | ||||||||||||
325 | - | |||||||||||||
326 | public : | - | ||||||||||||
327 | void start(){setRunning(true);} never executed: end of block | 0 | ||||||||||||
328 | void stop(){setRunning(false);} never executed: end of block | 0 | ||||||||||||
329 | void restart(){setRunning(false);setRunning(true);} never executed: end of block | 0 | ||||||||||||
330 | void pause(){setPaused(true);} never executed: end of block | 0 | ||||||||||||
331 | void resume(){setPaused(false);} never executed: end of block | 0 | ||||||||||||
332 | - | |||||||||||||
333 | void reset(); | - | ||||||||||||
334 | void setRunning(bool arg); | - | ||||||||||||
335 | void setPaused(bool arg); | - | ||||||||||||
336 | - | |||||||||||||
337 | virtual int duration() const { return never executed: -1;return -1; never executed: }return -1; | 0 | ||||||||||||
338 | - | |||||||||||||
339 | - | |||||||||||||
340 | protected: | - | ||||||||||||
341 | - | |||||||||||||
342 | void componentComplete() override; | - | ||||||||||||
343 | - | |||||||||||||
344 | private : | - | ||||||||||||
345 | void emittersChanged(); | - | ||||||||||||
346 | void loadPainter(QQuickParticlePainter *p); | - | ||||||||||||
347 | void createEngine(); | - | ||||||||||||
348 | void particleStateChange(int idx); | - | ||||||||||||
349 | - | |||||||||||||
350 | public: | - | ||||||||||||
351 | - | |||||||||||||
352 | void emitParticle(QQuickParticleData* p, QQuickParticleEmitter *particleEmitter); | - | ||||||||||||
353 | QQuickParticleData* newDatum(int groupId, bool respectLimits = true, int sysIdx = -1); | - | ||||||||||||
354 | void finishNewDatum(QQuickParticleData*); | - | ||||||||||||
355 | void moveGroups(QQuickParticleData *d, int newGIdx); | - | ||||||||||||
356 | int nextSystemIndex(); | - | ||||||||||||
357 | - | |||||||||||||
358 | - | |||||||||||||
359 | int systemSync(QQuickParticlePainter* p); | - | ||||||||||||
360 | - | |||||||||||||
361 | - | |||||||||||||
362 | QSet<QQuickParticleData*> needsReset; | - | ||||||||||||
363 | QVector<QQuickParticleData*> bySysIdx; | - | ||||||||||||
364 | QQuickStochasticEngine* stateEngine; | - | ||||||||||||
365 | - | |||||||||||||
366 | QHash<QString, int> groupIds; | - | ||||||||||||
367 | QVarLengthArray<QQuickParticleGroupData*, 32> groupData; | - | ||||||||||||
368 | int nextFreeGroupId; | - | ||||||||||||
369 | int registerParticleGroupData(const QString &name, QQuickParticleGroupData *pgd); | - | ||||||||||||
370 | - | |||||||||||||
371 | - | |||||||||||||
372 | void updateCurrentTime( int currentTime ); | - | ||||||||||||
373 | QQuickParticleSystemAnimation* m_animation; | - | ||||||||||||
374 | bool m_running; | - | ||||||||||||
375 | bool m_debugMode; | - | ||||||||||||
376 | - | |||||||||||||
377 | int timeInt; | - | ||||||||||||
378 | bool initialized; | - | ||||||||||||
379 | int particleCount; | - | ||||||||||||
380 | - | |||||||||||||
381 | void registerParticlePainter(QQuickParticlePainter* p); | - | ||||||||||||
382 | void registerParticleEmitter(QQuickParticleEmitter* e); | - | ||||||||||||
383 | void finishRegisteringParticleEmitter(QQuickParticleEmitter *e); | - | ||||||||||||
384 | void registerParticleAffector(QQuickParticleAffector* a); | - | ||||||||||||
385 | void registerParticleGroup(QQuickParticleGroup* g); | - | ||||||||||||
386 | - | |||||||||||||
387 | static void statePropertyRedirect(QQmlListProperty<QObject> *prop, QObject *value); | - | ||||||||||||
388 | static void stateRedirect(QQuickParticleGroup* group, QQuickParticleSystem* sys, QObject *value); | - | ||||||||||||
389 | bool isPaused() const | - | ||||||||||||
390 | { | - | ||||||||||||
391 | return executed 4586 times by 23 tests: m_paused;return m_paused; Executed by:
executed 4586 times by 23 tests: return m_paused; Executed by:
| 4586 | ||||||||||||
392 | } | - | ||||||||||||
393 | - | |||||||||||||
394 | bool isEmpty() const | - | ||||||||||||
395 | { | - | ||||||||||||
396 | return never executed: m_empty;return m_empty; never executed: return m_empty; | 0 | ||||||||||||
397 | } | - | ||||||||||||
398 | - | |||||||||||||
399 | private: | - | ||||||||||||
400 | void searchNextFreeGroupId(); | - | ||||||||||||
401 | - | |||||||||||||
402 | private: | - | ||||||||||||
403 | void initializeSystem(); | - | ||||||||||||
404 | void initGroups(); | - | ||||||||||||
405 | QList<QPointer<QQuickParticleEmitter> > m_emitters; | - | ||||||||||||
406 | QList<QPointer<QQuickParticleAffector> > m_affectors; | - | ||||||||||||
407 | QList<QPointer<QQuickParticlePainter> > m_painters; | - | ||||||||||||
408 | QList<QPointer<QQuickParticlePainter> > m_syncList; | - | ||||||||||||
409 | QList<QQuickParticleGroup*> m_groups; | - | ||||||||||||
410 | int m_nextIndex; | - | ||||||||||||
411 | QSet<int> m_reusableIndexes; | - | ||||||||||||
412 | bool m_componentComplete; | - | ||||||||||||
413 | - | |||||||||||||
414 | bool m_paused; | - | ||||||||||||
415 | bool m_allDead; | - | ||||||||||||
416 | bool m_empty; | - | ||||||||||||
417 | }; | - | ||||||||||||
418 | - | |||||||||||||
419 | - | |||||||||||||
420 | class QQuickParticleSystemAnimation : public QAbstractAnimation | - | ||||||||||||
421 | { | - | ||||||||||||
422 | public: | - | ||||||||||||
423 | #pragma GCC diagnostic push | - | ||||||||||||
424 | - | |||||||||||||
425 | #pragma GCC diagnostic ignored "-Wsuggest-override" | - | ||||||||||||
426 | static const QMetaObject staticMetaObject; virtual const QMetaObject *metaObject() const; virtual void *qt_metacast(const char *); virtual int qt_metacall(QMetaObject::Call, int, void **); static inline QString tr(const char *s, const char *c = nullptr, int n = -1) { return staticMetaObject.tr(s, c, n); } __attribute__ ((__deprecated__)) static inline QString trUtf8(const char *s, const char *c = nullptr, int n = -1) { return staticMetaObject.tr(s, c, n); } private: | - | ||||||||||||
427 | #pragma GCC diagnostic ignored "-Wattributes" | - | ||||||||||||
428 | __attribute__((visibility("hidden"))) static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **); | - | ||||||||||||
429 | #pragma GCC diagnostic pop | - | ||||||||||||
430 | struct QPrivateSignal {}; | - | ||||||||||||
431 | public: | - | ||||||||||||
432 | QQuickParticleSystemAnimation(QQuickParticleSystem* system) | - | ||||||||||||
433 | : QAbstractAnimation(static_cast<QObject*>(system)), m_system(system) | - | ||||||||||||
434 | { } executed 166 times by 24 tests: end of block Executed by:
| 166 | ||||||||||||
435 | protected: | - | ||||||||||||
436 | void updateCurrentTime(int t) override | - | ||||||||||||
437 | { | - | ||||||||||||
438 | m_system->updateCurrentTime(t); | - | ||||||||||||
439 | } executed 3084 times by 24 tests: end of block Executed by:
| 3084 | ||||||||||||
440 | - | |||||||||||||
441 | int duration() const override | - | ||||||||||||
442 | { | - | ||||||||||||
443 | return executed 3084 times by 24 tests: -1;return -1; Executed by:
executed 3084 times by 24 tests: return -1; Executed by:
| 3084 | ||||||||||||
444 | } | - | ||||||||||||
445 | - | |||||||||||||
446 | private: | - | ||||||||||||
447 | QQuickParticleSystem* m_system; | - | ||||||||||||
448 | }; | - | ||||||||||||
449 | - | |||||||||||||
450 | inline void QQuickParticleData::setInstantaneousAX(float ax, QQuickParticleSystem* particleSystem) | - | ||||||||||||
451 | { | - | ||||||||||||
452 | float t = (particleSystem->timeInt / 1000.0f) - this->t; | - | ||||||||||||
453 | float t_sq = t * t; | - | ||||||||||||
454 | float vx = (this->vx + t * this->ax) - t * ax; | - | ||||||||||||
455 | float ex = this->x + this->vx * t + 0.5f * this->ax * t_sq; | - | ||||||||||||
456 | float x = ex - t * vx - 0.5f * t_sq * ax; | - | ||||||||||||
457 | - | |||||||||||||
458 | this->ax = ax; | - | ||||||||||||
459 | this->vx = vx; | - | ||||||||||||
460 | this->x = x; | - | ||||||||||||
461 | } executed 2512 times by 2 tests: end of block Executed by:
| 2512 | ||||||||||||
462 | - | |||||||||||||
463 | inline void QQuickParticleData::setInstantaneousVX(float vx, QQuickParticleSystem* particleSystem) | - | ||||||||||||
464 | { | - | ||||||||||||
465 | float t = (particleSystem->timeInt / 1000.0f) - this->t; | - | ||||||||||||
466 | float t_sq = t * t; | - | ||||||||||||
467 | float evx = vx - t * this->ax; | - | ||||||||||||
468 | float ex = this->x + this->vx * t + 0.5f * this->ax * t_sq; | - | ||||||||||||
469 | float x = ex - t * evx - 0.5f * t_sq * this->ax; | - | ||||||||||||
470 | - | |||||||||||||
471 | this->vx = evx; | - | ||||||||||||
472 | this->x = x; | - | ||||||||||||
473 | } executed 116336 times by 6 tests: end of block Executed by:
| 116336 | ||||||||||||
474 | - | |||||||||||||
475 | inline void QQuickParticleData::setInstantaneousX(float x, QQuickParticleSystem* particleSystem) | - | ||||||||||||
476 | { | - | ||||||||||||
477 | float t = (particleSystem->timeInt / 1000.0f) - this->t; | - | ||||||||||||
478 | float t_sq = t * t; | - | ||||||||||||
479 | this->x = x - t * this->vx - 0.5f * t_sq * this->ax; | - | ||||||||||||
480 | } executed 25590 times by 2 tests: end of block Executed by:
| 25590 | ||||||||||||
481 | - | |||||||||||||
482 | inline void QQuickParticleData::setInstantaneousAY(float ay, QQuickParticleSystem* particleSystem) | - | ||||||||||||
483 | { | - | ||||||||||||
484 | float t = (particleSystem->timeInt / 1000.0f) - this->t; | - | ||||||||||||
485 | float t_sq = t * t; | - | ||||||||||||
486 | float vy = (this->vy + t * this->ay) - t * ay; | - | ||||||||||||
487 | float ey = this->y + this->vy * t + 0.5f * this->ay * t_sq; | - | ||||||||||||
488 | float y = ey - t * vy - 0.5f * t_sq * ay; | - | ||||||||||||
489 | - | |||||||||||||
490 | this->ay = ay; | - | ||||||||||||
491 | this->vy = vy; | - | ||||||||||||
492 | this->y = y; | - | ||||||||||||
493 | } executed 2512 times by 2 tests: end of block Executed by:
| 2512 | ||||||||||||
494 | - | |||||||||||||
495 | inline void QQuickParticleData::setInstantaneousVY(float vy, QQuickParticleSystem* particleSystem) | - | ||||||||||||
496 | { | - | ||||||||||||
497 | float t = (particleSystem->timeInt / 1000.0f) - this->t; | - | ||||||||||||
498 | float t_sq = t * t; | - | ||||||||||||
499 | float evy = vy - t * this->ay; | - | ||||||||||||
500 | float ey = this->y + this->vy * t + 0.5f * this->ay * t_sq; | - | ||||||||||||
501 | float y = ey - t*evy - 0.5f * t_sq * this->ay; | - | ||||||||||||
502 | - | |||||||||||||
503 | this->vy = evy; | - | ||||||||||||
504 | this->y = y; | - | ||||||||||||
505 | } executed 116336 times by 6 tests: end of block Executed by:
| 116336 | ||||||||||||
506 | - | |||||||||||||
507 | inline void QQuickParticleData::setInstantaneousY(float y, QQuickParticleSystem *particleSystem) | - | ||||||||||||
508 | { | - | ||||||||||||
509 | float t = (particleSystem->timeInt / 1000.0f) - this->t; | - | ||||||||||||
510 | float t_sq = t * t; | - | ||||||||||||
511 | this->y = y - t * this->vy - 0.5f * t_sq * this->ay; | - | ||||||||||||
512 | } executed 25590 times by 2 tests: end of block Executed by:
| 25590 | ||||||||||||
513 | - | |||||||||||||
514 | inline float QQuickParticleData::curX(QQuickParticleSystem *particleSystem) const | - | ||||||||||||
515 | { | - | ||||||||||||
516 | float t = (particleSystem->timeInt / 1000.0f) - this->t; | - | ||||||||||||
517 | float t_sq = t * t; | - | ||||||||||||
518 | return executed 181633 times by 5 tests: this->x + this->vx * t + 0.5f * this->ax * t_sq;return this->x + this->vx * t + 0.5f * this->ax * t_sq; Executed by:
executed 181633 times by 5 tests: return this->x + this->vx * t + 0.5f * this->ax * t_sq; Executed by:
| 181633 | ||||||||||||
519 | } | - | ||||||||||||
520 | - | |||||||||||||
521 | inline float QQuickParticleData::curVX(QQuickParticleSystem *particleSystem) const | - | ||||||||||||
522 | { | - | ||||||||||||
523 | float t = (particleSystem->timeInt / 1000.0f) - this->t; | - | ||||||||||||
524 | return executed 186366 times by 6 tests: this->vx + t * this->ax;return this->vx + t * this->ax; Executed by:
executed 186366 times by 6 tests: return this->vx + t * this->ax; Executed by:
| 186366 | ||||||||||||
525 | } | - | ||||||||||||
526 | - | |||||||||||||
527 | inline float QQuickParticleData::curY(QQuickParticleSystem *particleSystem) const | - | ||||||||||||
528 | { | - | ||||||||||||
529 | float t = (particleSystem->timeInt / 1000.0f) - this->t; | - | ||||||||||||
530 | float t_sq = t * t; | - | ||||||||||||
531 | return executed 181633 times by 5 tests: y + vy * t + 0.5f * ay * t_sq;return y + vy * t + 0.5f * ay * t_sq; Executed by:
executed 181633 times by 5 tests: return y + vy * t + 0.5f * ay * t_sq; Executed by:
| 181633 | ||||||||||||
532 | } | - | ||||||||||||
533 | - | |||||||||||||
534 | inline float QQuickParticleData::curVY(QQuickParticleSystem *particleSystem) const | - | ||||||||||||
535 | { | - | ||||||||||||
536 | float t = (particleSystem->timeInt / 1000.0f) - this->t; | - | ||||||||||||
537 | return executed 186366 times by 6 tests: vy + t*ay;return vy + t*ay; Executed by:
executed 186366 times by 6 tests: return vy + t*ay; Executed by:
| 186366 | ||||||||||||
538 | } | - | ||||||||||||
539 | - | |||||||||||||
540 | inline bool QQuickParticleData::stillAlive(QQuickParticleSystem* system) const | - | ||||||||||||
541 | { | - | ||||||||||||
542 | if (!system
| 0-764177 | ||||||||||||
543 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||
544 | return executed 764177 times by 23 tests: (t + lifeSpan - EPSILON()) > (system->timeInt / 1000.0f);return (t + lifeSpan - EPSILON()) > (system->timeInt / 1000.0f); Executed by:
executed 764177 times by 23 tests: return (t + lifeSpan - EPSILON()) > (system->timeInt / 1000.0f); Executed by:
| 764177 | ||||||||||||
545 | } | - | ||||||||||||
546 | - | |||||||||||||
547 | inline bool QQuickParticleData::alive(QQuickParticleSystem* system) const | - | ||||||||||||
548 | { | - | ||||||||||||
549 | if (!system
| 0 | ||||||||||||
550 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||
551 | float st = (system->timeInt / 1000.0f); | - | ||||||||||||
552 | return never executed: (t + EPSILON()) < st && (t + lifeSpan - EPSILON()) > st;return (t + EPSILON()) < st && (t + lifeSpan - EPSILON()) > st; never executed: return (t + EPSILON()) < st && (t + lifeSpan - EPSILON()) > st; | 0 | ||||||||||||
553 | } | - | ||||||||||||
554 | - | |||||||||||||
555 | inline float QQuickParticleData::lifeLeft(QQuickParticleSystem *particleSystem) const | - | ||||||||||||
556 | { | - | ||||||||||||
557 | if (!particleSystem
| 0 | ||||||||||||
558 | return never executed: 0.0f;return 0.0f; never executed: return 0.0f; | 0 | ||||||||||||
559 | return never executed: (t + lifeSpan) - (particleSystem->timeInt / 1000.0f);return (t + lifeSpan) - (particleSystem->timeInt / 1000.0f); never executed: return (t + lifeSpan) - (particleSystem->timeInt / 1000.0f); | 0 | ||||||||||||
560 | } | - | ||||||||||||
561 | - | |||||||||||||
562 | inline float QQuickParticleData::curSize(QQuickParticleSystem *particleSystem) const | - | ||||||||||||
563 | { | - | ||||||||||||
564 | if (!particleSystem
| 0 | ||||||||||||
565 | return never executed: 0.0f;return 0.0f; never executed: return 0.0f; | 0 | ||||||||||||
566 | return never executed: size + (endSize - size) * (1 - (lifeLeft(particleSystem) / lifeSpan));return size + (endSize - size) * (1 - (lifeLeft(particleSystem) / lifeSpan)); never executed: return size + (endSize - size) * (1 - (lifeLeft(particleSystem) / lifeSpan)); | 0 | ||||||||||||
567 | } | - | ||||||||||||
568 | - | |||||||||||||
569 | - | |||||||||||||
Switch to Source code | Preprocessed file |