OpenCoverage

qsgsoftwarerenderloop.cpp

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8QSGSoftwareRenderLoop::QSGSoftwareRenderLoop()-
9{-
10 sg = new QSGSoftwareContext();-
11 rc = sg->createRenderContext();-
12}
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquickshape
2
13-
14QSGSoftwareRenderLoop::~QSGSoftwareRenderLoop()-
15{-
16 delete rc;-
17 delete sg;-
18}
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquickshape
2
19-
20void QSGSoftwareRenderLoop::show(QQuickWindow *window)-
21{-
22 WindowData data;-
23 data.updatePending = false;-
24 data.grabOnly = false;-
25 m_windows[window] = data;-
26-
27 if (m_backingStores[window] == nullptr
m_backingStore...ow] == nullptrDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickshape
FALSEnever evaluated
) {
0-8
28 m_backingStores[window] = new QBackingStore(window);-
29 }
executed 8 times by 1 test: end of block
Executed by:
  • tst_qquickshape
8
30-
31 maybeUpdate(window);-
32}
executed 8 times by 1 test: end of block
Executed by:
  • tst_qquickshape
8
33-
34void QSGSoftwareRenderLoop::hide(QQuickWindow *window)-
35{-
36 QQuickWindowPrivate *cd = QQuickWindowPrivate::get(window);-
37 cd->fireAboutToStop();-
38}
executed 12 times by 1 test: end of block
Executed by:
  • tst_qquickshape
12
39-
40void QSGSoftwareRenderLoop::windowDestroyed(QQuickWindow *window)-
41{-
42 m_windows.remove(window);-
43 delete m_backingStores[window];-
44 m_backingStores.remove(window);-
45 hide(window);-
46-
47 QQuickWindowPrivate *d = QQuickWindowPrivate::get(window);-
48 d->cleanupNodesOnShutdown();-
49-
50 if (m_windows.size() == 0
m_windows.size() == 0Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquickshape
FALSEnever evaluated
) {
0-12
51 rc->invalidate();-
52 }
executed 12 times by 1 test: end of block
Executed by:
  • tst_qquickshape
12
53}
executed 12 times by 1 test: end of block
Executed by:
  • tst_qquickshape
12
54-
55void QSGSoftwareRenderLoop::renderWindow(QQuickWindow *window, bool isNewExpose)-
56{-
57 QQuickWindowPrivate *cd = QQuickWindowPrivate::get(window);-
58 if (!m_windows.contains(window)
!m_windows.contains(window)Description
TRUEnever evaluated
FALSEevaluated 24 times by 1 test
Evaluated by:
  • tst_qquickshape
)
0-24
59 return;
never executed: return;
0
60-
61 WindowData &data = const_cast<WindowData &>(m_windows[window]);-
62-
63-
64 if (!data.grabOnly
!data.grabOnlyDescription
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquickshape
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickshape
&& !cd->isRenderable()
!cd->isRenderable()Description
TRUEnever evaluated
FALSEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquickshape
)
0-16
65 return;
never executed: return;
0
66-
67-
68 if (m_backingStores[window]->size() != window->size()
m_backingStore...window->size()Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickshape
FALSEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquickshape
) {
8-16
69 m_backingStores[window]->resize(window->size());-
70 }
executed 8 times by 1 test: end of block
Executed by:
  • tst_qquickshape
8
71-
72-
73 QSGSoftwareRenderContext *ctx = static_cast<QSGSoftwareRenderContext*>(cd->context);-
74 ctx->initializeIfNeeded();-
75-
76 bool alsoSwap = data.updatePending;-
77 data.updatePending = false;-
78-
79 if (!data.grabOnly
!data.grabOnlyDescription
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquickshape
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickshape
) {
8-16
80 cd->flushFrameSynchronousEvents();-
81-
82 if (!m_windows.contains(window)
!m_windows.contains(window)Description
TRUEnever evaluated
FALSEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquickshape
)
0-16
83 return;
never executed: return;
0
84 }
executed 16 times by 1 test: end of block
Executed by:
  • tst_qquickshape
16
85 QElapsedTimer renderTimer;-
86 qint64 renderTime = 0, syncTime = 0, polishTime = 0;-
87 bool profileFrames = QSG_RASTER_LOG_TIME_RENDERLOOP().isDebugEnabled();-
88 if (profileFrames
profileFramesDescription
TRUEnever evaluated
FALSEevaluated 24 times by 1 test
Evaluated by:
  • tst_qquickshape
)
0-24
89 renderTimer.start();
never executed: renderTimer.start();
0
90 if (QQuickProfiler::featuresEnabled & (1 << QQuickProfiler::ProfileSceneGraph)
QQuickProfiler...ileSceneGraph)Description
TRUEnever evaluated
FALSEevaluated 24 times by 1 test
Evaluated by:
  • tst_qquickshape
) { (QQuickProfiler::startSceneGraphFrame<QQuickProfiler::SceneGraphPolishFrame>()); }
never executed: end of block
else (
executed 24 times by 1 test: (void)0;
Executed by:
  • tst_qquickshape
void)0;
executed 24 times by 1 test: (void)0;
Executed by:
  • tst_qquickshape
