diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2019-07-29 13:56:32 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2019-07-30 19:20:16 +0200 |
commit | 3cff8b2718ad182e39047a551ccdb8a72b2b2060 (patch) | |
tree | debc2225aff11350bda9af970e0e29e21b72dd3a /src/plugins | |
parent | 595a90f99117bb9b588065a4492a6cc7ac9e1e34 (diff) |
Make openvg compile
The plugin is not tested in any form in CI, and some of the internal
changes in the RHI patch has some consequences here as well. Adapt
as necessary. Have not tested the plugin in practice but it compiles
now.
Change-Id: I482fa34802d0bd4d44570f852298c1227cf0bb71
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/plugins')
6 files changed, 37 insertions, 8 deletions
diff --git a/src/plugins/scenegraph/openvg/qsgopenvgcontext.cpp b/src/plugins/scenegraph/openvg/qsgopenvgcontext.cpp index 76ebb7c4ee..1736a2098e 100644 --- a/src/plugins/scenegraph/openvg/qsgopenvgcontext.cpp +++ b/src/plugins/scenegraph/openvg/qsgopenvgcontext.cpp @@ -68,10 +68,14 @@ QSGOpenVGRenderContext::QSGOpenVGRenderContext(QSGContext *context) } -void QSGOpenVGRenderContext::initialize(void *context) +void QSGOpenVGRenderContext::initialize(const QSGRenderContext::InitParams *params) { - m_vgContext = static_cast<QOpenVGContext*>(context); - QSGRenderContext::initialize(context); + const InitParams *vgparams = static_cast<const InitParams *>(params); + if (vgparams->sType != INIT_PARAMS_MAGIC) + qFatal("Invalid OpenVG render context parameters"); + + m_vgContext = vgparams->context; + QSGRenderContext::initialize(params); } void QSGOpenVGRenderContext::invalidate() @@ -160,7 +164,7 @@ QSGInternalRectangleNode *QSGOpenVGContext::createInternalRectangleNode() return new QSGOpenVGInternalRectangleNode(); } -QSGInternalImageNode *QSGOpenVGContext::createInternalImageNode() +QSGInternalImageNode *QSGOpenVGContext::createInternalImageNode(QSGRenderContext *) { return new QSGOpenVGInternalImageNode(); } diff --git a/src/plugins/scenegraph/openvg/qsgopenvgcontext_p.h b/src/plugins/scenegraph/openvg/qsgopenvgcontext_p.h index 31a1e8643f..15d0b3f344 100644 --- a/src/plugins/scenegraph/openvg/qsgopenvgcontext_p.h +++ b/src/plugins/scenegraph/openvg/qsgopenvgcontext_p.h @@ -57,7 +57,13 @@ class QSGOpenVGRenderContext : public QSGRenderContext, public QSGRendererInterf public: QSGOpenVGRenderContext(QSGContext *context); - void initialize(void *context) override; + static const int INIT_PARAMS_MAGIC = 0x51E; + struct InitParams : public QSGRenderContext::InitParams { + int sType = INIT_PARAMS_MAGIC; + QOpenVGContext *context = nullptr; + }; + + void initialize(const QSGRenderContext::InitParams *params) override; void invalidate() override; void renderNextFrame(QSGRenderer *renderer, uint fboId) override; QSGTexture *createTexture(const QImage &image, uint flags) const override; @@ -94,7 +100,7 @@ public: QSGLayer *createLayer(QSGRenderContext *renderContext) override; QSurfaceFormat defaultSurfaceFormat() const override; QSGInternalRectangleNode *createInternalRectangleNode() override; - QSGInternalImageNode *createInternalImageNode() override; + QSGInternalImageNode *createInternalImageNode(QSGRenderContext *renderContext) override; #if QT_CONFIG(quick_sprite) QSGSpriteNode *createSpriteNode() override; #endif diff --git a/src/plugins/scenegraph/openvg/qsgopenvglayer.cpp b/src/plugins/scenegraph/openvg/qsgopenvglayer.cpp index 047539d431..b03168b334 100644 --- a/src/plugins/scenegraph/openvg/qsgopenvglayer.cpp +++ b/src/plugins/scenegraph/openvg/qsgopenvglayer.cpp @@ -44,7 +44,8 @@ QT_BEGIN_NAMESPACE QSGOpenVGLayer::QSGOpenVGLayer(QSGRenderContext *renderContext) - : m_item(nullptr) + : QSGLayer(*(new QSGOpenVGLayerPrivate)) + , m_item(nullptr) , m_renderer(nullptr) , m_device_pixel_ratio(1) , m_mirrorHorizontal(false) @@ -312,4 +313,9 @@ void QSGOpenVGLayer::grab() markDirtyTexture(); // Continuously update if 'live' and 'recursive'. } +int QSGOpenVGLayerPrivate::comparisonKey() const +{ + return 0; +} + QT_END_NAMESPACE diff --git a/src/plugins/scenegraph/openvg/qsgopenvglayer.h b/src/plugins/scenegraph/openvg/qsgopenvglayer.h index 8deedc3347..f2763463cd 100644 --- a/src/plugins/scenegraph/openvg/qsgopenvglayer.h +++ b/src/plugins/scenegraph/openvg/qsgopenvglayer.h @@ -42,6 +42,7 @@ #include <private/qsgadaptationlayer_p.h> #include <private/qsgcontext_p.h> +#include <private/qsgtexture_p.h> #include "qopenvgcontext_p.h" #include "qopenvgoffscreensurface.h" @@ -50,9 +51,11 @@ QT_BEGIN_NAMESPACE class QSGOpenVGRenderer; class QSGOpenVGRenderContext; +class QSGOpenVGLayerPrivate; class QSGOpenVGLayer : public QSGLayer { + Q_DECLARE_PRIVATE(QSGOpenVGLayer) public: QSGOpenVGLayer(QSGRenderContext *renderContext); ~QSGOpenVGLayer(); @@ -109,6 +112,13 @@ private: QOpenVGOffscreenSurface *m_secondaryOffscreenSurface; }; +class QSGOpenVGLayerPrivate : public QSGTexturePrivate +{ + Q_DECLARE_PUBLIC(QSGOpenVGLayer) +public: + int comparisonKey() const override; +}; + QT_END_NAMESPACE #endif // QSGOPENVGLAYER_H diff --git a/src/plugins/scenegraph/openvg/qsgopenvgpainternode.cpp b/src/plugins/scenegraph/openvg/qsgopenvgpainternode.cpp index fb68ebf2bc..74f30f8189 100644 --- a/src/plugins/scenegraph/openvg/qsgopenvgpainternode.cpp +++ b/src/plugins/scenegraph/openvg/qsgopenvgpainternode.cpp @@ -39,6 +39,7 @@ #include "qsgopenvgpainternode.h" #include "qsgopenvgtexture.h" +#include <private/qsgcontext_p.h> #include <qmath.h> #include <QtGui/QPainter> diff --git a/src/plugins/scenegraph/openvg/qsgopenvgrenderloop.cpp b/src/plugins/scenegraph/openvg/qsgopenvgrenderloop.cpp index c41dfd7400..94f7f76036 100644 --- a/src/plugins/scenegraph/openvg/qsgopenvgrenderloop.cpp +++ b/src/plugins/scenegraph/openvg/qsgopenvgrenderloop.cpp @@ -176,7 +176,9 @@ void QSGOpenVGRenderLoop::renderWindow(QQuickWindow *window) if (vg == nullptr) { vg = new QOpenVGContext(window); vg->makeCurrent(); - cd->context->initialize(vg); + QSGOpenVGRenderContext::InitParams params; + params.context = vg; + cd->context->initialize(¶ms); } else { vg->makeCurrent(); } |