1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QSGDEFAULTCONTEXT_H
5#define QSGDEFAULTCONTEXT_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtQuick/private/qsgcontext_p.h>
19#include <QtQuick/private/qsgdistancefieldglyphnode_p.h>
20#include <qsgrendererinterface.h>
21
22QT_BEGIN_NAMESPACE
23
24class Q_QUICK_PRIVATE_EXPORT QSGDefaultContext : public QSGContext, public QSGRendererInterface
25{
26public:
27 QSGDefaultContext(QObject *parent = nullptr);
28 ~QSGDefaultContext();
29
30 void renderContextInitialized(QSGRenderContext *renderContext) override;
31 void renderContextInvalidated(QSGRenderContext *) override;
32 QSGRenderContext *createRenderContext() override;
33 QSGInternalRectangleNode *createInternalRectangleNode() override;
34 QSGInternalImageNode *createInternalImageNode(QSGRenderContext *renderContext) override;
35 QSGPainterNode *createPainterNode(QQuickPaintedItem *item) override;
36 QSGGlyphNode *createGlyphNode(QSGRenderContext *rc, bool preferNativeGlyphNode, int renderTypeQuality) override;
37 QSGLayer *createLayer(QSGRenderContext *renderContext) override;
38 QSurfaceFormat defaultSurfaceFormat() const override;
39 QSGRendererInterface *rendererInterface(QSGRenderContext *renderContext) override;
40 QSGRectangleNode *createRectangleNode() override;
41 QSGImageNode *createImageNode() override;
42 QSGNinePatchNode *createNinePatchNode() override;
43#if QT_CONFIG(quick_sprite)
44 QSGSpriteNode *createSpriteNode() override;
45#endif
46 QSGGuiThreadShaderEffectManager *createGuiThreadShaderEffectManager() override;
47 QSGShaderEffectNode *createShaderEffectNode(QSGRenderContext *renderContext) override;
48
49 void setDistanceFieldEnabled(bool enabled);
50 bool isDistanceFieldEnabled() const;
51
52 GraphicsApi graphicsApi() const override;
53 void *getResource(QQuickWindow *window, Resource resource) const override;
54 ShaderType shaderType() const override;
55 ShaderCompilationTypes shaderCompilationType() const override;
56 ShaderSourceTypes shaderSourceType() const override;
57
58private:
59 QMutex m_mutex;
60 QSGContext::AntialiasingMethod m_antialiasingMethod;
61 bool m_distanceFieldDisabled;
62 QSGDistanceFieldGlyphNode::AntialiasingMode m_distanceFieldAntialiasing;
63 bool m_distanceFieldAntialiasingDecided;
64};
65
66QT_END_NAMESPACE
67
68#endif // QSGDEFAULTCONTEXT_H
69

source code of qtdeclarative/src/quick/scenegraph/qsgdefaultcontext_p.h