0-24
91-
92 cd->polishItems();-
93-
94 if (profileFrames
profileFramesDescription
TRUEnever evaluated
FALSEevaluated 24 times by 1 test
Evaluated by:
  • tst_qquickshape
)
0-24
95 polishTime = renderTimer.nsecsElapsed();
never executed: polishTime = renderTimer.nsecsElapsed();
0
96 if (QQuickProfiler::featuresEnabled & (1 << QQuickProfiler::ProfileSceneGraph)
QQuickProfiler...ileSceneGraph)Description
TRUEnever evaluated
FALSEevaluated 24 times by 1 test
Evaluated by:
  • tst_qquickshape
) { (QQuickProfiler::reportSceneGraphFrame<QQuickProfiler::SceneGraphPolishFrame, true, QQuickProfiler::SceneGraphRenderLoopFrame>( QQuickProfiler::SceneGraphPolishPolish)); }
never executed: end of block
else (
executed 24 times by 1 test: (void)0 ;
Executed by:
  • tst_qquickshape
void)0
executed 24 times by 1 test: (void)0 ;
Executed by:
  • tst_qquickshape
0-24
9724
98 ;
executed 24 times by 1 test: (void)0 ;
Executed by:
  • tst_qquickshape
24
99-
100 window->afterAnimating();-
101-
102 cd->syncSceneGraph();-
103 rc->endSync();-
104-
105 if (profileFrames
profileFramesDescription
TRUEnever evaluated
FALSEevaluated 24 times by 1 test
Evaluated by:
  • tst_qquickshape
)
0-24
106 syncTime = renderTimer.nsecsElapsed();
never executed: syncTime = renderTimer.nsecsElapsed();
0
107 if (QQuickProfiler::featuresEnabled & (1 << QQuickProfiler::ProfileSceneGraph)
QQuickProfiler...ileSceneGraph)Description
TRUEnever evaluated
FALSEevaluated 24 times by 1 test
Evaluated by:
  • tst_qquickshape
) { (QQuickProfiler::recordSceneGraphTimestamp<QQuickProfiler::SceneGraphRenderLoopFrame>(QQuickProfiler::SceneGraphRenderLoopSync)); }
never executed: end of block
else (
executed 24 times by 1 test: (void)0 ;
Executed by:
  • tst_qquickshape
void)0
executed 24 times by 1 test: (void)0 ;
Executed by:
  • tst_qquickshape
0-24
108 ;
executed 24 times by 1 test: (void)0 ;
Executed by:
  • tst_qquickshape
24
109-
110-
111 auto softwareRenderer = static_cast<QSGSoftwareRenderer*>(cd->renderer);-
112 if (softwareRenderer
softwareRendererDescription
TRUEevaluated 24 times by 1 test
Evaluated by:
  • tst_qquickshape
FALSEnever evaluated
)
0-24
113 softwareRenderer->setBackingStore(m_backingStores[window]);
executed 24 times by 1 test: softwareRenderer->setBackingStore(m_backingStores[window]);
Executed by:
  • tst_qquickshape
