diff options
Diffstat (limited to 'src/quick/scenegraph/qsgrenderloop.cpp')
-rw-r--r-- | src/quick/scenegraph/qsgrenderloop.cpp | 69 |
1 files changed, 24 insertions, 45 deletions
diff --git a/src/quick/scenegraph/qsgrenderloop.cpp b/src/quick/scenegraph/qsgrenderloop.cpp index 68947d3a3c..b5f149eff7 100644 --- a/src/quick/scenegraph/qsgrenderloop.cpp +++ b/src/quick/scenegraph/qsgrenderloop.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtQuick module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** @@ -136,6 +142,7 @@ public: void maybeUpdate(QQuickWindow *window); void update(QQuickWindow *window) { maybeUpdate(window); } // identical for this implementation. + void handleUpdateRequest(QQuickWindow *); void releaseResources(QQuickWindow *) { } @@ -144,8 +151,6 @@ public: QSGContext *sceneGraphContext() const; QSGRenderContext *createRenderContext(QSGContext *) const { return rc; } - bool event(QEvent *); - struct WindowData { bool updatePending : 1; bool grabOnly : 1; @@ -158,9 +163,6 @@ public: QSGRenderContext *rc; QImage grabContent; - int m_update_timer; - - bool eventPending; }; QSGRenderLoop *QSGRenderLoop::instance() @@ -264,7 +266,6 @@ void QSGRenderLoop::handleContextCreationFailure(QQuickWindow *window, QSGGuiThreadRenderLoop::QSGGuiThreadRenderLoop() : gl(0) - , eventPending(false) { sg = QSGContext::createDefaultContext(); rc = sg->createRenderContext(); @@ -456,45 +457,23 @@ QImage QSGGuiThreadRenderLoop::grab(QQuickWindow *window) return grabbed; } - - void QSGGuiThreadRenderLoop::maybeUpdate(QQuickWindow *window) { if (!m_windows.contains(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(); } - - QSGContext *QSGGuiThreadRenderLoop::sceneGraphContext() const { return sg; } - -bool QSGGuiThreadRenderLoop::event(QEvent *e) +void QSGGuiThreadRenderLoop::handleUpdateRequest(QQuickWindow *window) { - if (e->type() == QEvent::Timer) { - eventPending = false; - killTimer(m_update_timer); - m_update_timer = 0; - for (QHash<QQuickWindow *, WindowData>::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); } #include "qsgrenderloop.moc" |