diff options
author | Jocelyn Turcotte <jocelyn.turcotte@digia.com> | 2014-10-15 13:59:17 +0200 |
---|---|---|
committer | Jocelyn Turcotte <jocelyn.turcotte@digia.com> | 2014-11-25 16:27:18 +0100 |
commit | 3a7674a1b6901826a70b54eab5c9312ecd0d6052 (patch) | |
tree | 599e000eed26b3708d54dc26dc5255e6e8f849a7 /src/webenginewidgets | |
parent | 3f08d8a506241bf9b9cdfb2be37f8a3868869adf (diff) |
Avoid relying on QOpenGL classes to handle RenderPasses
Use QSGLayer and get rid of RenderPassTexture so that we can render
intermediate layers with the QtQuick 2D Renderer.
This reintroduces the private dependency on QtQuick since the
QSGLayer factory methods aren't available publically, and also that
we need to use QSGImageNode instead of QSGSimpleTextureNode to use
them.
Since we can't subclass QSGLayer to hold a reference to SG objects
directly in the nodes that use them, store them all in the wrapping
DelegatedFrameNode in a SGObjects structs. This works assuming that
the DelegatedFrameNode will always be at the root of our nodes,
layers and textures; if the scene graph destroys the
DelegatedFrameNode all child nodes will be destroyed with it.
Change-Id: Iedeceb8f98eb54fd8228a677c366d6df9a270e11
Reviewed-by: Zeno Albisser <zeno.albisser@digia.com>
Diffstat (limited to 'src/webenginewidgets')
3 files changed, 17 insertions, 2 deletions
diff --git a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp index c4a32d685..811cce90f 100644 --- a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp +++ b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp @@ -44,9 +44,11 @@ #include <QOpenGLContext> #include <QResizeEvent> #include <QSGAbstractRenderer> -#include <QSGEngine> #include <QSGNode> #include <QWindow> +#include <private/qsgcontext_p.h> +#include <private/qsgengine_p.h> + static const int MaxTooltipLength = 1024; @@ -143,6 +145,17 @@ QWindow* RenderWidgetHostViewQtDelegateWidget::window() const return root ? root->windowHandle() : 0; } +QSGLayer *RenderWidgetHostViewQtDelegateWidget::createLayer() +{ + QSGEnginePrivate *enginePrivate = QSGEnginePrivate::get(m_sgEngine.data()); + return enginePrivate->sgContext->createLayer(enginePrivate->sgRenderContext.data()); +} + +QSGImageNode *RenderWidgetHostViewQtDelegateWidget::createImageNode() +{ + return QSGEnginePrivate::get(m_sgEngine.data())->sgContext->createImageNode(); +} + void RenderWidgetHostViewQtDelegateWidget::update() { #if (QT_VERSION < QT_VERSION_CHECK(5, 4, 0)) diff --git a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.h b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.h index 0b553d8eb..4f4e7bff1 100644 --- a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.h +++ b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.h @@ -65,6 +65,8 @@ public: virtual void hide() Q_DECL_OVERRIDE; virtual bool isVisible() const Q_DECL_OVERRIDE; virtual QWindow* window() const Q_DECL_OVERRIDE; + virtual QSGLayer *createLayer() Q_DECL_OVERRIDE; + virtual QSGImageNode *createImageNode() Q_DECL_OVERRIDE; virtual void update() Q_DECL_OVERRIDE; virtual void updateCursor(const QCursor &) Q_DECL_OVERRIDE; virtual void resize(int width, int height) Q_DECL_OVERRIDE; diff --git a/src/webenginewidgets/webenginewidgets.pro b/src/webenginewidgets/webenginewidgets.pro index 71240cbaf..296b62475 100644 --- a/src/webenginewidgets/webenginewidgets.pro +++ b/src/webenginewidgets/webenginewidgets.pro @@ -6,7 +6,7 @@ CMAKE_MODULE_TESTS = "-" DEFINES += QT_BUILD_WEBENGINEWIDGETS_LIB QT += webengine widgets network quick -QT_PRIVATE += webenginecore +QT_PRIVATE += webenginecore quick-private gui-private core-private QMAKE_DOCS = $$PWD/doc/qtwebenginewidgets.qdocconf |