24
114-
115 cd->renderSceneGraph(window->size());-
116-
117 if (profileFrames
profileFramesDescription
TRUEnever evaluated
FALSEevaluated 24 times by 1 test
Evaluated by:
  • tst_qquickshape
)
0-24
118 renderTime = renderTimer.nsecsElapsed();
never executed: renderTime = renderTimer.nsecsElapsed();
0
119 if (QQuickProfiler::featuresEnabled & (1 << QQuickProfiler::ProfileSceneGraph)
QQuickProfiler...ileSceneGraph)Description
TRUEnever evaluated
FALSEevaluated 24 times by 1 test
Evaluated by:
  • tst_qquickshape
) { (QQuickProfiler::recordSceneGraphTimestamp<QQuickProfiler::SceneGraphRenderLoopFrame>(QQuickProfiler::SceneGraphRenderLoopRender)); }
never executed: end of block
else (
executed 24 times by 1 test: (void)0 ;
Executed by:
  • tst_qquickshape
void)0
executed 24 times by 1 test: (void)0 ;
Executed by:
  • tst_qquickshape
0-24
120 ;
executed 24 times by 1 test: (void)0 ;
Executed by:
  • tst_qquickshape
24
121-
122 if (data.grabOnly
data.grabOnlyDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickshape
FALSEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquickshape
) {
8-16
123 grabContent = m_backingStores[window]->handle()->toImage();-
124 data.grabOnly = false;-
125 }
executed 8 times by 1 test: end of block
Executed by:
  • tst_qquickshape
8
126-
127 if (alsoSwap
alsoSwapDescription
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquickshape
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickshape
&& window->isVisible()
window->isVisible()Description
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquickshape
FALSEnever evaluated
) {
0-16
128-
129 if (!isNewExpose
!isNewExposeDescription
TRUEnever evaluated
FALSEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquickshape
)
0-16
130 m_backingStores[window]->flush(softwareRenderer->flushRegion());
never executed: m_backingStores[window]->flush(softwareRenderer->flushRegion());
0
131 else-
132 m_backingStores[window]->flush(QRegion(QRect(QPoint(0,0), window->size())));
executed 16 times by 1 test: m_backingStores[window]->flush(QRegion(QRect(QPoint(0,0), window->size())));
Executed by:
  • tst_qquickshape
16
133 cd->fireFrameSwapped();-
134 }
executed 16 times by 1 test: end of block
Executed by:
  • tst_qquickshape
16
135-
136 qint64 swapTime = 0;-
137 if (profileFrames
profileFramesDescription
TRUEnever evaluated
FALSEevaluated 24 times by 1 test
Evaluated by:
  • tst_qquickshape
)
0-24
138 swapTime = renderTimer.nsecsElapsed();
never executed: swapTime = renderTimer.nsecsElapsed();
0
139 if (QQuickProfiler::featuresEnabled & (1 << QQuickProfiler::ProfileSceneGraph)
QQuickProfiler...ileSceneGraph)Description
TRUEnever evaluated
FALSEevaluated 24 times by 1 test
Evaluated by:
  • tst_qquickshape
) { (QQuickProfiler::reportSceneGraphFrame<QQuickProfiler::SceneGraphRenderLoopFrame, true>(QQuickProfiler::SceneGraphRenderLoopSwap)); }
never executed: end of block
else (
executed 24 times by 1 test: (void)0 ;
Executed by:
  • tst_qquickshape
void)0
executed 24 times by 1 test: (void)0 ;
Executed by:
  • tst_qquickshape
0-24
140 ;
executed 24 times by 1 test: (void)0 ;
Executed by:
  • tst_qquickshape
