OpenCoverage

qquickrendercontrol.cpp

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/items/qquickrendercontrol.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8-
9-
10-
11-
12extern __attribute__((visibility("default"))) QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_format, bool include_alpha);-
13QSGContext *QQuickRenderControlPrivate::sg = nullptr;-
14-
15QQuickRenderControlPrivate::QQuickRenderControlPrivate()-
16 : initialized(0),-
17 window(nullptr)-
18{-
19 if (!sg
!sgDescription
TRUEevaluated 4 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
FALSEevaluated 114 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
) {
4-114
20 qAddPostRoutine(cleanup);-
21 sg = QSGContext::createDefaultContext();-
22 }
executed 4 times by 2 tests: end of block
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
4
23 rc = sg->createRenderContext();-
24}
executed 118 times by 2 tests: end of block
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
118
25-
26void QQuickRenderControlPrivate::cleanup()-
27{-
28 delete sg;-
29 sg = nullptr;-
30}
executed 4 times by 2 tests: end of block
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
4
31-
32-
33-
34-
35-
36QQuickRenderControl::QQuickRenderControl(QObject *parent)-
37 : QObject(*(new QQuickRenderControlPrivate), parent)-
38{-
39}
executed 118 times by 2 tests: end of block
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
118
40-
41-
42-
43-
44-
45-
46QQuickRenderControl::~QQuickRenderControl()-
47{-
48 QQuickRenderControlPrivate * const d = d_func();-
49-
50 invalidate();-
51-
52 if (d->window
d->windowDescription
TRUEevaluated 118 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
FALSEnever evaluated
)
0-118
53 QQuickWindowPrivate::get(d->window)->renderControl = nullptr;
executed 118 times by 2 tests: QQuickWindowPrivate::get(d->window)->renderControl = nullptr;
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
118
54-
55-
56-
57-
58 d->windowDestroyed();-
59-
60 delete d->rc;-
61}
executed 118 times by 2 tests: end of block
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
118
62-
63void QQuickRenderControlPrivate::windowDestroyed()-
64{-
65 if (window
windowDescription
TRUEevaluated 118 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
FALSEnever evaluated
) {
0-118
66 rc->invalidate();-
67-
68 delete QQuickWindowPrivate::get(window)->animationController;-
69 QQuickWindowPrivate::get(window)->animationController = nullptr;-
70-
71-
72 QQuickOpenGLShaderEffectMaterial::cleanupMaterialCache();-
73-
74-
75 window = nullptr;-
76 }
executed 118 times by 2 tests: end of block
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
118
77}
executed 118 times by 2 tests: end of block
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
118
78void QQuickRenderControl::prepareThread(QThread *targetThread)-
79{-
80 QQuickRenderControlPrivate * const d = d_func();-
81 d->rc->moveToThread(targetThread);-
82 QQuickWindowPrivate::get(d->window)->animationController->moveToThread(targetThread);-
83}
never executed: end of block
0
84void QQuickRenderControl::initialize(QOpenGLContext *gl)-
85{-
86-
87 QQuickRenderControlPrivate * const d = d_func();-
88-
89 if (!d->window
!d->windowDescription
TRUEnever evaluated
FALSEevaluated 112 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
) {
0-112
90 QMessageLogger(__FILE__, 231, __PRETTY_FUNCTION__).warning("QQuickRenderControl::initialize called with no associated window");-
91 return;
never executed: return;
0
92 }-
93-
94 if (QOpenGLContext::currentContext() != gl
QOpenGLContext...ontext() != glDescription
TRUEnever evaluated
FALSEevaluated 112 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
) {
0-112
95 QMessageLogger(__FILE__, 236, __PRETTY_FUNCTION__).warning("QQuickRenderControl::initialize called with incorrect current context");-
96 return;
never executed: return;
0
97 }-
98-
99-
100-
101-
102-
103 d->rc->initialize(gl);-
104-
105-
106-
107 d->initialized = true;-
108}
executed 112 times by 2 tests: end of block
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
112
109-
110-
111-
112-
113-
114-
115void QQuickRenderControl::polishItems()-
116{-
117 QQuickRenderControlPrivate * const d = d_func();-
118 if (!d->window
!d->windowDescription
TRUEnever evaluated
FALSEevaluated 324 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
)
0-324
119 return;
never executed: return;
0
120-
121 QQuickWindowPrivate *cd = QQuickWindowPrivate::get(d->window);-
122 cd->flushFrameSynchronousEvents();-
123 if (!d->window
!d->windowDescription
TRUEnever evaluated
FALSEevaluated 324 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
)
0-324
124 return;
never executed: return;
0
125 cd->polishItems();-
126}
executed 324 times by 2 tests: end of block
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
324
127bool QQuickRenderControl::sync()-
128{-
129 QQuickRenderControlPrivate * const d = d_func();-
130 if (!d->window
!d->windowDescription
TRUEnever evaluated
FALSEevaluated 324 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
)
0-324
131 return
never executed: return false;
false;
never executed: return false;
0
132-
133 QQuickWindowPrivate *cd = QQuickWindowPrivate::get(d->window);-
134 cd->syncSceneGraph();-
135 d->rc->endSync();-
136-
137-
138 return
executed 324 times by 2 tests: return true;
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
true;
executed 324 times by 2 tests: return true;
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
324
139}-
140void QQuickRenderControl::invalidate()-
141{-
142 QQuickRenderControlPrivate * const d = d_func();-
143 if (!d->initialized
!d->initializedDescription
TRUEevaluated 118 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
FALSEevaluated 112 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
)
112-118
144 return;
executed 118 times by 2 tests: return;
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
118
145-
146 if (!d->window
!d->windowDescription
TRUEnever evaluated
FALSEevaluated 112 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
)
0-112
147 return;
never executed: return;
0
148-
149 QQuickWindowPrivate *cd = QQuickWindowPrivate::get(d->window);-
150 cd->fireAboutToStop();-
151 cd->cleanupNodesOnShutdown();-
152-
153-
154-
155-
156 d->rc->invalidate();-
157-
158 d->initialized = false;-
159}
executed 112 times by 2 tests: end of block
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
112
160-
161-
162-
163-
164void QQuickRenderControl::render()-
165{-
166 QQuickRenderControlPrivate * const d = d_func();-
167 if (!d->window
!d->windowDescription
TRUEnever evaluated
FALSEevaluated 336 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
)
0-336
168 return;
never executed: return;
0
169-
170 QQuickWindowPrivate *cd = QQuickWindowPrivate::get(d->window);-
171 cd->renderSceneGraph(d->window->size());-
172}
executed 336 times by 2 tests: end of block
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
336
173QImage QQuickRenderControl::grab()-
174{-
175 QQuickRenderControlPrivate * const d = d_func();-
176 if (!d->window
!d->windowDescription
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickwidget
)
0-8
177 return
never executed: return QImage();
QImage();
never executed: return QImage();
0
178-
179 QImage grabContent;-
180-
181 if (d->window->rendererInterface()->graphicsApi() == QSGRendererInterface::OpenGL
d->window->ren...erface::OpenGLDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickwidget
FALSEnever evaluated
) {
0-8
182-
183 QQuickWindowPrivate *cd = QQuickWindowPrivate::get(d->window);-
184 cd->polishItems();-
185 cd->syncSceneGraph();-
186 d->rc->endSync();-
187 render();-
188 grabContent = qt_gl_read_framebuffer(d->window->size() * d->window->effectiveDevicePixelRatio(), false, false);-
189 if (QQuickRenderControl::renderWindowFor(d->window)
QQuickRenderCo...For(d->window)Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickwidget
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickwidget
) {
4
190 grabContent.setDevicePixelRatio(d->window->effectiveDevicePixelRatio());-
191 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquickwidget
4
192-
193 }
executed 8 times by 1 test: end of block
Executed by:
  • tst_qquickwidget
else if (d->window->rendererInterface()->graphicsApi() == QSGRendererInterface::Software
d->window->ren...face::SoftwareDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0-8
194 QQuickWindowPrivate *cd = QQuickWindowPrivate::get(d->window);-
195 cd->polishItems();-
196 cd->syncSceneGraph();-
197 QSGSoftwareRenderer *softwareRenderer = static_cast<QSGSoftwareRenderer *>(cd->renderer);-
198 if (softwareRenderer
softwareRendererDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
199 const qreal dpr = d->window->effectiveDevicePixelRatio();-
200 const QSize imageSize = d->window->size() * dpr;-
201 grabContent = QImage(imageSize, QImage::Format_ARGB32_Premultiplied);-
202 grabContent.setDevicePixelRatio(dpr);-
203 QPaintDevice *prevDev = softwareRenderer->currentPaintDevice();-
204 softwareRenderer->setCurrentPaintDevice(&grabContent);-
205 softwareRenderer->markDirty();-
206 d->rc->endSync();-
207 render();-
208 softwareRenderer->setCurrentPaintDevice(prevDev);-
209 }
never executed: end of block
0
210 }
never executed: end of block
else {
0
211 QMessageLogger(__FILE__, 411, __PRETTY_FUNCTION__).warning("QQuickRenderControl: grabs are not supported with the current Qt Quick backend");-
212 }
never executed: end of block
0
213-
214 return
executed 8 times by 1 test: return grabContent;
Executed by:
  • tst_qquickwidget
grabContent;
executed 8 times by 1 test: return grabContent;
Executed by:
  • tst_qquickwidget
8
215}-
216-
217void QQuickRenderControlPrivate::update()-
218{-
219 QQuickRenderControl * const q = q_func();-
220 q->renderRequested();-
221}
never executed: end of block
0
222-
223void QQuickRenderControlPrivate::maybeUpdate()-
224{-
225 QQuickRenderControl * const q = q_func();-
226 q->sceneChanged();-
227}
executed 1290 times by 2 tests: end of block
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
1290
228QWindow *QQuickRenderControl::renderWindowFor(QQuickWindow *win, QPoint *offset)-
229{-
230 if (!win
!winDescription
TRUEnever evaluated
FALSEevaluated 55655 times by 77 tests
Evaluated by:
  • tst_drawingmodes
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_qqmlcomponent
  • tst_qqmltypeloader
  • tst_qquickaccessible
  • tst_qquickage
  • tst_qquickangleddirection
  • tst_qquickanimatedimage
  • tst_qquickanimatedsprite
  • tst_qquickanimationcontroller
  • tst_qquickanimations
  • tst_qquickborderimage
  • tst_qquickcumulativedirection
  • tst_qquickcustomaffector
  • tst_qquickcustomparticle
  • tst_qquickdraghandler
  • tst_qquickellipseextruder
  • tst_qquickflickable
  • tst_qquickfocusscope
  • tst_qquickfontloader
  • tst_qquickfontloader_static
  • tst_qquickframebufferobject
  • tst_qquickfriction
  • ...
)
0-55655
231 return
never executed: return nullptr;
nullptr;
never executed: return nullptr;
0
232 QQuickRenderControl *rc = QQuickWindowPrivate::get(win)->renderControl;-
233 if (rc
rcDescription
TRUEevaluated 694 times by 2 tests
Evaluated by:
  • tst_qquickshortcut
  • tst_qquickwidget
FALSEevaluated 54961 times by 76 tests
Evaluated by:
  • tst_drawingmodes
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_qqmlcomponent
  • tst_qqmltypeloader
  • tst_qquickaccessible
  • tst_qquickage
  • tst_qquickangleddirection
  • tst_qquickanimatedimage
  • tst_qquickanimatedsprite
  • tst_qquickanimationcontroller
  • tst_qquickanimations
  • tst_qquickborderimage
  • tst_qquickcumulativedirection
  • tst_qquickcustomaffector
  • tst_qquickcustomparticle
  • tst_qquickdraghandler
  • tst_qquickellipseextruder
  • tst_qquickflickable
  • tst_qquickfocusscope
  • tst_qquickfontloader
  • tst_qquickfontloader_static
  • tst_qquickframebufferobject
  • tst_qquickfriction
  • ...
)
694-54961
234 return
executed 694 times by 2 tests: return rc->renderWindow(offset);
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
rc->renderWindow(offset);
executed 694 times by 2 tests: return rc->renderWindow(offset);
Executed by:
  • tst_qquickshortcut
  • tst_qquickwidget
694
235 return
executed 54961 times by 76 tests: return nullptr;
Executed by:
  • tst_drawingmodes
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_qqmlcomponent
  • tst_qqmltypeloader
  • tst_qquickaccessible
  • tst_qquickage
  • tst_qquickangleddirection
  • tst_qquickanimatedimage
  • tst_qquickanimatedsprite
  • tst_qquickanimationcontroller
  • tst_qquickanimations
  • tst_qquickborderimage
  • tst_qquickcumulativedirection
  • tst_qquickcustomaffector
  • tst_qquickcustomparticle
  • tst_qquickdraghandler
  • tst_qquickellipseextruder
  • tst_qquickflickable
  • tst_qquickfocusscope
  • tst_qquickfontloader
  • tst_qquickfontloader_static
  • tst_qquickframebufferobject
  • tst_qquickfriction
  • ...
nullptr;
executed 54961 times by 76 tests: return nullptr;
Executed by:
  • tst_drawingmodes
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_qqmlcomponent
  • tst_qqmltypeloader
  • tst_qquickaccessible
  • tst_qquickage
  • tst_qquickangleddirection
  • tst_qquickanimatedimage
  • tst_qquickanimatedsprite
  • tst_qquickanimationcontroller
  • tst_qquickanimations
  • tst_qquickborderimage
  • tst_qquickcumulativedirection
  • tst_qquickcustomaffector
  • tst_qquickcustomparticle
  • tst_qquickdraghandler
  • tst_qquickellipseextruder
  • tst_qquickflickable
  • tst_qquickfocusscope
  • tst_qquickfontloader
  • tst_qquickfontloader_static
  • tst_qquickframebufferobject
  • tst_qquickfriction
  • ...
54961
236}-
237-
238-
239-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.0