Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/particles/qquicktargetdirection.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||
---|---|---|---|---|---|---|---|---|
1 | - | |||||||
2 | - | |||||||
3 | QQuickTargetDirection::QQuickTargetDirection(QObject *parent) : | - | ||||||
4 | QQuickDirection(parent) | - | ||||||
5 | , m_targetX(0) | - | ||||||
6 | , m_targetY(0) | - | ||||||
7 | , m_targetVariation(0) | - | ||||||
8 | , m_proportionalMagnitude(false) | - | ||||||
9 | , m_magnitude(0) | - | ||||||
10 | , m_magnitudeVariation(0) | - | ||||||
11 | , m_targetItem(nullptr) | - | ||||||
12 | { | - | ||||||
13 | } executed 16 times by 2 tests: end of block Executed by:
| 16 | ||||||
14 | - | |||||||
15 | QPointF QQuickTargetDirection::sample(const QPointF &from) | - | ||||||
16 | { | - | ||||||
17 | - | |||||||
18 | QPointF ret; | - | ||||||
19 | qreal targetX; | - | ||||||
20 | qreal targetY; | - | ||||||
21 | if (m_targetItem
| 0-1216 | ||||||
22 | QQuickParticleEmitter* parentEmitter = qobject_cast<QQuickParticleEmitter*>(parent()); | - | ||||||
23 | targetX = m_targetItem->width()/2; | - | ||||||
24 | targetY = m_targetItem->height()/2; | - | ||||||
25 | if (!parentEmitter
| 0-1216 | ||||||
26 | QMessageLogger(__FILE__, 109, __PRETTY_FUNCTION__).warning() << "Directed vector is not a child of the emitter. Mapping of target item coordinates may fail."; | - | ||||||
27 | targetX += m_targetItem->x(); | - | ||||||
28 | targetY += m_targetItem->y(); | - | ||||||
29 | } never executed: else{end of block | 0 | ||||||
30 | ret = parentEmitter->mapFromItem(m_targetItem, QPointF(targetX, targetY)); | - | ||||||
31 | targetX = ret.x(); | - | ||||||
32 | targetY = ret.y(); | - | ||||||
33 | } executed 1216 times by 1 test: end of block Executed by:
| 1216 | ||||||
34 | }else{ | - | ||||||
35 | targetX = m_targetX; | - | ||||||
36 | targetY = m_targetY; | - | ||||||
37 | } never executed: end of block | 0 | ||||||
38 | targetX += 0 - from.x() - m_targetVariation + QRandomGenerator::global()->generateDouble() * m_targetVariation*2; | - | ||||||
39 | targetY += 0 - from.y() - m_targetVariation + QRandomGenerator::global()->generateDouble() * m_targetVariation*2; | - | ||||||
40 | qreal theta = std::atan2(targetY, targetX); | - | ||||||
41 | qreal mag = m_magnitude + QRandomGenerator::global()->generateDouble() * m_magnitudeVariation * 2 - m_magnitudeVariation; | - | ||||||
42 | if (m_proportionalMagnitude
| 0-1216 | ||||||
43 | mag *= std::sqrt(targetX * targetX + targetY * targetY); executed 1216 times by 1 test: mag *= std::sqrt(targetX * targetX + targetY * targetY); Executed by:
| 1216 | ||||||
44 | ret.setX(mag * std::cos(theta)); | - | ||||||
45 | ret.setY(mag * std::sin(theta)); | - | ||||||
46 | return executed 1216 times by 1 test: ret;return ret; Executed by:
executed 1216 times by 1 test: return ret; Executed by:
| 1216 | ||||||
47 | } | - | ||||||
48 | - | |||||||
49 | - | |||||||
50 | - | |||||||
Switch to Source code | Preprocessed file |