OpenCoverage

qquickshadereffectsource.cpp

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/items/qquickshadereffectsource.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7class QQuickShaderEffectSourceTextureProvider : public QSGTextureProvider-
8{-
9 public:-
10#pragma GCC diagnostic push-
11 -
12#pragma GCC diagnostic ignored "-Wsuggest-override"-
13 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:-
14#pragma GCC diagnostic ignored "-Wattributes"-
15 __attribute__((visibility("hidden"))) static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **);-
16#pragma GCC diagnostic pop-
17 struct QPrivateSignal {};-
18public:-
19 QQuickShaderEffectSourceTextureProvider()-
20 : sourceTexture(nullptr)-
21 , mipmapFiltering(QSGTexture::None)-
22 , filtering(QSGTexture::Nearest)-
23 , horizontalWrap(QSGTexture::ClampToEdge)-
24 , verticalWrap(QSGTexture::ClampToEdge)-
25 {-
26 }
executed 57 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
57
27-
28 QSGTexture *texture() const override {-
29 sourceTexture->setMipmapFiltering(mipmapFiltering);-
30 sourceTexture->setFiltering(filtering);-
31 sourceTexture->setHorizontalWrapMode(horizontalWrap);-
32 sourceTexture->setVerticalWrapMode(verticalWrap);-
33 return
executed 598 times by 3 tests: return sourceTexture;
Executed by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
sourceTexture;
executed 598 times by 3 tests: return sourceTexture;
Executed by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
598
34 }-
35-
36 QSGLayer *sourceTexture;-
37-
38 QSGTexture::Filtering mipmapFiltering;-
39 QSGTexture::Filtering filtering;-
40 QSGTexture::WrapMode horizontalWrap;-
41 QSGTexture::WrapMode verticalWrap;-
42};-
43-
44class QQuickShaderEffectSourceCleanup : public QRunnable-
45{-
46public:-
47 QQuickShaderEffectSourceCleanup(QSGLayer *t, QQuickShaderEffectSourceTextureProvider *p)-
48 : texture(t)-
49 , provider(p)-
50 {}
executed 93 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
93
51 void run() override {-
52 delete texture;-
53 delete provider;-
54 }
executed 93 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
93
55 QSGLayer *texture;-
56 QQuickShaderEffectSourceTextureProvider *provider;-
57};-
58QQuickShaderEffectSource::QQuickShaderEffectSource(QQuickItem *parent)-
59 : QQuickItem(parent)-
60 , m_provider(nullptr)-
61 , m_texture(nullptr)-
62 , m_wrapMode(ClampToEdge)-
63 , m_sourceItem(nullptr)-
64 , m_textureSize(0, 0)-
65 , m_format(RGBA)-
66 , m_samples(0)-
67 , m_live(true)-
68 , m_hideSource(false)-
69 , m_mipmap(false)-
70 , m_recursive(false)-
71 , m_grab(true)-
72 , m_textureMirroring(MirrorVertically)-
73{-
74 setFlag(ItemHasContents);-
75}
executed 108 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
108
76-
77QQuickShaderEffectSource::~QQuickShaderEffectSource()-
78{-
79 if (window()
window()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickshadereffect
FALSEevaluated 106 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
) {
2-106
80 window()->scheduleRenderJob(new QQuickShaderEffectSourceCleanup(m_texture, m_provider),-
81 QQuickWindow::AfterSynchronizingStage);-
82 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquickshadereffect
else {
2
83-
84-
85 ((!m_texture) ? static_cast<void>(0) : qt_assert("!m_texture", __FILE__, 211));-
86 ((!m_provider) ? static_cast<void>(0) : qt_assert("!m_provider", __FILE__, 212));-
87 }
executed 106 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
106
88-
89 if (m_sourceItem
m_sourceItemDescription
TRUEevaluated 98 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
FALSEevaluated 10 times by 2 tests
Evaluated by:
  • tst_qquickitemlayer
  • tst_qquickshadereffect
) {
10-98
90 QQuickItemPrivate *sd = QQuickItemPrivate::get(m_sourceItem);-
91 sd->removeItemChangeListener(this, QQuickItemPrivate::Geometry);-
92 sd->derefFromEffectItem(m_hideSource);-
93 if (window()
window()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickshadereffect
FALSEevaluated 96 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
)
2-96
94 sd->derefWindow();
executed 2 times by 1 test: sd->derefWindow();
Executed by:
  • tst_qquickshadereffect
2
95 }
executed 98 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
98
96}
executed 108 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
108
97-
98void QQuickShaderEffectSource::ensureTexture()-
99{-
100 if (m_texture
m_textureDescription
TRUEevaluated 139 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
FALSEevaluated 101 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
)
101-139
101 return;
executed 139 times by 4 tests: return;
Executed by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
139
102-
103 ((QQuickItemPrivate::get(this)->window && QQuickItemPrivate::get(this)->sceneGraphRenderContext() && QThread::currentThread() == QQuickItemPrivate::get(this)->sceneGraphRenderContext()->thread()) ? static_cast<void>(0) : qt_assert_x("QQuickShaderEffectSource::ensureTexture", "Cannot be used outside the rendering thread",-
104-
105-
106-
107 __FILE__-
108 ,-
109-
110-
111-
112 233-
113 ))-
114-
115-
116-
117 ;-
118-
119 QSGRenderContext *rc = QQuickItemPrivate::get(this)->sceneGraphRenderContext();-
120 m_texture = rc->sceneGraphContext()->createLayer(rc);-
121 connect(QQuickItemPrivate::get(this)->window, qFlagLocation("2""sceneGraphInvalidated()" "\0" __FILE__ ":" "237"), m_texture, qFlagLocation("1""invalidated()" "\0" __FILE__ ":" "237"), Qt::DirectConnection);-
122 connect(m_texture, qFlagLocation("2""updateRequested()" "\0" __FILE__ ":" "238"), this, qFlagLocation("1""update()" "\0" __FILE__ ":" "238"));-
123 connect(m_texture, qFlagLocation("2""scheduledUpdateCompleted()" "\0" __FILE__ ":" "239"), this, qFlagLocation("2""scheduledUpdateCompleted()" "\0" __FILE__ ":" "239"));-
124}
executed 101 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
101
125-
126static void get_wrap_mode(QQuickShaderEffectSource::WrapMode mode, QSGTexture::WrapMode *hWrap, QSGTexture::WrapMode *vWrap);-
127-
128QSGTextureProvider *QQuickShaderEffectSource::textureProvider() const-
129{-
130 const QQuickItemPrivate *d = QQuickItemPrivate::get(this);-
131 if (!d->window
!d->windowDescription
TRUEnever evaluated
FALSEevaluated 58 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
|| !d->sceneGraphRenderContext()
!d->sceneGraphRenderContext()Description
TRUEnever evaluated
FALSEevaluated 58 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
|| QThread::currentThread() != d->sceneGraphRenderContext()->thread()
QThread::curre...xt()->thread()Description
TRUEnever evaluated
FALSEevaluated 58 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
) {
0-58
132 QMessageLogger(__FILE__, 248, __PRETTY_FUNCTION__).warning("QQuickShaderEffectSource::textureProvider: can only be queried on the rendering thread of an exposed window");-
133 return
never executed: return nullptr;
nullptr;
never executed: return nullptr;
0
134 }-
135-
136 if (!m_provider
!m_providerDescription
TRUEevaluated 57 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_examples
) {
1-57
137 const_cast<QQuickShaderEffectSource *>(this)->m_provider = new QQuickShaderEffectSourceTextureProvider();-
138 const_cast<QQuickShaderEffectSource *>(this)->ensureTexture();-
139 connect(m_texture, qFlagLocation("2""updateRequested()" "\0" __FILE__ ":" "255"), m_provider, qFlagLocation("2""textureChanged()" "\0" __FILE__ ":" "255"));-
140-
141 get_wrap_mode(m_wrapMode, &m_provider->horizontalWrap, &m_provider->verticalWrap);-
142 m_provider->mipmapFiltering = mipmap()
mipmap()Description
TRUEnever evaluated
FALSEevaluated 57 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
? QSGTexture::Linear : QSGTexture::None;
0-57
143 m_provider->filtering = smooth()
smooth()Description
TRUEevaluated 19 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
FALSEevaluated 38 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickitemlayer
? QSGTexture::Linear : QSGTexture::Nearest;
19-38
144 m_provider->sourceTexture = m_texture;-
145 }
executed 57 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
57
146 return
executed 58 times by 3 tests: return m_provider;
Executed by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
m_provider;
executed 58 times by 3 tests: return m_provider;
Executed by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
58
147}-
148QQuickShaderEffectSource::WrapMode QQuickShaderEffectSource::wrapMode() const-
149{-
150 return
never executed: return m_wrapMode;
m_wrapMode;
never executed: return m_wrapMode;
0
151}-
152-
153void QQuickShaderEffectSource::setWrapMode(WrapMode mode)-
154{-
155 if (mode == m_wrapMode
mode == m_wrapModeDescription
TRUEevaluated 82 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickitemlayer
FALSEnever evaluated
)
0-82
156 return;
executed 82 times by 2 tests: return;
Executed by:
  • tst_examples
  • tst_qquickitemlayer
82
157 m_wrapMode = mode;-
158 update();-
159 wrapModeChanged();-
160}
never executed: end of block
0
161QQuickItem *QQuickShaderEffectSource::sourceItem() const-
162{-
163 return
executed 183 times by 4 tests: return m_sourceItem;
Executed by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
m_sourceItem;
executed 183 times by 4 tests: return m_sourceItem;
Executed by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
183
164}-
165-
166void QQuickShaderEffectSource::itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &)-
167{-
168 ((item == m_sourceItem) ? static_cast<void>(0) : qt_assert("item == m_sourceItem", __FILE__, 314));-
169 (void)item;;-
170 if (change.sizeChange()
change.sizeChange()Description
TRUEevaluated 24 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickshadereffect
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_examples
)
8-24
171 update();
executed 24 times by 3 tests: update();
Executed by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickshadereffect
24
172}
executed 32 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickshadereffect
32
173-
174void QQuickShaderEffectSource::setSourceItem(QQuickItem *item)-
175{-
176 if (item == m_sourceItem
item == m_sourceItemDescription
TRUEnever evaluated
FALSEevaluated 108 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
)
0-108
177 return;
never executed: return;
0
178 if (m_sourceItem
m_sourceItemDescription
TRUEnever evaluated
FALSEevaluated 108 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
) {
0-108
179 QQuickItemPrivate *d = QQuickItemPrivate::get(m_sourceItem);-
180 d->derefFromEffectItem(m_hideSource);-
181 d->removeItemChangeListener(this, QQuickItemPrivate::Geometry);-
182 disconnect(m_sourceItem, qFlagLocation("2""destroyed(QObject*)" "\0" __FILE__ ":" "328"), this, qFlagLocation("1""sourceItemDestroyed(QObject*)" "\0" __FILE__ ":" "328"));-
183 if (window()
window()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
184 d->derefWindow();
never executed: d->derefWindow();
0
185 }
never executed: end of block
0
186-
187 m_sourceItem = item;-
188-
189 if (m_sourceItem
m_sourceItemDescription
TRUEevaluated 108 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
FALSEnever evaluated
) {
0-108
190 if (window() == m_sourceItem->window()
window() == m_...Item->window()Description
TRUEevaluated 108 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
FALSEnever evaluated
0-108
191 || (window() == nullptr
window() == nullptrDescription
TRUEnever evaluated
FALSEnever evaluated
&& m_sourceItem->window()
m_sourceItem->window()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
192 || (m_sourceItem->window() == nullptr
m_sourceItem->...w() == nullptrDescription
TRUEnever evaluated
FALSEnever evaluated
&& window()
window()Description
TRUEnever evaluated
FALSEnever evaluated
)) {
0
193 QQuickItemPrivate *d = QQuickItemPrivate::get(item);-
194-
195-
196-
197-
198 if (window()
window()Description
TRUEevaluated 22 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickitemlayer
FALSEevaluated 86 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
)
22-86
199 d->refWindow(window());
executed 22 times by 2 tests: d->refWindow(window());
Executed by:
  • tst_examples
  • tst_qquickitemlayer
22
200 else if (m_sourceItem->window()
m_sourceItem->window()Description
TRUEnever evaluated
FALSEevaluated 86 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
)
0-86
201 d->refWindow(m_sourceItem->window());
never executed: d->refWindow(m_sourceItem->window());
0
202 d->refFromEffectItem(m_hideSource);-
203 d->addItemChangeListener(this, QQuickItemPrivate::Geometry);-
204 connect(m_sourceItem, qFlagLocation("2""destroyed(QObject*)" "\0" __FILE__ ":" "350"), this, qFlagLocation("1""sourceItemDestroyed(QObject*)" "\0" __FILE__ ":" "350"));-
205 }
executed 108 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
else {
108
206 QMessageLogger(__FILE__, 352, __PRETTY_FUNCTION__).warning("ShaderEffectSource: sourceItem and ShaderEffectSource must both be children of the same window.");-
207 m_sourceItem = nullptr;-
208 }
never executed: end of block
0
209 }-
210 update();-
211 sourceItemChanged();-
212}
executed 108 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
108
213-
214void QQuickShaderEffectSource::sourceItemDestroyed(QObject *item)-
215{-
216 ((item == m_sourceItem) ? static_cast<void>(0) : qt_assert("item == m_sourceItem", __FILE__, 362));-
217 (void)item;;-
218 m_sourceItem = nullptr;-
219 update();-
220 sourceItemChanged();-
221}
executed 10 times by 2 tests: end of block
Executed by:
  • tst_qquickitemlayer
  • tst_qquickshadereffect
10
222QRectF QQuickShaderEffectSource::sourceRect() const-
223{-
224 return
never executed: return m_sourceRect;
m_sourceRect;
never executed: return m_sourceRect;
0
225}-
226-
227void QQuickShaderEffectSource::setSourceRect(const QRectF &rect)-
228{-
229 if (rect == m_sourceRect
rect == m_sourceRectDescription
TRUEevaluated 80 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickitemlayer
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickitemlayer
)
2-80
230 return;
executed 80 times by 2 tests: return;
Executed by:
  • tst_examples
  • tst_qquickitemlayer
80
231 m_sourceRect = rect;-
232 update();-
233 sourceRectChanged();-
234}
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquickitemlayer
2
235QSize QQuickShaderEffectSource::textureSize() const-
236{-
237 return
never executed: return m_textureSize;
m_textureSize;
never executed: return m_textureSize;
0
238}-
239-
240void QQuickShaderEffectSource::setTextureSize(const QSize &size)-
241{-
242 if (size == m_textureSize
size == m_textureSizeDescription
TRUEnever evaluated
FALSEevaluated 82 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickitemlayer
)
0-82
243 return;
never executed: return;
0
244 m_textureSize = size;-
245 update();-
246 textureSizeChanged();-
247}
executed 82 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitemlayer
82
248QQuickShaderEffectSource::Format QQuickShaderEffectSource::format() const-
249{-
250 return
never executed: return m_format;
m_format;
never executed: return m_format;
0
251}-
252-
253void QQuickShaderEffectSource::setFormat(QQuickShaderEffectSource::Format format)-
254{-
255 if (format == m_format
format == m_formatDescription
TRUEevaluated 82 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickitemlayer
FALSEnever evaluated
)
0-82
256 return;
executed 82 times by 2 tests: return;
Executed by:
  • tst_examples
  • tst_qquickitemlayer
82
257 m_format = format;-
258 update();-
259 formatChanged();-
260}
never executed: end of block
0
261bool QQuickShaderEffectSource::live() const-
262{-
263 return
never executed: return m_live;
m_live;
never executed: return m_live;
0
264}-
265-
266void QQuickShaderEffectSource::setLive(bool live)-
267{-
268 if (live == m_live
live == m_liveDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
269 return;
never executed: return;
0
270 m_live = live;-
271 update();-
272 liveChanged();-
273}
never executed: end of block
0
274bool QQuickShaderEffectSource::hideSource() const-
275{-
276 return
never executed: return m_hideSource;
m_hideSource;
never executed: return m_hideSource;
0
277}-
278-
279void QQuickShaderEffectSource::setHideSource(bool hide)-
280{-
281 if (hide == m_hideSource
hide == m_hideSourceDescription
TRUEnever evaluated
FALSEevaluated 96 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
)
0-96
282 return;
never executed: return;
0
283 if (m_sourceItem
m_sourceItemDescription
TRUEevaluated 90 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_examples
) {
6-90
284 QQuickItemPrivate::get(m_sourceItem)->refFromEffectItem(hide);-
285 QQuickItemPrivate::get(m_sourceItem)->derefFromEffectItem(m_hideSource);-
286 }
executed 90 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
90
287 m_hideSource = hide;-
288 update();-
289 hideSourceChanged();-
290}
executed 96 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
96
291bool QQuickShaderEffectSource::mipmap() const-
292{-
293 return
executed 57 times by 3 tests: return m_mipmap;
Executed by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
m_mipmap;
executed 57 times by 3 tests: return m_mipmap;
Executed by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
57
294}-
295-
296void QQuickShaderEffectSource::setMipmap(bool enabled)-
297{-
298 if (enabled == m_mipmap
enabled == m_mipmapDescription
TRUEevaluated 80 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickitemlayer
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickitemlayer
)
2-80
299 return;
executed 80 times by 2 tests: return;
Executed by:
  • tst_examples
  • tst_qquickitemlayer
80
300 m_mipmap = enabled;-
301 update();-
302 mipmapChanged();-
303}
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquickitemlayer
2
304bool QQuickShaderEffectSource::recursive() const-
305{-
306 return
never executed: return m_recursive;
m_recursive;
never executed: return m_recursive;
0
307}-
308-
309void QQuickShaderEffectSource::setRecursive(bool enabled)-
310{-
311 if (enabled == m_recursive
enabled == m_recursiveDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
312 return;
never executed: return;
0
313 m_recursive = enabled;-
314 recursiveChanged();-
315}
never executed: end of block
0
316QQuickShaderEffectSource::TextureMirroring QQuickShaderEffectSource::textureMirroring() const-
317{-
318 return
never executed: return QQuickShaderEffectSource::TextureMirroring(m_textureMirroring);
QQuickShaderEffectSource::TextureMirroring(m_textureMirroring);
never executed: return QQuickShaderEffectSource::TextureMirroring(m_textureMirroring);
0
319}-
320-
321void QQuickShaderEffectSource::setTextureMirroring(TextureMirroring mirroring)-
322{-
323 if (mirroring == QQuickShaderEffectSource::TextureMirroring(m_textureMirroring)
mirroring == Q...tureMirroring)Description
TRUEevaluated 66 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickitemlayer
FALSEevaluated 42 times by 1 test
Evaluated by:
  • tst_qquickitemlayer
)
42-66
324 return;
executed 66 times by 2 tests: return;
Executed by:
  • tst_examples
  • tst_qquickitemlayer
66
325 m_textureMirroring = mirroring;-
326 update();-
327 textureMirroringChanged();-
328}
executed 42 times by 1 test: end of block
Executed by:
  • tst_qquickitemlayer
42
329int QQuickShaderEffectSource::samples() const-
330{-
331 return
never executed: return m_samples;
m_samples;
never executed: return m_samples;
0
332}-
333-
334void QQuickShaderEffectSource::setSamples(int count)-
335{-
336 if (count == m_samples
count == m_samplesDescription
TRUEevaluated 80 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickitemlayer
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_examples
)
2-80
337 return;
executed 80 times by 2 tests: return;
Executed by:
  • tst_examples
  • tst_qquickitemlayer
80
338 m_samples = count;-
339 update();-
340 samplesChanged();-
341}
executed 2 times by 1 test: end of block
Executed by:
  • tst_examples
2
342void QQuickShaderEffectSource::scheduleUpdate()-
343{-
344 if (m_grab
m_grabDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
345 return;
never executed: return;
0
346 m_grab = true;-
347 update();-
348}
never executed: end of block
0
349-
350static void get_wrap_mode(QQuickShaderEffectSource::WrapMode mode, QSGTexture::WrapMode *hWrap, QSGTexture::WrapMode *vWrap)-
351{-
352 switch (mode) {-
353 case
never executed: case QQuickShaderEffectSource::RepeatHorizontally:
QQuickShaderEffectSource::RepeatHorizontally:
never executed: case QQuickShaderEffectSource::RepeatHorizontally:
0
354 *hWrap = QSGTexture::Repeat;-
355 *vWrap = QSGTexture::ClampToEdge;-
356 break;
never executed: break;
0
357 case
never executed: case QQuickShaderEffectSource::RepeatVertically:
QQuickShaderEffectSource::RepeatVertically:
never executed: case QQuickShaderEffectSource::RepeatVertically:
0
358 *vWrap = QSGTexture::Repeat;-
359 *hWrap = QSGTexture::ClampToEdge;-
360 break;
never executed: break;
0
361 case
never executed: case QQuickShaderEffectSource::Repeat:
QQuickShaderEffectSource::Repeat:
never executed: case QQuickShaderEffectSource::Repeat:
0
362 *hWrap = *vWrap = QSGTexture::Repeat;-
363 break;
never executed: break;
0
364 default
executed 240 times by 4 tests: default:
Executed by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
:
executed 240 times by 4 tests: default:
Executed by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
240
365-
366 *hWrap = *vWrap = QSGTexture::ClampToEdge;-
367 break;
executed 240 times by 4 tests: break;
Executed by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
240
368 }-
369}-
370-
371-
372void QQuickShaderEffectSource::releaseResources()-
373{-
374 if (m_texture
m_textureDescription
TRUEevaluated 91 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_examples
|| m_provider
m_providerDescription
TRUEnever evaluated
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_examples
) {
0-91
375 window()->scheduleRenderJob(new QQuickShaderEffectSourceCleanup(m_texture, m_provider),-
376 QQuickWindow::AfterSynchronizingStage);-
377 m_texture = nullptr;-
378 m_provider = nullptr;-
379 }
executed 91 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
91
380}
executed 101 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
101
381-
382class QQuickShaderSourceAttachedNode : public QObject, public QSGNode-
383{-
384 public:-
385#pragma GCC diagnostic push-
386 -
387#pragma GCC diagnostic ignored "-Wsuggest-override"-
388 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:-
389#pragma GCC diagnostic ignored "-Wattributes"-
390 __attribute__((visibility("hidden"))) static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **);-
391#pragma GCC diagnostic pop-
392 struct QPrivateSignal {};-
393public:-
394 void markTextureDirty() {-
395 QSGNode *pn = QSGNode::parent();-
396 if (pn
pnDescription
TRUEevaluated 52 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickitemlayer
FALSEnever evaluated
) {
0-52
397 ((pn->type() == QSGNode::GeometryNodeType) ? static_cast<void>(0) : qt_assert("pn->type() == QSGNode::GeometryNodeType", __FILE__, 677));-
398 pn->markDirty(DirtyMaterial);-
399 }
executed 52 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitemlayer
52
400 }
executed 52 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitemlayer
52
401};-
402-
403QSGNode *QQuickShaderEffectSource::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *)-
404{-
405 if (!m_sourceItem
!m_sourceItemDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickshadereffect
FALSEevaluated 183 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
|| m_sourceItem->width() <= 0
m_sourceItem->width() <= 0Description
TRUEnever evaluated
FALSEevaluated 183 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
|| m_sourceItem->height() <= 0
m_sourceItem->height() <= 0Description
TRUEnever evaluated
FALSEevaluated 183 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
) {
0-183
406 if (m_texture
m_textureDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickshadereffect
FALSEnever evaluated
)
0-4
407 m_texture->setItem(nullptr);
executed 4 times by 1 test: m_texture->setItem(nullptr);
Executed by:
  • tst_qquickshadereffect
4
408 delete oldNode;-
409 return
executed 4 times by 1 test: return nullptr;
Executed by:
  • tst_qquickshadereffect
nullptr;
executed 4 times by 1 test: return nullptr;
Executed by:
  • tst_qquickshadereffect
4
410 }-
411-
412 ensureTexture();-
413-
414 m_texture->setLive(m_live);-
415 m_texture->setItem(QQuickItemPrivate::get(m_sourceItem)->itemNode());-
416 QRectF sourceRect = m_sourceRect.width() == 0
m_sourceRect.width() == 0Description
TRUEevaluated 179 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickitemlayer
|| m_sourceRect.height() == 0
m_sourceRect.height() == 0Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickitemlayer
0-179
417 ? QRectF(0, 0, m_sourceItem->width(), m_sourceItem->height())-
418 : m_sourceRect;-
419 m_texture->setRect(sourceRect);-
420 QSize textureSize = m_textureSize.isEmpty()
m_textureSize.isEmpty()Description
TRUEevaluated 181 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_examples
2-181
421 ? QSize(qCeil(qAbs(sourceRect.width())), qCeil(qAbs(sourceRect.height())))-
422 : m_textureSize;-
423 ((!textureSize.isEmpty()) ? static_cast<void>(0) : qt_assert("!textureSize.isEmpty()", __FILE__, 703));-
424-
425 QQuickItemPrivate *d = static_cast<QQuickItemPrivate *>(QObjectPrivate::get(this));-
426-
427-
428 if (sourceItem()
sourceItem()Description
TRUEevaluated 183 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
FALSEnever evaluated
)
0-183
429 textureSize *= d->window->effectiveDevicePixelRatio();
executed 183 times by 4 tests: textureSize *= d->window->effectiveDevicePixelRatio();
Executed by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
183
430-
431 const QSize minTextureSize = d->sceneGraphContext()->minimumFBOSize();-
432-
433 while (textureSize.width() < minTextureSize.width()
textureSize.wi...reSize.width()Description
TRUEnever evaluated
FALSEevaluated 183 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
)
0-183
434 textureSize.rwidth() *= 2;
never executed: textureSize.rwidth() *= 2;
0
435 while (textureSize.height() < minTextureSize.height()
textureSize.he...eSize.height()Description
TRUEnever evaluated
FALSEevaluated 183 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
)
0-183
436 textureSize.rheight() *= 2;
never executed: textureSize.rheight() *= 2;
0
437-
438 m_texture->setDevicePixelRatio(d->window->effectiveDevicePixelRatio());-
439 m_texture->setSize(textureSize);-
440 m_texture->setRecursive(m_recursive);-
441 m_texture->setFormat(m_format);-
442 m_texture->setHasMipmaps(m_mipmap);-
443 m_texture->setMirrorHorizontal(m_textureMirroring & MirrorHorizontally);-
444 m_texture->setMirrorVertical(m_textureMirroring & MirrorVertically);-
445 m_texture->setSamples(m_samples);-
446-
447 if (m_grab
m_grabDescription
TRUEevaluated 101 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
FALSEevaluated 82 times by 3 tests
Evaluated by:
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
)
82-101
448 m_texture->scheduleUpdate();
executed 101 times by 4 tests: m_texture->scheduleUpdate();
Executed by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
101
449 m_grab = false;-
450-
451 QSGTexture::Filtering filtering = QQuickItemPrivate::get(this)->smooth
QQuickItemPriv...(this)->smoothDescription
TRUEevaluated 53 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
FALSEevaluated 130 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickitemlayer
53-130
452 ? QSGTexture::Linear-
453 : QSGTexture::Nearest;-
454 QSGTexture::Filtering mmFiltering = m_mipmap
m_mipmapDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickitemlayer
FALSEevaluated 179 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
? filtering : QSGTexture::None;
4-179
455 QSGTexture::WrapMode hWrap, vWrap;-
456 get_wrap_mode(m_wrapMode, &hWrap, &vWrap);-
457-
458 if (m_provider
m_providerDescription
TRUEevaluated 96 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
FALSEevaluated 87 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
) {
87-96
459 m_provider->mipmapFiltering = mmFiltering;-
460 m_provider->filtering = filtering;-
461 m_provider->horizontalWrap = hWrap;-
462 m_provider->verticalWrap = vWrap;-
463 }
executed 96 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
96
464-
465-
466 if (width() <= 0
width() <= 0Description
TRUEevaluated 63 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
FALSEevaluated 120 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickitemlayer
|| height() <= 0
height() <= 0Description
TRUEnever evaluated
FALSEevaluated 120 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickitemlayer
) {
0-120
467 delete oldNode;-
468 return
executed 63 times by 4 tests: return nullptr;
Executed by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
nullptr;
executed 63 times by 4 tests: return nullptr;
Executed by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
63
469 }-
470-
471 QSGInternalImageNode *node = static_cast<QSGInternalImageNode *>(oldNode);-
472 if (!node
!nodeDescription
TRUEevaluated 64 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickitemlayer
FALSEevaluated 56 times by 1 test
Evaluated by:
  • tst_qquickitemlayer
) {
56-64
473 node = d->sceneGraphContext()->createInternalImageNode();-
474 node->setFlag(QSGNode::UsePreprocess);-
475 node->setTexture(m_texture);-
476 QQuickShaderSourceAttachedNode *attached = new QQuickShaderSourceAttachedNode;-
477 node->appendChildNode(attached);-
478 connect(m_texture, qFlagLocation("2""updateRequested()" "\0" __FILE__ ":" "758"), attached, qFlagLocation("1""markTextureDirty()" "\0" __FILE__ ":" "758"));-
479 }
executed 64 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitemlayer
64
480-
481-
482 if (m_live
m_liveDescription
TRUEevaluated 120 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickitemlayer
FALSEnever evaluated
&& m_recursive
m_recursiveDescription
TRUEnever evaluated
FALSEevaluated 120 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickitemlayer
)
0-120
483 node->markDirty(QSGNode::DirtyMaterial);
never executed: node->markDirty(QSGNode::DirtyMaterial);
0
484-
485 node->setMipmapFiltering(mmFiltering);-
486 node->setFiltering(filtering);-
487 node->setHorizontalWrapMode(hWrap);-
488 node->setVerticalWrapMode(vWrap);-
489 node->setTargetRect(QRectF(0, 0, width(), height()));-
490 node->setInnerTargetRect(QRectF(0, 0, width(), height()));-
491 node->update();-
492-
493 return
executed 120 times by 2 tests: return node;
Executed by:
  • tst_examples
  • tst_qquickitemlayer
node;
executed 120 times by 2 tests: return node;
Executed by:
  • tst_examples
  • tst_qquickitemlayer
120
494}-
495-
496void QQuickShaderEffectSource::invalidateSceneGraph()-
497{-
498 if (m_texture
m_textureDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_examples
FALSEnever evaluated
)
0-8
499 delete m_texture;
executed 8 times by 1 test: delete m_texture;
Executed by:
  • tst_examples
8
500 if (m_provider
m_providerDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_examples
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_examples
)
2-6
501 delete m_provider;
executed 6 times by 1 test: delete m_provider;
Executed by:
  • tst_examples
6
502 m_texture = nullptr;-
503 m_provider = nullptr;-
504}
executed 8 times by 1 test: end of block
Executed by:
  • tst_examples
8
505-
506void QQuickShaderEffectSource::itemChange(ItemChange change, const ItemChangeData &value)-
507{-
508 if (change == QQuickItem::ItemSceneChange
change == QQui...temSceneChangeDescription
TRUEevaluated 204 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
FALSEevaluated 262 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
&& m_sourceItem
m_sourceItemDescription
TRUEevaluated 180 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
FALSEevaluated 24 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickitemlayer
  • tst_qquickshadereffect
) {
24-262
509-
510 if (value.window
value.windowDescription
TRUEevaluated 81 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
FALSEevaluated 99 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
)
81-99
511 QQuickItemPrivate::get(m_sourceItem)->refWindow(value.window);
executed 81 times by 4 tests: QQuickItemPrivate::get(m_sourceItem)->refWindow(value.window);
Executed by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
81
512 else-
513 QQuickItemPrivate::get(m_sourceItem)->derefWindow();
executed 99 times by 3 tests: QQuickItemPrivate::get(m_sourceItem)->derefWindow();
Executed by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
99
514 }-
515 QQuickItem::itemChange(change, value);-
516}
executed 466 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
466
517-
518-
519-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.0