diff options
author | Miikka Heikkinen <miikka.heikkinen@theqtcompany.com> | 2015-06-30 16:45:37 +0300 |
---|---|---|
committer | Miikka Heikkinen <miikka.heikkinen@theqtcompany.com> | 2015-07-01 11:31:07 +0000 |
commit | b4f7a8f1dad97d554210e254a907387dd43a76bd (patch) | |
tree | 7850d7979e9defc2fa72f3b929284e9b72586daf | |
parent | 44ed21d13964fc6aec0a13d0b82ccbbabd9aec86 (diff) |
Minor improvements to render loop
Removed unnecessary component completion check and added a couple
of missing emitNeedRenders.
Change-Id: I7b51fa2e608af9b9eb19733f9f3d9dff3fa507e0
Reviewed-by: Tomi Korpipää <tomi.korpipaa@theqtcompany.com>
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@theqtcompany.com>
-rw-r--r-- | src/imports/qtcanvas3d/canvas3d.cpp | 22 | ||||
-rw-r--r-- | tests/manual/commandthroughput/qml/commandthroughput/main.qml | 2 |
2 files changed, 9 insertions, 15 deletions
diff --git a/src/imports/qtcanvas3d/canvas3d.cpp b/src/imports/qtcanvas3d/canvas3d.cpp index e89aedc..b4a440e 100644 --- a/src/imports/qtcanvas3d/canvas3d.cpp +++ b/src/imports/qtcanvas3d/canvas3d.cpp @@ -301,10 +301,13 @@ Canvas::RenderTarget Canvas::renderTarget() const /*! * \qmlproperty bool Canvas3D::renderOnDemand - * Specifies whether or not the render loop runs constantly (\c{false}) or a new frame is rendered - * only when explicitly requested by the application (\c{true}). - * - * \sa requestRender() + * If the value is \c{false}, the render loop runs constantly and + * \l{Canvas3D::paintGL}{Canvas3D.paintGL()} signal is emitted once per frame. + * If the value is \c{true}, \l{Canvas3D::paintGL}{Canvas3D.paintGL()} is only emitted when + * Canvas3D content needs to be re-rendered because a geometry change or some other event + * affecting the Canvas3D content occurred. + * The application can also request a render using + * \l{Canvas3D::requestRender}{Canvas3D.requestRender()} method. */ void Canvas::setRenderOnDemand(bool enable) { @@ -714,6 +717,7 @@ QSGNode *Canvas::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data) Qt::DirectConnection); m_rendererReady = true; + emitNeedRender(); } sync(); @@ -754,15 +758,6 @@ void Canvas::queueNextRender() if (!m_rendererReady) { qCDebug(canvas3drendering).nospace() << "Canvas3D::" << __FUNCTION__ << " Renderer not ready, returning"; - requestRender(); - return; - } - - // Check that we're complete component before drawing - if (!isComponentComplete()) { - qCDebug(canvas3drendering).nospace() << "Canvas3D::" << __FUNCTION__ - << " Component is not complete, skipping drawing"; - requestRender(); return; } @@ -867,6 +862,7 @@ void Canvas::handleBeforeSynchronizing() if (firstSync()) { m_rendererReady = true; + emitNeedRender(); return; } diff --git a/tests/manual/commandthroughput/qml/commandthroughput/main.qml b/tests/manual/commandthroughput/qml/commandthroughput/main.qml index 699000e..385d563 100644 --- a/tests/manual/commandthroughput/qml/commandthroughput/main.qml +++ b/tests/manual/commandthroughput/qml/commandthroughput/main.qml @@ -98,8 +98,6 @@ Item { objAnimationZ.resume(); } } - - Component.onCompleted: requestRender() } RowLayout { |