| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/items/qquickspriteengine_p.h |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||
|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||
| 2 | static_assert(bool(1 == 1), "Required feature " "quick_sprite" " for file " __FILE__ " not available."); | - | ||||||
| 3 | - | |||||||
| 4 | - | |||||||
| 5 | - | |||||||
| 6 | - | |||||||
| 7 | class QQuickSprite; | - | ||||||
| 8 | class __attribute__((visibility("default"))) QQuickStochasticState : public QObject | - | ||||||
| 9 | { | - | ||||||
| 10 | public: | - | ||||||
| 11 | #pragma GCC diagnostic push | - | ||||||
| 12 | - | |||||||
| 13 | #pragma GCC diagnostic ignored "-Wsuggest-override" | - | ||||||
| 14 | 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: | - | ||||||
| 15 | #pragma GCC diagnostic ignored "-Wattributes" | - | ||||||
| 16 | __attribute__((visibility("hidden"))) static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **); | - | ||||||
| 17 | #pragma GCC diagnostic pop | - | ||||||
| 18 | struct QPrivateSignal {}; | - | ||||||
| 19 | - | |||||||
| 20 | - | |||||||
| 21 | - | |||||||
| 22 | - | |||||||
| 23 | - | |||||||
| 24 | - | |||||||
| 25 | - | |||||||
| 26 | public: | - | ||||||
| 27 | QQuickStochasticState(QObject* parent = nullptr) | - | ||||||
| 28 | : QObject(parent) | - | ||||||
| 29 | { | - | ||||||
| 30 | } executed 118 times by 6 tests: end of blockExecuted by:
| 118 | ||||||
| 31 | - | |||||||
| 32 | int duration() const | - | ||||||
| 33 | { | - | ||||||
| 34 | return executed 8 times by 2 tests: m_duration;return m_duration;Executed by:
executed 8 times by 2 tests: return m_duration;Executed by:
| 8 | ||||||
| 35 | } | - | ||||||
| 36 | - | |||||||
| 37 | QString name() const | - | ||||||
| 38 | { | - | ||||||
| 39 | return executed 1522 times by 4 tests: m_name;return m_name;Executed by:
executed 1522 times by 4 tests: return m_name;Executed by:
| 1522 | ||||||
| 40 | } | - | ||||||
| 41 | - | |||||||
| 42 | QVariantMap to() const | - | ||||||
| 43 | { | - | ||||||
| 44 | return never executed: m_to;return m_to;never executed: return m_to; | 0 | ||||||
| 45 | } | - | ||||||
| 46 | - | |||||||
| 47 | int durationVariation() const | - | ||||||
| 48 | { | - | ||||||
| 49 | return never executed: m_durationVariation;return m_durationVariation;never executed: return m_durationVariation; | 0 | ||||||
| 50 | } | - | ||||||
| 51 | - | |||||||
| 52 | - | |||||||
| 53 | virtual int variedDuration() const | - | ||||||
| 54 | { | - | ||||||
| 55 | return executed 21120 times by 1 test: qMax(qreal(0.0) , m_durationreturn qMax(qreal(0.0) , m_duration + (m_durationVariation * QRandomGenerator::global()->bounded(2.0)) - m_durationVariation);Executed by:
executed 21120 times by 1 test: return qMax(qreal(0.0) , m_duration + (m_durationVariation * QRandomGenerator::global()->bounded(2.0)) - m_durationVariation);Executed by:
| 21120 | ||||||
| 56 | + (m_durationVariation * QRandomGenerator::global()->bounded(2.0)) executed 21120 times by 1 test: return qMax(qreal(0.0) , m_duration + (m_durationVariation * QRandomGenerator::global()->bounded(2.0)) - m_durationVariation);Executed by:
| 21120 | ||||||
| 57 | - m_durationVariation); executed 21120 times by 1 test: return qMax(qreal(0.0) , m_duration + (m_durationVariation * QRandomGenerator::global()->bounded(2.0)) - m_durationVariation);Executed by:
| 21120 | ||||||
| 58 | } | - | ||||||
| 59 | - | |||||||
| 60 | bool randomStart() const | - | ||||||
| 61 | { | - | ||||||
| 62 | return executed 5184 times by 5 tests: m_randomStart;return m_randomStart;Executed by:
executed 5184 times by 5 tests: return m_randomStart;Executed by:
| 5184 | ||||||
| 63 | } | - | ||||||
| 64 | - | |||||||
| 65 | public : | - | ||||||
| 66 | void durationChanged(int arg); | - | ||||||
| 67 | - | |||||||
| 68 | void nameChanged(const QString &arg); | - | ||||||
| 69 | - | |||||||
| 70 | void toChanged(const QVariantMap &arg); | - | ||||||
| 71 | - | |||||||
| 72 | void durationVariationChanged(int arg); | - | ||||||
| 73 | - | |||||||
| 74 | void entered(); | - | ||||||
| 75 | - | |||||||
| 76 | void randomStartChanged(bool arg); | - | ||||||
| 77 | - | |||||||
| 78 | public : | - | ||||||
| 79 | void setDuration(int arg) | - | ||||||
| 80 | { | - | ||||||
| 81 | if (m_duration != arg
| 0-14 | ||||||
| 82 | m_duration = arg; | - | ||||||
| 83 | durationChanged(arg); | - | ||||||
| 84 | } executed 14 times by 2 tests: end of blockExecuted by:
| 14 | ||||||
| 85 | } executed 14 times by 2 tests: end of blockExecuted by:
| 14 | ||||||
| 86 | - | |||||||
| 87 | void setName(const QString &arg) | - | ||||||
| 88 | { | - | ||||||
| 89 | if (m_name != arg
| 6-90 | ||||||
| 90 | m_name = arg; | - | ||||||
| 91 | nameChanged(arg); | - | ||||||
| 92 | } executed 90 times by 5 tests: end of blockExecuted by:
| 90 | ||||||
| 93 | } executed 96 times by 5 tests: end of blockExecuted by:
| 96 | ||||||
| 94 | - | |||||||
| 95 | void setTo(const QVariantMap &arg) | - | ||||||
| 96 | { | - | ||||||
| 97 | if (m_to != arg
| 0-32 | ||||||
| 98 | m_to = arg; | - | ||||||
| 99 | toChanged(arg); | - | ||||||
| 100 | } executed 32 times by 3 tests: end of blockExecuted by:
| 32 | ||||||
| 101 | } executed 32 times by 3 tests: end of blockExecuted by:
| 32 | ||||||
| 102 | - | |||||||
| 103 | void setDurationVariation(int arg) | - | ||||||
| 104 | { | - | ||||||
| 105 | if (m_durationVariation != arg
| 0-2 | ||||||
| 106 | m_durationVariation = arg; | - | ||||||
| 107 | durationVariationChanged(arg); | - | ||||||
| 108 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||
| 109 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||
| 110 | - | |||||||
| 111 | void setRandomStart(bool arg) | - | ||||||
| 112 | { | - | ||||||
| 113 | if (m_randomStart != arg
| 0-2 | ||||||
| 114 | m_randomStart = arg; | - | ||||||
| 115 | randomStartChanged(arg); | - | ||||||
| 116 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||
| 117 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||
| 118 | - | |||||||
| 119 | private: | - | ||||||
| 120 | QString m_name; | - | ||||||
| 121 | QVariantMap m_to; | - | ||||||
| 122 | int m_duration = -1; | - | ||||||
| 123 | int m_durationVariation = 0; | - | ||||||
| 124 | - | |||||||
| 125 | friend class QQuickStochasticEngine; | - | ||||||
| 126 | bool m_randomStart = false; | - | ||||||
| 127 | }; | - | ||||||
| 128 | - | |||||||
| 129 | class __attribute__((visibility("default"))) QQuickStochasticEngine : public QObject | - | ||||||
| 130 | { | - | ||||||
| 131 | public: | - | ||||||
| 132 | #pragma GCC diagnostic push | - | ||||||
| 133 | - | |||||||
| 134 | #pragma GCC diagnostic ignored "-Wsuggest-override" | - | ||||||
| 135 | 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: | - | ||||||
| 136 | #pragma GCC diagnostic ignored "-Wattributes" | - | ||||||
| 137 | __attribute__((visibility("hidden"))) static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **); | - | ||||||
| 138 | #pragma GCC diagnostic pop | - | ||||||
| 139 | struct QPrivateSignal {}; | - | ||||||
| 140 | - | |||||||
| 141 | - | |||||||
| 142 | - | |||||||
| 143 | public: | - | ||||||
| 144 | explicit QQuickStochasticEngine(QObject *parent = nullptr); | - | ||||||
| 145 | QQuickStochasticEngine(const QList<QQuickStochasticState*> &states, QObject *parent = nullptr); | - | ||||||
| 146 | ~QQuickStochasticEngine() override; | - | ||||||
| 147 | - | |||||||
| 148 | QQmlListProperty<QQuickStochasticState> states() | - | ||||||
| 149 | { | - | ||||||
| 150 | return never executed: QQmlListProperty<QQuickStochasticState>(this, m_states);return QQmlListProperty<QQuickStochasticState>(this, m_states);never executed: return QQmlListProperty<QQuickStochasticState>(this, m_states); | 0 | ||||||
| 151 | } | - | ||||||
| 152 | - | |||||||
| 153 | QString globalGoal() const | - | ||||||
| 154 | { | - | ||||||
| 155 | return never executed: m_globalGoal;return m_globalGoal;never executed: return m_globalGoal; | 0 | ||||||
| 156 | } | - | ||||||
| 157 | - | |||||||
| 158 | int count() const {return executed 2464 times by 2 tests: m_things.count();return m_things.count();Executed by:
executed 2464 times by 2 tests: }return m_things.count();Executed by:
| 2464 | ||||||
| 159 | void setCount(int c); | - | ||||||
| 160 | - | |||||||
| 161 | void setGoal(int state, int sprite=0, bool jump=false); | - | ||||||
| 162 | void start(int index=0, int state=0); | - | ||||||
| 163 | virtual void restart(int index=0); | - | ||||||
| 164 | virtual void advance(int index=0); | - | ||||||
| 165 | void stop(int index=0); | - | ||||||
| 166 | int curState(int index=0) const {return executed 41868 times by 3 tests: m_things[index];return m_things[index];Executed by:
executed 41868 times by 3 tests: }return m_things[index];Executed by:
| 41868 | ||||||
| 167 | - | |||||||
| 168 | QQuickStochasticState* state(int idx) const {return executed 18 times by 2 tests: m_states[idx];return m_states[idx];Executed by:
executed 18 times by 2 tests: }return m_states[idx];Executed by:
| 18 | ||||||
| 169 | int stateIndex(QQuickStochasticState* s) const {return never executed: m_states.indexOf(s);return m_states.indexOf(s);never executed: }return m_states.indexOf(s); | 0 | ||||||
| 170 | int stateIndex(const QString& s) const { | - | ||||||
| 171 | for (int i=0; i<m_states.count()
| 0-8 | ||||||
| 172 | if (m_states[i]->name() == s
| 2-6 | ||||||
| 173 | return executed 6 times by 1 test: i;return i;Executed by:
executed 6 times by 1 test: return i;Executed by:
| 6 | ||||||
| 174 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||
| 175 | } | - | ||||||
| 176 | - | |||||||
| 177 | int stateCount() {return executed 4 times by 1 test: m_states.count();return m_states.count();Executed by:
executed 4 times by 1 test: }return m_states.count();Executed by:
| 4 | ||||||
| 178 | private: | - | ||||||
| 179 | public : | - | ||||||
| 180 | - | |||||||
| 181 | void globalGoalChanged(const QString &arg); | - | ||||||
| 182 | void stateChanged(int idx); | - | ||||||
| 183 | - | |||||||
| 184 | public : | - | ||||||
| 185 | void setGlobalGoal(const QString &arg) | - | ||||||
| 186 | { | - | ||||||
| 187 | if (m_globalGoal != arg
| 0 | ||||||
| 188 | m_globalGoal = arg; | - | ||||||
| 189 | globalGoalChanged(arg); | - | ||||||
| 190 | } never executed: end of block | 0 | ||||||
| 191 | } never executed: end of block | 0 | ||||||
| 192 | - | |||||||
| 193 | uint updateSprites(uint time); | - | ||||||
| 194 | - | |||||||
| 195 | protected: | - | ||||||
| 196 | friend class QQuickParticleSystem; | - | ||||||
| 197 | void addToUpdateList(uint t, int idx); | - | ||||||
| 198 | int nextState(int curState, int idx=0); | - | ||||||
| 199 | int goalSeek(int curState, int idx, int dist=-1); | - | ||||||
| 200 | QList<QQuickStochasticState*> m_states; | - | ||||||
| 201 | - | |||||||
| 202 | QVector<int> m_things; | - | ||||||
| 203 | QVector<int> m_goals; | - | ||||||
| 204 | QVector<int> m_duration; | - | ||||||
| 205 | QVector<int> m_startTimes; | - | ||||||
| 206 | QVector<QPair<uint, QVector<int> > > m_stateUpdates; | - | ||||||
| 207 | - | |||||||
| 208 | QTime m_advanceTime; | - | ||||||
| 209 | uint m_timeOffset; | - | ||||||
| 210 | QString m_globalGoal; | - | ||||||
| 211 | int m_maxFrames; | - | ||||||
| 212 | int m_imageStateCount; | - | ||||||
| 213 | bool m_addAdvance; | - | ||||||
| 214 | }; | - | ||||||
| 215 | - | |||||||
| 216 | class __attribute__((visibility("default"))) QQuickSpriteEngine : public QQuickStochasticEngine | - | ||||||
| 217 | { | - | ||||||
| 218 | public: | - | ||||||
| 219 | #pragma GCC diagnostic push | - | ||||||
| 220 | - | |||||||
| 221 | #pragma GCC diagnostic ignored "-Wsuggest-override" | - | ||||||
| 222 | 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: | - | ||||||
| 223 | #pragma GCC diagnostic ignored "-Wattributes" | - | ||||||
| 224 | __attribute__((visibility("hidden"))) static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **); | - | ||||||
| 225 | #pragma GCC diagnostic pop | - | ||||||
| 226 | struct QPrivateSignal {}; | - | ||||||
| 227 | - | |||||||
| 228 | public: | - | ||||||
| 229 | explicit QQuickSpriteEngine(QObject *parent = nullptr); | - | ||||||
| 230 | QQuickSpriteEngine(const QList<QQuickSprite*> &sprites, QObject *parent = nullptr); | - | ||||||
| 231 | ~QQuickSpriteEngine() override; | - | ||||||
| 232 | QQmlListProperty<QQuickSprite> sprites() | - | ||||||
| 233 | { | - | ||||||
| 234 | return never executed: QQmlListProperty<QQuickSprite>(this, m_sprites);return QQmlListProperty<QQuickSprite>(this, m_sprites);never executed: return QQmlListProperty<QQuickSprite>(this, m_sprites); | 0 | ||||||
| 235 | } | - | ||||||
| 236 | - | |||||||
| 237 | QQuickSprite* sprite(int sprite = 0) const; | - | ||||||
| 238 | int spriteState(int sprite = 0) const; | - | ||||||
| 239 | int spriteStart(int sprite = 0) const; | - | ||||||
| 240 | int spriteFrames(int sprite = 0) const; | - | ||||||
| 241 | int spriteDuration(int sprite = 0) const; | - | ||||||
| 242 | int spriteX(int sprite = 0) const; | - | ||||||
| 243 | int spriteY(int sprite = 0) const; | - | ||||||
| 244 | int spriteWidth(int sprite = 0) const; | - | ||||||
| 245 | int spriteHeight(int sprite = 0) const; | - | ||||||
| 246 | int spriteCount() const; | - | ||||||
| 247 | int maxFrames() const; | - | ||||||
| 248 | - | |||||||
| 249 | void restart(int index=0) override; | - | ||||||
| 250 | void advance(int index=0) override; | - | ||||||
| 251 | - | |||||||
| 252 | - | |||||||
| 253 | bool isNull() const { return never executed: status() == QQuickPixmap::Null;return status() == QQuickPixmap::Null;never executed: }return status() == QQuickPixmap::Null; | 0 | ||||||
| 254 | bool isReady() const { return never executed: status() == QQuickPixmap::Ready;return status() == QQuickPixmap::Ready;never executed: }return status() == QQuickPixmap::Ready; | 0 | ||||||
| 255 | bool isLoading() const { return executed 28 times by 3 tests: status() == QQuickPixmap::Loading;return status() == QQuickPixmap::Loading;Executed by:
executed 28 times by 3 tests: }return status() == QQuickPixmap::Loading;Executed by:
| 28 | ||||||
| 256 | bool isError() const { return never executed: status() == QQuickPixmap::Error;return status() == QQuickPixmap::Error;never executed: }return status() == QQuickPixmap::Error; | 0 | ||||||
| 257 | QQuickPixmap::Status status() const; | - | ||||||
| 258 | void startAssemblingImage(); | - | ||||||
| 259 | QImage assembledImage(int maxSize = 2048); | - | ||||||
| 260 | - | |||||||
| 261 | private: | - | ||||||
| 262 | int pseudospriteProgress(int, int, int *rd = nullptr) const; | - | ||||||
| 263 | QList<QQuickSprite*> m_sprites; | - | ||||||
| 264 | bool m_startedImageAssembly; | - | ||||||
| 265 | bool m_loaded; | - | ||||||
| 266 | bool m_errorsPrinted; | - | ||||||
| 267 | }; | - | ||||||
| 268 | - | |||||||
| 269 | - | |||||||
| 270 | inline void spriteAppend(QQmlListProperty<QQuickSprite> *p, QQuickSprite* s) | - | ||||||
| 271 | { | - | ||||||
| 272 | reinterpret_cast<QList<QQuickSprite *> *>(p->data)->append(s); | - | ||||||
| 273 | p->object->metaObject()->invokeMethod(p->object, "createEngine"); | - | ||||||
| 274 | } executed 72 times by 4 tests: end of blockExecuted by:
| 72 | ||||||
| 275 | - | |||||||
| 276 | inline QQuickSprite* spriteAt(QQmlListProperty<QQuickSprite> *p, int idx) | - | ||||||
| 277 | { | - | ||||||
| 278 | return never executed: reinterpret_cast<QList<QQuickSprite *> *>(p->data)->at(idx);return reinterpret_cast<QList<QQuickSprite *> *>(p->data)->at(idx);never executed: return reinterpret_cast<QList<QQuickSprite *> *>(p->data)->at(idx); | 0 | ||||||
| 279 | } | - | ||||||
| 280 | - | |||||||
| 281 | inline void spriteClear(QQmlListProperty<QQuickSprite> *p) | - | ||||||
| 282 | { | - | ||||||
| 283 | reinterpret_cast<QList<QQuickSprite *> *>(p->data)->clear(); | - | ||||||
| 284 | p->object->metaObject()->invokeMethod(p->object, "createEngine"); | - | ||||||
| 285 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||
| 286 | - | |||||||
| 287 | inline int spriteCount(QQmlListProperty<QQuickSprite> *p) | - | ||||||
| 288 | { | - | ||||||
| 289 | return never executed: reinterpret_cast<QList<QQuickSprite *> *>(p->data)->count();return reinterpret_cast<QList<QQuickSprite *> *>(p->data)->count();never executed: return reinterpret_cast<QList<QQuickSprite *> *>(p->data)->count(); | 0 | ||||||
| 290 | } | - | ||||||
| 291 | - | |||||||
| 292 | - | |||||||
| Switch to Source code | Preprocessed file |