| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/particles/qquickparticlepainter_p.h |
| Source code | Switch to Preprocessed file |
| Line | Source | Count | ||||||
|---|---|---|---|---|---|---|---|---|
| 1 | /**************************************************************************** | - | ||||||
| 2 | ** | - | ||||||
| 3 | ** Copyright (C) 2016 The Qt Company Ltd. | - | ||||||
| 4 | ** Contact: https://www.qt.io/licensing/ | - | ||||||
| 5 | ** | - | ||||||
| 6 | ** This file is part of the QtQuick module of the Qt Toolkit. | - | ||||||
| 7 | ** | - | ||||||
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ | - | ||||||
| 9 | ** Commercial License Usage | - | ||||||
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in | - | ||||||
| 11 | ** accordance with the commercial license agreement provided with the | - | ||||||
| 12 | ** Software or, alternatively, in accordance with the terms contained in | - | ||||||
| 13 | ** a written agreement between you and The Qt Company. For licensing terms | - | ||||||
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further | - | ||||||
| 15 | ** information use the contact form at https://www.qt.io/contact-us. | - | ||||||
| 16 | ** | - | ||||||
| 17 | ** GNU Lesser General Public License Usage | - | ||||||
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - | ||||||
| 19 | ** General Public License version 3 as published by the Free Software | - | ||||||
| 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the | - | ||||||
| 21 | ** packaging of this file. Please review the following information to | - | ||||||
| 22 | ** ensure the GNU Lesser General Public License version 3 requirements | - | ||||||
| 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. | - | ||||||
| 24 | ** | - | ||||||
| 25 | ** GNU General Public License Usage | - | ||||||
| 26 | ** Alternatively, this file may be used under the terms of the GNU | - | ||||||
| 27 | ** General Public License version 2.0 or (at your option) the GNU General | - | ||||||
| 28 | ** Public license version 3 or any later version approved by the KDE Free | - | ||||||
| 29 | ** Qt Foundation. The licenses are as published by the Free Software | - | ||||||
| 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 | - | ||||||
| 31 | ** included in the packaging of this file. Please review the following | - | ||||||
| 32 | ** information to ensure the GNU General Public License requirements will | - | ||||||
| 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and | - | ||||||
| 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. | - | ||||||
| 35 | ** | - | ||||||
| 36 | ** $QT_END_LICENSE$ | - | ||||||
| 37 | ** | - | ||||||
| 38 | ****************************************************************************/ | - | ||||||
| 39 | - | |||||||
| 40 | #ifndef PARTICLE_H | - | ||||||
| 41 | #define PARTICLE_H | - | ||||||
| 42 | - | |||||||
| 43 | // | - | ||||||
| 44 | // W A R N I N G | - | ||||||
| 45 | // ------------- | - | ||||||
| 46 | // | - | ||||||
| 47 | // This file is not part of the Qt API. It exists purely as an | - | ||||||
| 48 | // implementation detail. This header file may change from version to | - | ||||||
| 49 | // version without notice, or even be removed. | - | ||||||
| 50 | // | - | ||||||
| 51 | // We mean it. | - | ||||||
| 52 | // | - | ||||||
| 53 | - | |||||||
| 54 | #include <QObject> | - | ||||||
| 55 | #include <QDebug> | - | ||||||
| 56 | #include <QPair> | - | ||||||
| 57 | #include "qquickparticlesystem_p.h" | - | ||||||
| 58 | - | |||||||
| 59 | QT_BEGIN_NAMESPACE | - | ||||||
| 60 | - | |||||||
| 61 | class QQuickParticlePainter : public QQuickItem | - | ||||||
| 62 | { | - | ||||||
| 63 | Q_OBJECT | - | ||||||
| 64 | Q_PROPERTY(QQuickParticleSystem* system READ system WRITE setSystem NOTIFY systemChanged) | - | ||||||
| 65 | Q_PROPERTY(QStringList groups READ groups WRITE setGroups NOTIFY groupsChanged) | - | ||||||
| 66 | - | |||||||
| 67 | public: // data | - | ||||||
| 68 | typedef QQuickParticleVarLengthArray<QQuickParticleGroupData::ID, 4> GroupIDs; | - | ||||||
| 69 | - | |||||||
| 70 | public: | - | ||||||
| 71 | explicit QQuickParticlePainter(QQuickItem *parent = 0); | - | ||||||
| 72 | //Data Interface to system | - | ||||||
| 73 | void load(QQuickParticleData*); | - | ||||||
| 74 | void reload(QQuickParticleData*); | - | ||||||
| 75 | void setCount(int c); | - | ||||||
| 76 | - | |||||||
| 77 | int count() const | - | ||||||
| 78 | { | - | ||||||
| 79 | return m_count; executed 365 times by 22 tests: return m_count;Executed by:
| 365 | ||||||
| 80 | } | - | ||||||
| 81 | - | |||||||
| 82 | void performPendingCommits();//Called from updatePaintNode | - | ||||||
| 83 | QQuickParticleSystem* system() const | - | ||||||
| 84 | { | - | ||||||
| 85 | return m_system; never executed: return m_system; | 0 | ||||||
| 86 | } | - | ||||||
| 87 | - | |||||||
| 88 | QStringList groups() const | - | ||||||
| 89 | { | - | ||||||
| 90 | return m_groups; executed 1181 times by 24 tests: return m_groups;Executed by:
| 1181 | ||||||
| 91 | } | - | ||||||
| 92 | - | |||||||
| 93 | const GroupIDs &groupIds() const | - | ||||||
| 94 | { | - | ||||||
| 95 | if (m_groupIdsNeedRecalculation) {
| 268-1119 | ||||||
| 96 | recalculateGroupIds(); | - | ||||||
| 97 | } executed 268 times by 24 tests: end of blockExecuted by:
| 268 | ||||||
| 98 | return m_groupIds; executed 1387 times by 24 tests: return m_groupIds;Executed by:
| 1387 | ||||||
| 99 | } | - | ||||||
| 100 | - | |||||||
| 101 | void itemChange(ItemChange, const ItemChangeData &) override; | - | ||||||
| 102 | - | |||||||
| 103 | Q_SIGNALS: | - | ||||||
| 104 | void countChanged(); | - | ||||||
| 105 | void systemChanged(QQuickParticleSystem* arg); | - | ||||||
| 106 | - | |||||||
| 107 | void groupsChanged(const QStringList &arg); | - | ||||||
| 108 | - | |||||||
| 109 | public Q_SLOTS: | - | ||||||
| 110 | void setSystem(QQuickParticleSystem* arg); | - | ||||||
| 111 | - | |||||||
| 112 | void setGroups(const QStringList &arg); | - | ||||||
| 113 | - | |||||||
| 114 | void calcSystemOffset(bool resetPending = false); | - | ||||||
| 115 | - | |||||||
| 116 | private Q_SLOTS: | - | ||||||
| 117 | virtual void sceneGraphInvalidated() {} | - | ||||||
| 118 | - | |||||||
| 119 | protected: | - | ||||||
| 120 | /* Reset resets all your internal data structures. But anything attached to a particle should | - | ||||||
| 121 | be in attached data. So reset + reloads should have no visible effect. | - | ||||||
| 122 | ###Hunt down all cases where we do a complete reset for convenience and be more targeted | - | ||||||
| 123 | */ | - | ||||||
| 124 | virtual void reset(); | - | ||||||
| 125 | - | |||||||
| 126 | void componentComplete() override; | - | ||||||
| 127 | virtual void initialize(int gIdx, int pIdx){//Called from main thread | - | ||||||
| 128 | Q_UNUSED(gIdx); | - | ||||||
| 129 | Q_UNUSED(pIdx); | - | ||||||
| 130 | } never executed: end of block | 0 | ||||||
| 131 | virtual void commit(int gIdx, int pIdx){//Called in Render Thread | - | ||||||
| 132 | //###If you need to do something on size changed, check m_data size in this? Or we reset you every time? | - | ||||||
| 133 | Q_UNUSED(gIdx); | - | ||||||
| 134 | Q_UNUSED(pIdx); | - | ||||||
| 135 | } never executed: end of block | 0 | ||||||
| 136 | - | |||||||
| 137 | QQuickParticleSystem* m_system; | - | ||||||
| 138 | friend class QQuickParticleSystem; | - | ||||||
| 139 | int m_count; | - | ||||||
| 140 | bool m_pleaseReset;//Used by subclasses, but it's a nice optimization to know when stuff isn't going to matter. | - | ||||||
| 141 | QPointF m_systemOffset; | - | ||||||
| 142 | - | |||||||
| 143 | QQuickWindow *m_window; | - | ||||||
| 144 | - | |||||||
| 145 | private: // methods | - | ||||||
| 146 | void recalculateGroupIds() const; | - | ||||||
| 147 | - | |||||||
| 148 | private: // data | - | ||||||
| 149 | QStringList m_groups; | - | ||||||
| 150 | QSet<QPair<int,int> > m_pendingCommits; | - | ||||||
| 151 | mutable GroupIDs m_groupIds; | - | ||||||
| 152 | mutable bool m_groupIdsNeedRecalculation; | - | ||||||
| 153 | }; | - | ||||||
| 154 | - | |||||||
| 155 | QT_END_NAMESPACE | - | ||||||
| 156 | #endif // PARTICLE_H | - | ||||||
| Source code | Switch to Preprocessed file |