From 909d3a57dfc279d8a8dee0751bf7635551d6ee3b Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Tue, 16 Apr 2013 10:51:31 +0200 Subject: [PATCH] Remove dead code. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The renderWithoutShowing was a piece of functionality that we experimented on long ago and it never quite worked and has it currently only adds bloat. It would be sensible to be able to render a window without showing it on screen, such as for testing purposes, but then it should be done through proper public API and thouroughly supported cross platform. Change-Id: I6bea7335f769c038a8167bad77c2dba171359be9 Reviewed-by: Yoann Lopes Reviewed-by: Samuel Rødal --- src/quick/items/qquickwindow.cpp | 34 +------------------------------ src/quick/items/qquickwindow_p.h | 3 -- src/quick/scenegraph/qsgrenderloop.cpp | 32 +++-------------------------- 3 files changed, 6 insertions(+), 63 deletions(-) diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index 97a2576..494ad1e 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -258,29 +258,6 @@ void QQuickWindowPrivate::polishItems() updateFocusItemTransform(); } -/** - * This parameter enables that this window can be rendered without - * being shown on screen. This feature is very limited in what it supports. - * - * For this feature to be useful one needs to hook into beforeRender() - * and set the render target. - * - */ -void QQuickWindowPrivate::setRenderWithoutShowing(bool render) -{ - if (render == renderWithoutShowing) - return; - - Q_Q(QQuickWindow); - renderWithoutShowing = render; - - if (render) - windowManager->show(q); - else - windowManager->hide(q); -} - - /*! * Schedules the window to render another frame. * @@ -361,7 +338,6 @@ QQuickWindowPrivate::QQuickWindowPrivate() #endif , touchMouseId(-1) , touchMousePressTimestamp(0) - , renderWithoutShowing(false) , dirtyItemList(0) , context(0) , renderer(0) @@ -2117,14 +2093,8 @@ void QQuickWindowPrivate::data_clear(QQmlListProperty *property) bool QQuickWindowPrivate::isRenderable() const { - const QQuickWindow *q = q_func(); - QRect geom = q->geometry(); - if (geom.width() <= 0 || geom.height() <= 0) - return false; - // Change to be applied after the visibility property is integrated in qtbase: -// return visibility != QWindow::Hidden || (renderWithoutShowing && platformWindow); - // Temporary version which is implementation-agnostic but slightly less efficient: - return q->isVisible() || (renderWithoutShowing && platformWindow); + Q_Q(const QQuickWindow); + return q->isExposed() && q->isVisible() && q->geometry().isValid(); } /*! diff --git a/src/quick/items/qquickwindow_p.h b/src/quick/items/qquickwindow_p.h index ed2ff3b..afcf4a9 100644 --- a/src/quick/items/qquickwindow_p.h +++ b/src/quick/items/qquickwindow_p.h @@ -178,9 +178,6 @@ public: bool isRenderable() const; - bool renderWithoutShowing; - void setRenderWithoutShowing(bool enabled); - QQuickItem::UpdatePaintNodeData updatePaintNodeData; QQuickItem *dirtyItemList; diff --git a/src/quick/scenegraph/qsgrenderloop.cpp b/src/quick/scenegraph/qsgrenderloop.cpp index 33a99d1..04981b5 100644 --- a/src/quick/scenegraph/qsgrenderloop.cpp +++ b/src/quick/scenegraph/qsgrenderloop.cpp @@ -215,49 +215,25 @@ void QSGGuiThreadRenderLoop::windowDestroyed(QQuickWindow *window) void QSGGuiThreadRenderLoop::renderWindow(QQuickWindow *window) { - bool renderWithoutShowing = QQuickWindowPrivate::get(window)->renderWithoutShowing; - if ((!window->isExposed() && !renderWithoutShowing) || !m_windows.contains(window)) + if (!QQuickWindowPrivate::get(window)->isRenderable() || !m_windows.contains(window)) return; WindowData &data = const_cast(m_windows[window]); - QQuickWindow *masterWindow = 0; - if (!window->isVisible() && !renderWithoutShowing) { - // Find a "proper surface" to bind... - for (QHash::const_iterator it = m_windows.constBegin(); - it != m_windows.constEnd() && !masterWindow; ++it) { - if (it.key()->isVisible()) - masterWindow = it.key(); - } - } else { - masterWindow = window; - } - - if (!masterWindow) - return; - - if (!QQuickWindowPrivate::get(masterWindow)->isRenderable()) { - qWarning().nospace() - << "Unable to find a renderable master window " - << masterWindow << "when trying to render" - << window << " (" << window->geometry() << ")."; - return; - } - bool current = false; if (!gl) { gl = new QOpenGLContext(); - gl->setFormat(masterWindow->requestedFormat()); + gl->setFormat(window->requestedFormat()); if (!gl->create()) { delete gl; gl = 0; } - current = gl->makeCurrent(masterWindow); + current = gl->makeCurrent(window); if (current) sg->initialize(gl); } else { - current = gl->makeCurrent(masterWindow); + current = gl->makeCurrent(window); } bool alsoSwap = data.updatePending; -- 1.7.2.5