24
141-
142 if (QSG_RASTER_LOG_TIME_RENDERLOOP().isDebugEnabled()
QSG_RASTER_LOG...DebugEnabled()Description
TRUEnever evaluated
FALSEevaluated 24 times by 1 test
Evaluated by:
  • tst_qquickshape
) {
0-24
143 static QTime lastFrameTime = QTime::currentTime();-
144 for (bool qt_category_enabled = QSG_RASTER_LOG_TIME_RENDERLOOP().isDebugEnabled(); qt_category_enabled
qt_category_enabledDescription
TRUEnever evaluated
FALSEnever evaluated
; qt_category_enabled = false) QMessageLogger(
never executed: QMessageLogger( __FILE__ , 199 , __PRETTY_FUNCTION__, QSG_RASTER_LOG_TIME_RENDERLOOP().categoryName()).debug("Frame rendered with 'software' renderloop in %dms, polish=%d, sync=%d, render=%d, swap=%d, frameDelta=%d", int(swapTime / 1000000), int(polishTime / 1000000), int((syncTime - polishTime) / 1000000), int((renderTime - syncTime) / 1000000), int((swapTime - renderTime) / 1000000), int(lastFrameTime.msecsTo(QTime::currentTime()))) ;
0
1450
1460
1470
1480
1490
1500
151 __FILE__
never executed: QMessageLogger( __FILE__ , 199 , __PRETTY_FUNCTION__, QSG_RASTER_LOG_TIME_RENDERLOOP().categoryName()).debug("Frame rendered with 'software' renderloop in %dms, polish=%d, sync=%d, render=%d, swap=%d, frameDelta=%d", int(swapTime / 1000000), int(polishTime / 1000000), int((syncTime - polishTime) / 1000000), int((renderTime - syncTime) / 1000000), int((swapTime - renderTime) / 1000000), int(lastFrameTime.msecsTo(QTime::currentTime()))) ;
0
152 ,
never executed: QMessageLogger( __FILE__ , 199 , __PRETTY_FUNCTION__, QSG_RASTER_LOG_TIME_RENDERLOOP().categoryName()).debug("Frame rendered with 'software' renderloop in %dms, polish=%d, sync=%d, render=%d, swap=%d, frameDelta=%d", int(swapTime / 1000000), int(polishTime / 1000000), int((syncTime - polishTime) / 1000000), int((renderTime - syncTime) / 1000000), int((swapTime - renderTime) / 1000000), int(lastFrameTime.msecsTo(QTime::currentTime()))) ;
0
1530
1540
1550
1560
1570
1580
159 199
never executed: QMessageLogger( __FILE__ , 199 , __PRETTY_FUNCTION__, QSG_RASTER_LOG_TIME_RENDERLOOP().categoryName()).debug("Frame rendered with 'software' renderloop in %dms, polish=%d, sync=%d, render=%d, swap=%d, frameDelta=%d", int(swapTime / 1000000), int(polishTime / 1000000), int((syncTime - polishTime) / 1000000), int((renderTime - syncTime) / 1000000), int((swapTime - renderTime) / 1000000), int(lastFrameTime.msecsTo(QTime::currentTime()))) ;
0
160 , __PRETTY_FUNCTION__, QSG_RASTER_LOG_TIME_RENDERLOOP().categoryName()).debug("Frame rendered with 'software' renderloop in %dms, polish=%d, sync=%d, render=%d, swap=%d, frameDelta=%d", int(swapTime / 1000000), int(polishTime / 1000000), int((syncTime - polishTime) / 1000000), int((renderTime - syncTime) / 1000000), int((swapTime - renderTime) / 1000000), int(lastFrameTime.msecsTo(QTime::currentTime())))
never executed: QMessageLogger( __FILE__ , 199 , __PRETTY_FUNCTION__, QSG_RASTER_LOG_TIME_RENDERLOOP().categoryName()).debug("Frame rendered with 'software' renderloop in %dms, polish=%d, sync=%d, render=%d, swap=%d, frameDelta=%d", int(swapTime / 1000000), int(polishTime / 1000000), int((syncTime - polishTime) / 1000000), int((renderTime - syncTime) / 1000000), int((swapTime - renderTime) / 1000000), int(lastFrameTime.msecsTo(QTime::currentTime()))) ;
0
1610
1620
1630
1640
1650
1660
167 ;
never executed: QMessageLogger( __FILE__ , 199 , __PRETTY_FUNCTION__, QSG_RASTER_LOG_TIME_RENDERLOOP().categoryName()).debug("Frame rendered with 'software' renderloop in %dms, polish=%d, sync=%d, render=%d, swap=%d, frameDelta=%d", int(swapTime / 1000000), int(polishTime / 1000000), int((syncTime - polishTime) / 1000000), int((renderTime - syncTime) / 1000000), int((swapTime - renderTime) / 1000000), int(lastFrameTime.msecsTo(QTime::currentTime()))) ;
0
168 lastFrameTime = QTime::currentTime();-
169 }
never executed: end of block
0
170-
171-
172 if (data.updatePending
data.updatePendingDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickshape
FALSEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquickshape
)
8-16
173 maybeUpdate(window);
executed 8 times by 1 test: maybeUpdate(window);
Executed by:
  • tst_qquickshape
