From: Gunnar Sletta Date: Thu, 21 Feb 2013 10:16:58 +0000 (+0100) Subject: Remove resize hook from QSGRenderLoop, exposureChanged is enough. X-Git-Tag: upstream/5.2.1~808^2~16 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=475d1ed4f6a21686828fbd018542b469a8b2dbcd;p=platform%2Fupstream%2Fqtdeclarative.git Remove resize hook from QSGRenderLoop, exposureChanged is enough. After much back and forth, I think we have settled on the right approach in QtGui, which is that resizeEvent is pretty much useless as the action happens on the following exposeEvent(). Change-Id: I5e87bda89853907d041f56acf9a2895e540c41f0 Reviewed-by: Samuel Rødal --- diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index 176f46e..4789314 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -207,8 +207,6 @@ void QQuickWindow::exposeEvent(QExposeEvent *) /*! \reimp */ void QQuickWindow::resizeEvent(QResizeEvent *) { - Q_D(QQuickWindow); - d->windowManager->resize(this, size()); } /*! \reimp */ diff --git a/src/quick/scenegraph/qsgrenderloop.cpp b/src/quick/scenegraph/qsgrenderloop.cpp index 16af79e..33a99d1 100644 --- a/src/quick/scenegraph/qsgrenderloop.cpp +++ b/src/quick/scenegraph/qsgrenderloop.cpp @@ -95,7 +95,6 @@ public: void renderWindow(QQuickWindow *window); void exposureChanged(QQuickWindow *window); QImage grab(QQuickWindow *window); - void resize(QQuickWindow *window, const QSize &size); void maybeUpdate(QQuickWindow *window); void update(QQuickWindow *window) { maybeUpdate(window); } // identical for this implementation. @@ -335,12 +334,6 @@ QImage QSGGuiThreadRenderLoop::grab(QQuickWindow *window) -void QSGGuiThreadRenderLoop::resize(QQuickWindow *, const QSize &) -{ -} - - - void QSGGuiThreadRenderLoop::maybeUpdate(QQuickWindow *window) { if (!m_windows.contains(window)) diff --git a/src/quick/scenegraph/qsgrenderloop_p.h b/src/quick/scenegraph/qsgrenderloop_p.h index 2ec6de9..b18e6f0 100644 --- a/src/quick/scenegraph/qsgrenderloop_p.h +++ b/src/quick/scenegraph/qsgrenderloop_p.h @@ -63,7 +63,6 @@ public: virtual void exposureChanged(QQuickWindow *window) = 0; virtual QImage grab(QQuickWindow *window) = 0; - virtual void resize(QQuickWindow *window, const QSize &size) = 0; virtual void update(QQuickWindow *window) = 0; virtual void maybeUpdate(QQuickWindow *window) = 0; diff --git a/src/quick/scenegraph/qsgthreadedrenderloop.cpp b/src/quick/scenegraph/qsgthreadedrenderloop.cpp index 637e91d..b457c33 100644 --- a/src/quick/scenegraph/qsgthreadedrenderloop.cpp +++ b/src/quick/scenegraph/qsgthreadedrenderloop.cpp @@ -168,9 +168,6 @@ const QEvent::Type WM_RequestSync = QEvent::Type(QEvent::User + 4); // typically a result of QQuickWindow::update(). const QEvent::Type WM_RequestRepaint = QEvent::Type(QEvent::User + 5); -// Passed by the RL to the RT when a window has changed size. -const QEvent::Type WM_Resize = QEvent::Type(QEvent::User + 6); - // Passed by the RL to the RT to free up maybe release SG and GL contexts // if no windows are rendering. const QEvent::Type WM_TryRelease = QEvent::Type(QEvent::User + 7); @@ -213,14 +210,6 @@ public: bool inDestructor; }; -class WMResizeEvent : public WMWindowEvent -{ -public: - WMResizeEvent(QQuickWindow *c, const QSize &s) : WMWindowEvent(c, WM_Resize), size(s) { } - QSize size; -}; - - class WMExposeEvent : public WMWindowEvent { public: @@ -374,7 +363,8 @@ bool QSGRenderThread::event(QEvent *e) pendingUpdate |= RepaintRequest; - if (windowFor(m_windows, se->window)) { + if (Window *w = windowFor(m_windows, se->window)) { + w->size = se->size; RLDEBUG1(" Render: - window already added..."); return true; } @@ -409,14 +399,6 @@ bool QSGRenderThread::event(QEvent *e) pendingUpdate |= SyncRequest; return true; - case WM_Resize: { - RLDEBUG(" Render: WM_Resize"); - WMResizeEvent *re = static_cast(e); - Window *w = windowFor(m_windows, re->window); - w->size = re->size; - // No need to wake up here as we will get a sync shortly.. (see QSGThreadedRenderLoop::resize()); - return true; } - case WM_TryRelease: RLDEBUG1(" Render: WM_TryRelease"); mutex.lock(); @@ -1086,27 +1068,6 @@ QImage QSGThreadedRenderLoop::grab(QQuickWindow *window) return result; } -/* - Notify the render thread that the window is now a new size. Then - locks GUI until render has adapted. - */ - -void QSGThreadedRenderLoop::resize(QQuickWindow *w, const QSize &size) -{ - RLDEBUG1("GUI: resize"); - - if (!m_thread->isRunning() || !m_windows.size() || !w->isExposed() || windowFor(m_windows, w) == 0) { - return; - } - - if (size.width() == 0 || size.height() == 0) - return; - - RLDEBUG("GUI: - posting resize event..."); - m_thread->postEvent(new WMResizeEvent(w, size)); - - polishAndSync(); -} #include "qsgthreadedrenderloop.moc" diff --git a/src/quick/scenegraph/qsgthreadedrenderloop_p.h b/src/quick/scenegraph/qsgthreadedrenderloop_p.h index 63b2b44..aab0e87 100644 --- a/src/quick/scenegraph/qsgthreadedrenderloop_p.h +++ b/src/quick/scenegraph/qsgthreadedrenderloop_p.h @@ -69,8 +69,6 @@ public: QImage grab(QQuickWindow *); - void resize(QQuickWindow *, const QSize &); - void update(QQuickWindow *window); void maybeUpdate(QQuickWindow *window); QSGContext *sceneGraphContext() const;