aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2020-04-06 13:43:18 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2020-04-07 11:37:32 +0200
commit07d1dbcf7f1de03ae700894eaf1c63a33afc739a (patch)
treef6432d0b7506396e107b348f647a81a02cfdcf1b /src
parent494063ccc8f8619d11e3a4e85168d04c1211bf44 (diff)
Remove QSGEngine and move QSGAbstractRenderer back to private
QSGEngine goes away. Same for the associated example, which is the only place this is used anywhere in Qt. As a consequence, the renderer base class can be moved back to private: there is no use for it to be public anymore, since that made sense only in combination with QSGEngine. With the RHI-based rendering path driving a renderer directly is more complicated than before so it is not reasonable to allow the QSGEngine-style access anymore. Instead, one has QQuickRenderControl, which allows redirecting and manually driving the rendering of a QQuickWindow, thus providing an alternative to the legacy QSGEngine approach. Task-number: QTBUG-78596 Change-Id: If57c6b657b2053da1c4e545e517026382a71d998 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/quick/scenegraph/coreapi/qsgabstractrenderer.cpp18
-rw-r--r--src/quick/scenegraph/coreapi/qsgabstractrenderer.h116
-rw-r--r--src/quick/scenegraph/coreapi/qsgabstractrenderer_p.h79
-rw-r--r--src/quick/scenegraph/coreapi/qsgabstractrenderer_p_p.h (renamed from src/quick/scenegraph/util/qsgengine_p.h)40
-rw-r--r--src/quick/scenegraph/coreapi/qsgrenderer_p.h3
-rw-r--r--src/quick/scenegraph/scenegraph.pri5
-rw-r--r--src/quick/scenegraph/util/qsgengine.cpp290
-rw-r--r--src/quick/scenegraph/util/qsgengine.h90
-rw-r--r--src/quick/scenegraph/util/qsgsimplerectnode.cpp3
-rw-r--r--src/quick/scenegraph/util/qsgsimpletexturenode.cpp3
10 files changed, 93 insertions, 554 deletions
diff --git a/src/quick/scenegraph/coreapi/qsgabstractrenderer.cpp b/src/quick/scenegraph/coreapi/qsgabstractrenderer.cpp
index 62ed342244..502ee27e27 100644
--- a/src/quick/scenegraph/coreapi/qsgabstractrenderer.cpp
+++ b/src/quick/scenegraph/coreapi/qsgabstractrenderer.cpp
@@ -37,26 +37,16 @@
**
****************************************************************************/
-#include "qsgabstractrenderer_p.h"
+#include "qsgabstractrenderer_p_p.h"
QT_BEGIN_NAMESPACE
/*!
\class QSGAbstractRenderer
- \brief QSGAbstractRenderer gives access to the scene graph nodes and rendering of a QSGEngine.
+ \brief QSGAbstractRenderer gives access to the scene graph nodes and rendering.
\inmodule QtQuick
\since 5.4
-
- A QSGAbstractRenderer created by a QSGEngine allows you to set your QSGNode
- tree through setRootNode() and control the rendering viewport through
- setDeviceRect(), setViewportRect() and setProjectionMatrixToRect().
- You can finally trigger the rendering to the desired framebuffer through
- renderScene().
-
- The QSGAbstractRenderer is only available when used with a QSGEngine
- and isn't exposed when used internally by QQuickWindow.
-
- \sa QSGEngine, QSGNode
+ \internal
*/
/*!
@@ -387,5 +377,3 @@ QSGAbstractRenderer::ClearMode QSGAbstractRenderer::clearMode() const
*/
QT_END_NAMESPACE
-
-#include "moc_qsgabstractrenderer.cpp"
diff --git a/src/quick/scenegraph/coreapi/qsgabstractrenderer.h b/src/quick/scenegraph/coreapi/qsgabstractrenderer.h
deleted file mode 100644
index 1594352dab..0000000000
--- a/src/quick/scenegraph/coreapi/qsgabstractrenderer.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtQuick module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSGABSTRACTRENDERER_H
-#define QSGABSTRACTRENDERER_H
-
-#include <QtQuick/qsgnode.h>
-
-#ifndef GLuint
-#define GLuint uint
-#endif
-
-QT_BEGIN_NAMESPACE
-
-class QSGAbstractRendererPrivate;
-
-class Q_QUICK_EXPORT QSGAbstractRenderer : public QObject
-{
- Q_OBJECT
-public:
- enum ClearModeBit
- {
- ClearColorBuffer = 0x0001,
- ClearDepthBuffer = 0x0002,
- ClearStencilBuffer = 0x0004
- };
- Q_DECLARE_FLAGS(ClearMode, ClearModeBit)
- Q_FLAG(ClearMode)
-
- enum MatrixTransformFlag
- {
- MatrixTransformFlipY = 0x01
- };
- Q_DECLARE_FLAGS(MatrixTransformFlags, MatrixTransformFlag)
- Q_FLAG(MatrixTransformFlags)
-
- ~QSGAbstractRenderer() override;
-
- void setRootNode(QSGRootNode *node);
- QSGRootNode *rootNode() const;
- void setDeviceRect(const QRect &rect);
- inline void setDeviceRect(const QSize &size) { setDeviceRect(QRect(QPoint(), size)); }
- QRect deviceRect() const;
-
- void setViewportRect(const QRect &rect);
- inline void setViewportRect(const QSize &size) { setViewportRect(QRect(QPoint(), size)); }
- QRect viewportRect() const;
-
- void setProjectionMatrixToRect(const QRectF &rect);
- void setProjectionMatrixToRect(const QRectF &rect, MatrixTransformFlags flags);
- void setProjectionMatrix(const QMatrix4x4 &matrix);
- void setProjectionMatrixWithNativeNDC(const QMatrix4x4 &matrix);
- QMatrix4x4 projectionMatrix() const;
- QMatrix4x4 projectionMatrixWithNativeNDC() const;
-
- void setClearColor(const QColor &color);
- QColor clearColor() const;
-
- void setClearMode(ClearMode mode);
- ClearMode clearMode() const;
-
- virtual void renderScene(GLuint fboId = 0) = 0;
-
-Q_SIGNALS:
- void sceneGraphChanged();
-
-protected:
- explicit QSGAbstractRenderer(QObject *parent = nullptr);
- virtual void nodeChanged(QSGNode *node, QSGNode::DirtyState state) = 0;
-
-private:
- Q_DECLARE_PRIVATE(QSGAbstractRenderer)
- friend class QSGRootNode;
-};
-
-Q_DECLARE_OPERATORS_FOR_FLAGS(QSGAbstractRenderer::ClearMode)
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/quick/scenegraph/coreapi/qsgabstractrenderer_p.h b/src/quick/scenegraph/coreapi/qsgabstractrenderer_p.h
index bbc4289b2c..5d48f18310 100644
--- a/src/quick/scenegraph/coreapi/qsgabstractrenderer_p.h
+++ b/src/quick/scenegraph/coreapi/qsgabstractrenderer_p.h
@@ -51,37 +51,78 @@
// We mean it.
//
-#include "qsgabstractrenderer.h"
-
-#include "qsgnode.h"
-#include <qcolor.h>
-
-#include <QtCore/private/qobject_p.h>
#include <QtQuick/private/qtquickglobal_p.h>
+#include <QtQuick/qsgnode.h>
+
+#ifndef GLuint
+#define GLuint uint
+#endif
QT_BEGIN_NAMESPACE
-class Q_QUICK_PRIVATE_EXPORT QSGAbstractRendererPrivate : public QObjectPrivate
+class QSGAbstractRendererPrivate;
+
+class Q_QUICK_PRIVATE_EXPORT QSGAbstractRenderer : public QObject
{
- Q_DECLARE_PUBLIC(QSGAbstractRenderer)
+ Q_OBJECT
public:
- static const QSGAbstractRendererPrivate *get(const QSGAbstractRenderer *q) { return q->d_func(); }
+ enum ClearModeBit
+ {
+ ClearColorBuffer = 0x0001,
+ ClearDepthBuffer = 0x0002,
+ ClearStencilBuffer = 0x0004
+ };
+ Q_DECLARE_FLAGS(ClearMode, ClearModeBit)
+ Q_FLAG(ClearMode)
+
+ enum MatrixTransformFlag
+ {
+ MatrixTransformFlipY = 0x01
+ };
+ Q_DECLARE_FLAGS(MatrixTransformFlags, MatrixTransformFlag)
+ Q_FLAG(MatrixTransformFlags)
+
+ ~QSGAbstractRenderer() override;
- QSGAbstractRendererPrivate();
- void updateProjectionMatrix();
+ void setRootNode(QSGRootNode *node);
+ QSGRootNode *rootNode() const;
+ void setDeviceRect(const QRect &rect);
+ inline void setDeviceRect(const QSize &size) { setDeviceRect(QRect(QPoint(), size)); }
+ QRect deviceRect() const;
- QSGRootNode *m_root_node;
- QColor m_clear_color;
- QSGAbstractRenderer::ClearMode m_clear_mode;
+ void setViewportRect(const QRect &rect);
+ inline void setViewportRect(const QSize &size) { setViewportRect(QRect(QPoint(), size)); }
+ QRect viewportRect() const;
- QRect m_device_rect;
- QRect m_viewport_rect;
+ void setProjectionMatrixToRect(const QRectF &rect);
+ void setProjectionMatrixToRect(const QRectF &rect, MatrixTransformFlags flags);
+ void setProjectionMatrix(const QMatrix4x4 &matrix);
+ void setProjectionMatrixWithNativeNDC(const QMatrix4x4 &matrix);
+ QMatrix4x4 projectionMatrix() const;
+ QMatrix4x4 projectionMatrixWithNativeNDC() const;
- QMatrix4x4 m_projection_matrix;
- QMatrix4x4 m_projection_matrix_native_ndc;
- uint m_mirrored : 1;
+ void setClearColor(const QColor &color);
+ QColor clearColor() const;
+
+ void setClearMode(ClearMode mode);
+ ClearMode clearMode() const;
+
+ virtual void renderScene(GLuint fboId = 0) = 0;
+
+Q_SIGNALS:
+ void sceneGraphChanged();
+
+protected:
+ explicit QSGAbstractRenderer(QObject *parent = nullptr);
+ virtual void nodeChanged(QSGNode *node, QSGNode::DirtyState state) = 0;
+
+private:
+ Q_DECLARE_PRIVATE(QSGAbstractRenderer)
+ friend class QSGRootNode;
};
+Q_DECLARE_OPERATORS_FOR_FLAGS(QSGAbstractRenderer::ClearMode)
+
QT_END_NAMESPACE
#endif
diff --git a/src/quick/scenegraph/util/qsgengine_p.h b/src/quick/scenegraph/coreapi/qsgabstractrenderer_p_p.h
index c5b5c695bd..42e9acb437 100644
--- a/src/quick/scenegraph/util/qsgengine_p.h
+++ b/src/quick/scenegraph/coreapi/qsgabstractrenderer_p_p.h
@@ -37,8 +37,8 @@
**
****************************************************************************/
-#ifndef QSGENGINE_P_H
-#define QSGENGINE_P_H
+#ifndef QSGABSTRACTRENDERER_P_P_H
+#define QSGABSTRACTRENDERER_P_P_H
//
// W A R N I N G
@@ -51,25 +51,37 @@
// We mean it.
//
-#include "qsgengine.h"
-#include <private/qobject_p.h>
+#include "qsgabstractrenderer_p.h"
-QT_BEGIN_NAMESPACE
+#include "qsgnode.h"
+#include <qcolor.h>
+
+#include <QtCore/private/qobject_p.h>
+#include <QtQuick/private/qtquickglobal_p.h>
-class QSGContext;
-class QSGRenderContext;
+QT_BEGIN_NAMESPACE
-class QSGEnginePrivate : public QObjectPrivate
+class Q_QUICK_PRIVATE_EXPORT QSGAbstractRendererPrivate : public QObjectPrivate
{
- Q_DECLARE_PUBLIC(QSGEngine)
+ Q_DECLARE_PUBLIC(QSGAbstractRenderer)
public:
- static QSGEnginePrivate *get(QSGEngine *engine) { return engine->d_func(); }
- QSGEnginePrivate();
+ static const QSGAbstractRendererPrivate *get(const QSGAbstractRenderer *q) { return q->d_func(); }
+
+ QSGAbstractRendererPrivate();
+ void updateProjectionMatrix();
+
+ QSGRootNode *m_root_node;
+ QColor m_clear_color;
+ QSGAbstractRenderer::ClearMode m_clear_mode;
+
+ QRect m_device_rect;
+ QRect m_viewport_rect;
- QScopedPointer<QSGContext> sgContext;
- QScopedPointer<QSGRenderContext> sgRenderContext;
+ QMatrix4x4 m_projection_matrix;
+ QMatrix4x4 m_projection_matrix_native_ndc;
+ uint m_mirrored : 1;
};
QT_END_NAMESPACE
-#endif // QSGENGINE_P_H
+#endif
diff --git a/src/quick/scenegraph/coreapi/qsgrenderer_p.h b/src/quick/scenegraph/coreapi/qsgrenderer_p.h
index c4ed0072f6..b25ecb0ae6 100644
--- a/src/quick/scenegraph/coreapi/qsgrenderer_p.h
+++ b/src/quick/scenegraph/coreapi/qsgrenderer_p.h
@@ -51,8 +51,7 @@
// We mean it.
//
-#include "qsgabstractrenderer.h"
-#include "qsgabstractrenderer_p.h"
+#include "qsgabstractrenderer_p_p.h"
#include "qsgnode.h"
#include "qsgmaterial.h"
diff --git a/src/quick/scenegraph/scenegraph.pri b/src/quick/scenegraph/scenegraph.pri
index b12f57d8ef..56dda508c6 100644
--- a/src/quick/scenegraph/scenegraph.pri
+++ b/src/quick/scenegraph/scenegraph.pri
@@ -12,8 +12,8 @@ HEADERS += \
$$PWD/coreapi/qsgnode.h \
$$PWD/coreapi/qsgnode_p.h \
$$PWD/coreapi/qsgnodeupdater_p.h \
- $$PWD/coreapi/qsgabstractrenderer.h \
$$PWD/coreapi/qsgabstractrenderer_p.h \
+ $$PWD/coreapi/qsgabstractrenderer_p_p.h \
$$PWD/coreapi/qsgrenderer_p.h \
$$PWD/coreapi/qsgrendernode.h \
$$PWD/coreapi/qsgrendernode_p.h \
@@ -50,8 +50,6 @@ qtConfig(opengl(es1|es2)?) {
# Util API
HEADERS += \
$$PWD/util/qsgareaallocator_p.h \
- $$PWD/util/qsgengine.h \
- $$PWD/util/qsgengine_p.h \
$$PWD/util/qsgplaintexture_p.h \
$$PWD/util/qsgsimplerectnode.h \
$$PWD/util/qsgsimpletexturenode.h \
@@ -67,7 +65,6 @@ HEADERS += \
SOURCES += \
$$PWD/util/qsgareaallocator.cpp \
- $$PWD/util/qsgengine.cpp \
$$PWD/util/qsgplaintexture.cpp \
$$PWD/util/qsgsimplerectnode.cpp \
$$PWD/util/qsgsimpletexturenode.cpp \
diff --git a/src/quick/scenegraph/util/qsgengine.cpp b/src/quick/scenegraph/util/qsgengine.cpp
deleted file mode 100644
index 13c97e8615..0000000000
--- a/src/quick/scenegraph/util/qsgengine.cpp
+++ /dev/null
@@ -1,290 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtQuick module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qsgengine_p.h"
-
-#include <QtQuick/qsgtexture.h>
-#include <private/qsgcontext_p.h>
-#include <private/qsgrenderer_p.h>
-#include <private/qsgplaintexture_p.h>
-
-#if QT_CONFIG(opengl)
-# include <QOpenGLContext>
-# include <private/qsgdefaultrendercontext_p.h>
-#endif
-
-QT_BEGIN_NAMESPACE
-
-
-/*!
- \class QSGEngine
- \brief The QSGEngine class allows low level rendering of a scene graph.
- \inmodule QtQuick
- \since 5.4
-
- A QSGEngine can be used to render a tree of QSGNode directly on a QWindow
- or QOpenGLFramebufferObject without any integration with QML, QQuickWindow
- or QQuickItem and the convenience that they provide.
-
- This means that you must handle event propagation, animation timing,
- and node lifetime yourself.
-
- \note This class is for very low level access to an independent scene graph.
- Most of the time you will instead want to subclass QQuickItem and insert
- your QSGNode in a normal QtQuick scene by overriding QQuickItem::updatePaintNode().
-
- \warning This class is only suitable when working directly with OpenGL. It
- is not compatible with the \l{Scene Graph Adaptations}{RHI-based rendering
- path}.
-
- \sa QSGAbstractRenderer
- */
-
-/*!
- \enum QSGEngine::CreateTextureOption
-
- The CreateTextureOption enums are used to customize how a texture is wrapped.
-
- \value TextureHasAlphaChannel The texture has an alpha channel and should
- be drawn using blending.
-
- \value TextureOwnsGLTexture The texture object owns the texture id and
- will delete the GL texture when the texture object is deleted.
-
- \value TextureCanUseAtlas The image can be uploaded into a texture atlas.
-
- \value TextureIsOpaque The texture object is opaque.
- */
-
-QSGEnginePrivate::QSGEnginePrivate()
- : sgContext(QSGContext::createDefaultContext())
- , sgRenderContext(sgContext.data()->createRenderContext())
-{
-}
-
-/*!
- Constructs a new QSGEngine with its \a parent
- */
-QSGEngine::QSGEngine(QObject *parent)
- : QObject(*(new QSGEnginePrivate), parent)
-{
-}
-
-/*!
- Destroys the engine
- */
-QSGEngine::~QSGEngine()
-{
-}
-
-/*!
- Initialize the engine with \a context.
-
- \warning You have to make sure that you call
- QOpenGLContext::makeCurrent() on \a context before calling this.
- */
-void QSGEngine::initialize(QOpenGLContext *context)
-{
- Q_D(QSGEngine);
-#if QT_CONFIG(opengl)
- if (context && QOpenGLContext::currentContext() != context) {
- qWarning("WARNING: The context must be current before calling QSGEngine::initialize.");
- return;
- }
-#endif
- if (d->sgRenderContext && !d->sgRenderContext->isValid()) {
- d->sgRenderContext->setAttachToGraphicsContext(false);
-#if QT_CONFIG(opengl)
- QSGDefaultRenderContext *rc = qobject_cast<QSGDefaultRenderContext *>(d->sgRenderContext.data());
- if (rc) {
- QSGDefaultRenderContext::InitParams params;
- params.sampleCount = qMax(1, context->format().samples());
- params.openGLContext = context;
- // leave the size hint and surface unset, we do not know, that's fine
- rc->initialize(&params);
- } else {
- d->sgRenderContext->initialize(nullptr);
- }
-#else
- d->sgRenderContext->initialize(nullptr);
-#endif
-#if QT_CONFIG(opengl)
- if (context)
- connect(context, &QOpenGLContext::aboutToBeDestroyed, this, &QSGEngine::invalidate);
-#endif
- }
-
-#if !QT_CONFIG(opengl)
- Q_UNUSED(context);
-#endif
-}
-
-/*!
- Invalidate the engine releasing its resources
-
- You will have to call initialize() and createRenderer() if you
- want to use it again.
- */
-void QSGEngine::invalidate()
-{
- Q_D(QSGEngine);
- d->sgRenderContext->invalidate();
-}
-
-/*!
- Returns a renderer that can be used to render a QSGNode tree
-
- You call initialize() first with the QOpenGLContext that you
- want to use with this renderer. This will return a null
- renderer otherwise.
- */
-QSGAbstractRenderer *QSGEngine::createRenderer() const
-{
- Q_D(const QSGEngine);
- if (!d->sgRenderContext->isValid())
- return nullptr;
-
- QSGRenderer *renderer = d->sgRenderContext->createRenderer();
- renderer->setCustomRenderMode(qgetenv("QSG_VISUALIZE"));
- return renderer;
-}
-
-/*!
- Creates a texture using the data of \a image
-
- Valid \a options are TextureCanUseAtlas and TextureIsOpaque.
-
- The caller takes ownership of the texture and the
- texture should only be used with this engine.
-
- \sa createTextureFromId(), QSGSimpleTextureNode::setOwnsTexture(), QQuickWindow::createTextureFromImage()
- */
-QSGTexture *QSGEngine::createTextureFromImage(const QImage &image, CreateTextureOptions options) const
-{
- Q_D(const QSGEngine);
- if (!d->sgRenderContext->isValid())
- return nullptr;
- uint flags = 0;
- if (options & TextureCanUseAtlas) flags |= QSGRenderContext::CreateTexture_Atlas;
- if (!(options & TextureIsOpaque)) flags |= QSGRenderContext::CreateTexture_Alpha;
- return d->sgRenderContext->createTexture(image, flags);
-}
-
-/*!
- Creates a texture object that wraps the GL texture \a id uploaded with \a size
-
- Valid \a options are TextureHasAlphaChannel and TextureOwnsGLTexture
-
- The caller takes ownership of the texture object and the
- texture should only be used with this engine.
-
- \sa createTextureFromImage(), QSGSimpleTextureNode::setOwnsTexture(), QQuickWindow::createTextureFromId()
- */
-QSGTexture *QSGEngine::createTextureFromId(uint id, const QSize &size, CreateTextureOptions options) const
-{
- Q_D(const QSGEngine);
- if (d->sgRenderContext->isValid()) {
- QSGPlainTexture *texture = new QSGPlainTexture();
- texture->setTextureId(id);
- texture->setHasAlphaChannel(options & TextureHasAlphaChannel);
- texture->setOwnsTexture(options & TextureOwnsGLTexture);
- texture->setTextureSize(size);
- return texture;
- }
- return nullptr;
-}
-
-/*!
- Returns the current renderer interface if there is one. Otherwise null is returned.
-
- \sa QSGRenderNode, QSGRendererInterface
- \since 5.8
- */
-QSGRendererInterface *QSGEngine::rendererInterface() const
-{
- Q_D(const QSGEngine);
- return d->sgRenderContext->isValid()
- ? d->sgRenderContext->sceneGraphContext()->rendererInterface(d->sgRenderContext.data())
- : nullptr;
-}
-
-/*!
- Creates a simple rectangle node. When the scenegraph is not initialized, the return value is null.
-
- This is cross-backend alternative to constructing a QSGSimpleRectNode directly.
-
- \since 5.8
- \sa QSGRectangleNode
- */
-QSGRectangleNode *QSGEngine::createRectangleNode() const
-{
- Q_D(const QSGEngine);
- return d->sgRenderContext->isValid() ? d->sgRenderContext->sceneGraphContext()->createRectangleNode() : nullptr;
-}
-
-/*!
- Creates a simple image node. When the scenegraph is not initialized, the return value is null.
-
- This is cross-backend alternative to constructing a QSGSimpleTextureNode directly.
-
- \since 5.8
- \sa QSGImageNode
- */
-
-QSGImageNode *QSGEngine::createImageNode() const
-{
- Q_D(const QSGEngine);
- return d->sgRenderContext->isValid() ? d->sgRenderContext->sceneGraphContext()->createImageNode() : nullptr;
-}
-
-/*!
- Creates a nine patch node. When the scenegraph is not initialized, the return value is null.
-
- \since 5.8
- */
-
-QSGNinePatchNode *QSGEngine::createNinePatchNode() const
-{
- Q_D(const QSGEngine);
- return d->sgRenderContext->isValid() ? d->sgRenderContext->sceneGraphContext()->createNinePatchNode() : nullptr;
-}
-
-QT_END_NAMESPACE
-
-#include "moc_qsgengine.cpp"
diff --git a/src/quick/scenegraph/util/qsgengine.h b/src/quick/scenegraph/util/qsgengine.h
deleted file mode 100644
index c5a59b47e7..0000000000
--- a/src/quick/scenegraph/util/qsgengine.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtQuick module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSGENGINE_H
-#define QSGENGINE_H
-
-#include <QtCore/QObject>
-#include <QtQuick/qtquickglobal.h>
-
-QT_BEGIN_NAMESPACE
-
-class QOpenGLContext;
-class QSGAbstractRenderer;
-class QSGEnginePrivate;
-class QSGTexture;
-class QSGRendererInterface;
-class QSGRectangleNode;
-class QSGImageNode;
-class QSGNinePatchNode;
-
-// ### Qt 6: Remove or redesign.
-
-class Q_QUICK_EXPORT QSGEngine : public QObject
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(QSGEngine)
-public:
- enum CreateTextureOption {
- TextureHasAlphaChannel = 0x0001,
- TextureOwnsGLTexture = 0x0004,
- TextureCanUseAtlas = 0x0008,
- TextureIsOpaque = 0x0010
- };
- Q_DECLARE_FLAGS(CreateTextureOptions, CreateTextureOption)
- Q_FLAG(CreateTextureOptions)
-
- explicit QSGEngine(QObject *parent = nullptr);
- ~QSGEngine() override;
-
- void initialize(QOpenGLContext *context);
- void invalidate();
-
- QSGAbstractRenderer *createRenderer() const;
- QSGTexture *createTextureFromImage(const QImage &image, CreateTextureOptions options = CreateTextureOption()) const;
- QSGTexture *createTextureFromId(uint id, const QSize &size, CreateTextureOptions options = CreateTextureOption()) const;
- QSGRendererInterface *rendererInterface() const;
- QSGRectangleNode *createRectangleNode() const;
- QSGImageNode *createImageNode() const;
- QSGNinePatchNode *createNinePatchNode() const;
-};
-
-QT_END_NAMESPACE
-
-#endif // QSGENGINE_H
diff --git a/src/quick/scenegraph/util/qsgsimplerectnode.cpp b/src/quick/scenegraph/util/qsgsimplerectnode.cpp
index 7b96a3fdde..0891f8d95c 100644
--- a/src/quick/scenegraph/util/qsgsimplerectnode.cpp
+++ b/src/quick/scenegraph/util/qsgsimplerectnode.cpp
@@ -51,8 +51,7 @@ QT_BEGIN_NAMESPACE
\warning This utility class is only functional when running with the default
or software backends of the Qt Quick scenegraph. As an alternative, prefer
- using QSGRectangleNode via QQuickWindow::createRectangleNode() or
- QSGEngine::createRectangleNode().
+ using QSGRectangleNode via QQuickWindow::createRectangleNode().
\deprecated
*/
diff --git a/src/quick/scenegraph/util/qsgsimpletexturenode.cpp b/src/quick/scenegraph/util/qsgsimpletexturenode.cpp
index 1d0a423aa9..ff5c53d2ea 100644
--- a/src/quick/scenegraph/util/qsgsimpletexturenode.cpp
+++ b/src/quick/scenegraph/util/qsgsimpletexturenode.cpp
@@ -99,8 +99,7 @@ static void qsgsimpletexturenode_update(QSGGeometry *g,
\warning This utility class is only functional when running with the default
or software backends of the Qt Quick scenegraph. As an alternative, prefer
- using QSGImageNode via QQuickWindow::createImageNode() or
- QSGEngine::createImageNode().
+ using QSGImageNode via QQuickWindow::createImageNode().
\deprecated
*/