8
174}
executed 24 times by 1 test: end of block
Executed by:
  • tst_qquickshape
24
175-
176void QSGSoftwareRenderLoop::exposureChanged(QQuickWindow *window)-
177{-
178 if (window->isExposed()
window->isExposed()Description
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquickshape
FALSEnever evaluated
) {
0-16
179 m_windows[window].updatePending = true;-
180 renderWindow(window, true);-
181 }
executed 16 times by 1 test: end of block
Executed by:
  • tst_qquickshape
16
182}
executed 16 times by 1 test: end of block
Executed by:
  • tst_qquickshape
16
183-
184QImage QSGSoftwareRenderLoop::grab(QQuickWindow *window)-
185{-
186-
187 if (!m_backingStores.contains(window)
!m_backingStor...ntains(window)Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickshape
) {
0-8
188 m_backingStores[window] = new QBackingStore(window);-
189-
190 window->create();-
191 }
never executed: end of block
0
192-
193-
194 if (!m_windows.contains(window)
!m_windows.contains(window)Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickshape
) {
0-8
195 WindowData data;-
196 data.updatePending = false;-
197 m_windows[window] = data;-
198 }
never executed: end of block
0
199-
200 m_windows[window].grabOnly = true;-
201-
202 renderWindow(window);-
203-
204 QImage grabbed = grabContent;-
205 grabbed.detach();-
206 grabContent = QImage();-
207 return
executed 8 times by 1 test: return grabbed;
Executed by:
  • tst_qquickshape
grabbed;
executed 8 times by 1 test: return grabbed;
Executed by:
  • tst_qquickshape
8
208}-
209-
210-
211-
212void QSGSoftwareRenderLoop::maybeUpdate(QQuickWindow *window)-
213{-
214 if (!m_windows.contains(window)
!m_windows.contains(window)Description
TRUEevaluated 92 times by 1 test
Evaluated by:
  • tst_qquickshape
FALSEevaluated 64 times by 1 test
Evaluated by:
  • tst_qquickshape
)
64-92
215 return;
executed 92 times by 1 test: return;
Executed by:
  • tst_qquickshape
92
216-
217 m_windows[window].updatePending = true;-
218 window->requestUpdate();-
219}
executed 64 times by 1 test: end of block
Executed by:
  • tst_qquickshape
64
220-
221QSurface::SurfaceType QSGSoftwareRenderLoop::windowSurfaceType() const-
222{-
223 return
executed 12 times by 1 test: return QSurface::RasterSurface;
Executed by:
  • tst_qquickshape
QSurface::RasterSurface;
executed 12 times by 1 test: return QSurface::RasterSurface;
Executed by:
  • tst_qquickshape
12
224}-
225-
226-
227-
228QSGContext *QSGSoftwareRenderLoop::sceneGraphContext() const-
229{-
230 return
executed 12 times by 1 test: return sg;
Executed by:
  • tst_qquickshape
sg;
executed 12 times by 1 test: return sg;
Executed by:
  • tst_qquickshape
12
231}-
232-
233-
234void QSGSoftwareRenderLoop::handleUpdateRequest(QQuickWindow *window)-
235{-
236 renderWindow(window);-
237}
never executed: end of block
0
238-
239-
240-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.0