From 416d79c3e6c62d6e82e5cf8cb2abfe4aaf93b273 Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Wed, 13 Jan 2016 22:42:31 +0100 Subject: RenderLoop: Remove the exhaust delay timer. This was replaced by a proper requestUpdate mechanism at the QWindow level, so it isn't needed anymore. See also: 72e889d12f9df162a22c39204c8333c5f4808da8 in qtdeclarative. Change-Id: Ie293c50321b13d06a2dd96a74be4edf31373bd51 Reviewed-by: Andy Nichols --- .../scenegraph/softwarecontext/renderloop.cpp | 24 +++------------------- .../scenegraph/softwarecontext/renderloop.h | 7 +------ 2 files changed, 4 insertions(+), 27 deletions(-) diff --git a/src/plugins/scenegraph/softwarecontext/renderloop.cpp b/src/plugins/scenegraph/softwarecontext/renderloop.cpp index eb90474263..0a10ffa339 100644 --- a/src/plugins/scenegraph/softwarecontext/renderloop.cpp +++ b/src/plugins/scenegraph/softwarecontext/renderloop.cpp @@ -38,7 +38,6 @@ #include RenderLoop::RenderLoop() - : eventPending(false) { sg = QSGContext::createDefaultContext(); rc = sg->createRenderContext(); @@ -193,12 +192,7 @@ void RenderLoop::maybeUpdate(QQuickWindow *window) return; m_windows[window].updatePending = true; - - if (!eventPending) { - const int exhaust_delay = 5; - m_update_timer = startTimer(exhaust_delay, Qt::PreciseTimer); - eventPending = true; - } + window->requestUpdate(); } QSurface::SurfaceType RenderLoop::windowSurfaceType() const @@ -214,19 +208,7 @@ QSGContext *RenderLoop::sceneGraphContext() const } -bool RenderLoop::event(QEvent *e) +void RenderLoop::handleUpdateRequest(QQuickWindow *window) { - if (e->type() == QEvent::Timer) { - eventPending = false; - killTimer(m_update_timer); - m_update_timer = 0; - for (QHash::const_iterator it = m_windows.constBegin(); - it != m_windows.constEnd(); ++it) { - const WindowData &data = it.value(); - if (data.updatePending) - renderWindow(it.key()); - } - return true; - } - return QObject::event(e); + renderWindow(window); } diff --git a/src/plugins/scenegraph/softwarecontext/renderloop.h b/src/plugins/scenegraph/softwarecontext/renderloop.h index 7d416ef8c9..6cdf7dab6f 100644 --- a/src/plugins/scenegraph/softwarecontext/renderloop.h +++ b/src/plugins/scenegraph/softwarecontext/renderloop.h @@ -50,6 +50,7 @@ public: void maybeUpdate(QQuickWindow *window); void update(QQuickWindow *window) { maybeUpdate(window); } // identical for this implementation. + void handleUpdateRequest(QQuickWindow *); void releaseResources(QQuickWindow *) { } @@ -60,8 +61,6 @@ public: QSGContext *sceneGraphContext() const; QSGRenderContext *createRenderContext(QSGContext *) const { return rc; } - bool event(QEvent *); - struct WindowData { bool updatePending : 1; bool grabOnly : 1; @@ -73,10 +72,6 @@ public: QSGRenderContext *rc; QImage grabContent; - int m_update_timer; - - bool eventPending; - }; #endif // RENDERLOOP_H -- cgit v1.2.3