From: Paul Olav Tvete Date: Mon, 10 Mar 2014 14:26:13 +0000 (+0100) Subject: QQuickWindow cleanup: Remove forceRendering flag X-Git-Tag: upstream/5.3.1~295 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4dd4d93664e32fd3bee0d02d825b4fd6cc60464d;p=platform%2Fupstream%2Fqtdeclarative.git QQuickWindow cleanup: Remove forceRendering flag forceRendering was introduced for QQuickWidget, but QQuickWidget now has full control of when the rendering functions are called. It makes more sense to not call the QQuickRenderControl functions, than to set a flag on QQuickWidget that decides whether those functions have any effect. Change-Id: I69819b13000120c04cecd1a467c08e8df9330df8 Reviewed-by: Gunnar Sletta --- diff --git a/src/quick/items/qquickrendercontrol.cpp b/src/quick/items/qquickrendercontrol.cpp index 16ed6f0..10a9691 100644 --- a/src/quick/items/qquickrendercontrol.cpp +++ b/src/quick/items/qquickrendercontrol.cpp @@ -136,7 +136,7 @@ void QQuickRenderControl::invalidate() void QQuickRenderControl::polishItems() { Q_D(QQuickRenderControl); - if (!d->window || !QQuickWindowPrivate::get(d->window)->isRenderable()) + if (!d->window) return; QQuickWindowPrivate *cd = QQuickWindowPrivate::get(d->window); @@ -151,7 +151,7 @@ void QQuickRenderControl::polishItems() bool QQuickRenderControl::sync() { Q_D(QQuickRenderControl); - if (!d->window || !QQuickWindowPrivate::get(d->window)->isRenderable()) + if (!d->window) return false; QQuickWindowPrivate *cd = QQuickWindowPrivate::get(d->window); @@ -187,7 +187,7 @@ void QQuickRenderControl::stop() void QQuickRenderControl::render() { Q_D(QQuickRenderControl); - if (!d->window || !QQuickWindowPrivate::get(d->window)->isRenderable()) + if (!d->window) return; QQuickWindowPrivate *cd = QQuickWindowPrivate::get(d->window); diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index bbc4e8b..0669643 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -409,7 +409,6 @@ QQuickWindowPrivate::QQuickWindowPrivate() , persistentSceneGraph(true) , lastWheelEventAccepted(false) , componentCompleted(true) - , forceRendering(false) , renderTarget(0) , renderTargetId(0) , incubationController(0) @@ -2300,7 +2299,7 @@ void QQuickWindowPrivate::data_clear(QQmlListProperty *property) bool QQuickWindowPrivate::isRenderable() const { Q_Q(const QQuickWindow); - return (forceRendering || (q->isExposed() && q->isVisible())) && q->geometry().isValid(); + 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 8b6073c..e78f00c 100644 --- a/src/quick/items/qquickwindow_p.h +++ b/src/quick/items/qquickwindow_p.h @@ -222,7 +222,6 @@ public: uint lastWheelEventAccepted : 1; bool componentCompleted : 1; - bool forceRendering : 1; QOpenGLFramebufferObject *renderTarget; uint renderTargetId; diff --git a/src/quickwidgets/qquickwidget.cpp b/src/quickwidgets/qquickwidget.cpp index e1e581a..dbc7d6c 100644 --- a/src/quickwidgets/qquickwidget.cpp +++ b/src/quickwidgets/qquickwidget.cpp @@ -162,6 +162,9 @@ void QQuickWidgetPrivate::renderSceneGraph() Q_Q(QQuickWidget); updatePending = false; + if (!q->isVisible() || fakeHidden) + return; + QOpenGLContext *context = offscreenWindow->openglContext(); if (!context) { qWarning("QQuickWidget: render scenegraph with no context"); @@ -718,13 +721,11 @@ void QQuickWidget::resizeEvent(QResizeEvent *e) if (e->size().isEmpty()) { //stop rendering - QQuickWindowPrivate::get(d->offscreenWindow)->forceRendering = false; d->fakeHidden = true; return; } if (d->fakeHidden) { //restart rendering - QQuickWindowPrivate::get(d->offscreenWindow)->forceRendering = true; d->fakeHidden = false; d->renderControl->sync(); } @@ -798,8 +799,6 @@ void QQuickWidget::mouseDoubleClickEvent(QMouseEvent *e) void QQuickWidget::showEvent(QShowEvent *) { Q_D(QQuickWidget); - QQuickWindowPrivate::get(d->offscreenWindow)->forceRendering = true; - d->updatePending = false; d->createContext(); triggerUpdate(); @@ -809,7 +808,6 @@ void QQuickWidget::showEvent(QShowEvent *) void QQuickWidget::hideEvent(QHideEvent *) { Q_D(QQuickWidget); - QQuickWindowPrivate::get(d->offscreenWindow)->forceRendering = false; if (!d->context) { qWarning("QQuickWidget::hideEvent with no context");