diff options
Diffstat (limited to 'src/plugins/scenegraph/openvg')
7 files changed, 38 insertions, 10 deletions
diff --git a/src/plugins/scenegraph/openvg/qsgopenvgcontext.cpp b/src/plugins/scenegraph/openvg/qsgopenvgcontext.cpp index e4acda1ffd..a5231e15d1 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); emit initialized(); } @@ -162,7 +166,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/qsgopenvgfontglyphcache.h b/src/plugins/scenegraph/openvg/qsgopenvgfontglyphcache.h index 107ec0c892..40d67761bf 100644 --- a/src/plugins/scenegraph/openvg/qsgopenvgfontglyphcache.h +++ b/src/plugins/scenegraph/openvg/qsgopenvgfontglyphcache.h @@ -42,7 +42,6 @@ #include <QtGui/QGlyphRun> #include <QtCore/QSet> -#include <QtCore/QLinkedList> #include <VG/openvg.h> QT_BEGIN_NAMESPACE 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 994ac251e3..85651ece9d 100644 --- a/src/plugins/scenegraph/openvg/qsgopenvgrenderloop.cpp +++ b/src/plugins/scenegraph/openvg/qsgopenvgrenderloop.cpp @@ -96,7 +96,7 @@ void QSGOpenVGRenderLoop::windowDestroyed(QQuickWindow *window) vg->doneCurrent(); } - delete d->animationController; + d->animationController.reset(); } void QSGOpenVGRenderLoop::exposureChanged(QQuickWindow *window) @@ -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(); } |