Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/items/qquickanimatedsprite_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 QQUICKANIMATEDSPRITE_P_H | - |
41 | #define QQUICKANIMATEDSPRITE_P_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 <private/qtquickglobal_p.h> | - |
55 | - | |
56 | QT_REQUIRE_CONFIG(quick_sprite); | - |
57 | - | |
58 | #include <QtQuick/QQuickItem> | - |
59 | #include <private/qquicksprite_p.h> | - |
60 | #include <QtCore/qelapsedtimer.h> | - |
61 | - | |
62 | QT_BEGIN_NAMESPACE | - |
63 | - | |
64 | class QSGContext; | - |
65 | class QQuickSprite; | - |
66 | class QQuickSpriteEngine; | - |
67 | class QSGGeometryNode; | - |
68 | class QQuickAnimatedSpriteMaterial; | - |
69 | class QQuickAnimatedSpritePrivate; | - |
70 | class QSGSpriteNode; | - |
71 | class Q_AUTOTEST_EXPORT QQuickAnimatedSprite : public QQuickItem | - |
72 | { | - |
73 | Q_OBJECT | - |
74 | Q_PROPERTY(bool running READ running WRITE setRunning NOTIFY runningChanged) | - |
75 | Q_PROPERTY(bool interpolate READ interpolate WRITE setInterpolate NOTIFY interpolateChanged) | - |
76 | //###try to share similar spriteEngines for less overhead? | - |
77 | //These properties come out of QQuickSprite, since an AnimatedSprite is a renderer for a single sprite | - |
78 | Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged) | - |
79 | Q_PROPERTY(bool reverse READ reverse WRITE setReverse NOTIFY reverseChanged) | - |
80 | Q_PROPERTY(bool frameSync READ frameSync WRITE setFrameSync NOTIFY frameSyncChanged) | - |
81 | Q_PROPERTY(int frameCount READ frameCount WRITE setFrameCount NOTIFY frameCountChanged) | - |
82 | //If frame height or width is not specified, it is assumed to be a single long row of square frames. | - |
83 | //Otherwise, it can be multiple contiguous rows, when one row runs out the next will be used. | - |
84 | Q_PROPERTY(int frameHeight READ frameHeight WRITE setFrameHeight NOTIFY frameHeightChanged) | - |
85 | Q_PROPERTY(int frameWidth READ frameWidth WRITE setFrameWidth NOTIFY frameWidthChanged) | - |
86 | Q_PROPERTY(int frameX READ frameX WRITE setFrameX NOTIFY frameXChanged) | - |
87 | Q_PROPERTY(int frameY READ frameY WRITE setFrameY NOTIFY frameYChanged) | - |
88 | //Precedence order: frameRate, frameDuration | - |
89 | Q_PROPERTY(qreal frameRate READ frameRate WRITE setFrameRate NOTIFY frameRateChanged RESET resetFrameRate) | - |
90 | Q_PROPERTY(int frameDuration READ frameDuration WRITE setFrameDuration NOTIFY frameDurationChanged RESET resetFrameDuration) | - |
91 | //Extra Simple Sprite Stuff | - |
92 | Q_PROPERTY(int loops READ loops WRITE setLoops NOTIFY loopsChanged) | - |
93 | Q_PROPERTY(bool paused READ paused WRITE setPaused NOTIFY pausedChanged) | - |
94 | Q_PROPERTY(int currentFrame READ currentFrame WRITE setCurrentFrame NOTIFY currentFrameChanged) | - |
95 | - | |
96 | public: | - |
97 | explicit QQuickAnimatedSprite(QQuickItem *parent = nullptr); | - |
98 | enum LoopParameters { | - |
99 | Infinite = -1 | - |
100 | }; | - |
101 | Q_ENUM(LoopParameters) | - |
102 | - | |
103 | bool running() const; | - |
104 | bool interpolate() const; | - |
105 | QUrl source() const; | - |
106 | bool reverse() const; | - |
107 | bool frameSync() const; | - |
108 | int frameCount() const; | - |
109 | int frameHeight() const; | - |
110 | int frameWidth() const; | - |
111 | int frameX() const; | - |
112 | int frameY() const; | - |
113 | qreal frameRate() const; | - |
114 | int frameDuration() const; | - |
115 | int loops() const; | - |
116 | bool paused() const; | - |
117 | int currentFrame() const; | - |
118 | - | |
119 | Q_SIGNALS: | - |
120 | - | |
121 | void pausedChanged(bool arg); | - |
122 | void runningChanged(bool arg); | - |
123 | void interpolateChanged(bool arg); | - |
124 | - | |
125 | void sourceChanged(QUrl arg); | - |
126 | void reverseChanged(bool arg); | - |
127 | void frameSyncChanged(bool arg); | - |
128 | void frameCountChanged(int arg); | - |
129 | void frameHeightChanged(int arg); | - |
130 | void frameWidthChanged(int arg); | - |
131 | void frameXChanged(int arg); | - |
132 | void frameYChanged(int arg); | - |
133 | void frameRateChanged(qreal arg); | - |
134 | void frameDurationChanged(int arg); | - |
135 | void loopsChanged(int arg); | - |
136 | void currentFrameChanged(int arg); | - |
137 | - | |
138 | Q_REVISION(12) void finished(); | - |
139 | - | |
140 | public Q_SLOTS: | - |
141 | void start(); | - |
142 | void stop(); | - |
143 | void restart() {stop(); start();} executed 8 times by 1 test: end of block Executed by:
| 8 |
144 | void advance(int frames=1); | - |
145 | void pause(); | - |
146 | void resume(); | - |
147 | - | |
148 | void setRunning(bool arg); | - |
149 | void setPaused(bool arg); | - |
150 | void setInterpolate(bool arg); | - |
151 | void setSource(QUrl arg); | - |
152 | void setReverse(bool arg); | - |
153 | void setFrameSync(bool arg); | - |
154 | void setFrameCount(int arg); | - |
155 | void setFrameHeight(int arg); | - |
156 | void setFrameWidth(int arg); | - |
157 | void setFrameX(int arg); | - |
158 | void setFrameY(int arg); | - |
159 | void setFrameRate(qreal arg); | - |
160 | void setFrameDuration(int arg); | - |
161 | void resetFrameRate(); | - |
162 | void resetFrameDuration(); | - |
163 | void setLoops(int arg); | - |
164 | void setCurrentFrame(int arg); | - |
165 | - | |
166 | - | |
167 | private Q_SLOTS: | - |
168 | void createEngine(); | - |
169 | - | |
170 | protected Q_SLOTS: | - |
171 | void reset(); | - |
172 | - | |
173 | protected: | - |
174 | void componentComplete() override; | - |
175 | QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) override; | - |
176 | private: | - |
177 | void maybeUpdate(); | - |
178 | bool isCurrentFrameChangedConnected(); | - |
179 | void prepareNextFrame(QSGSpriteNode *node); | - |
180 | void reloadImage(); | - |
181 | QSGSpriteNode* initNode(); | - |
182 | - | |
183 | private: | - |
184 | Q_DISABLE_COPY(QQuickAnimatedSprite) | - |
185 | Q_DECLARE_PRIVATE(QQuickAnimatedSprite) executed 2214 times by 1 test: return reinterpret_cast<QQuickAnimatedSpritePrivate *>(qGetPtrHelper(d_ptr)); Executed by:
executed 1013 times by 1 test: return reinterpret_cast<const QQuickAnimatedSpritePrivate *>(qGetPtrHelper(d_ptr)); Executed by:
| 1013-2214 |
186 | }; | - |
187 | - | |
188 | QT_END_NAMESPACE | - |
189 | - | |
190 | #endif // QQUICKANIMATEDSPRITE_P_H | - |
Source code | Switch to Preprocessed file |