Remove dead code.
authorGunnar Sletta <gunnar.sletta@digia.com>
Tue, 16 Apr 2013 08:51:31 +0000 (10:51 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Wed, 17 Apr 2013 11:39:06 +0000 (13:39 +0200)
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 <yoann.lopes@digia.com>
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>

src/quick/items/qquickwindow.cpp
src/quick/items/qquickwindow_p.h
src/quick/scenegraph/qsgrenderloop.cpp

index 97a2576..494ad1e 100644 (file)
@@ -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<QObject> *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();
 }
 
 /*!
index ed2ff3b..afcf4a9 100644 (file)
@@ -178,9 +178,6 @@ public:
 
     bool isRenderable() const;
 
-    bool renderWithoutShowing;
-    void setRenderWithoutShowing(bool enabled);
-
     QQuickItem::UpdatePaintNodeData updatePaintNodeData;
 
     QQuickItem *dirtyItemList;
index 33a99d1..04981b5 100644 (file)
@@ -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<WindowData &>(m_windows[window]);
 
-    QQuickWindow *masterWindow = 0;
-    if (!window->isVisible() && !renderWithoutShowing) {
-        // Find a "proper surface" to bind...
-        for (QHash<QQuickWindow *, WindowData>::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;