Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qsgcurvestrokenode_p_p.h
Go to the documentation of this file.
1// Copyright (C) 2023 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// Qt-Security score:significant reason:default
4
5#ifndef QSGCURVESTROKENODE_P_P_H
6#define QSGCURVESTROKENODE_P_P_H
7
8#include <QtQuick/qtquickexports.h>
9#include <QtQuick/qsgmaterial.h>
10
11//
12// W A R N I N G
13// -------------
14//
15// This file is not part of the Qt API. It exists for the convenience
16// of a number of Qt sources files. This header file may change from
17// version to version without notice, or even be removed.
18//
19// We mean it.
20//
21
23
24using namespace Qt::StringLiterals;
25
26class QSGCurveStrokeNode;
27class QSGCurveStrokeMaterial;
28
29class Q_QUICK_EXPORT QSGCurveStrokeMaterialShader : public QSGMaterialShader
30{
31public:
32 enum class Variant { // flags
33 Default = 0,
34 Expanding = 0x01,
35 Derivatives = 0x02
36 };
37
38 QSGCurveStrokeMaterialShader(int variant, int viewCount)
39 {
40 static constexpr auto baseName = u":/qt-project.org/scenegraph/shaders_ng/shapestroke"_sv;
41 setShaderFileName(VertexStage, baseName +
42 (variant & int(Variant::Expanding) ? u"_expanding"_sv : u""_sv)
43 + u".vert.qsb"_sv, viewCount);
44 setShaderFileName(FragmentStage, baseName +
45 (variant & int(Variant::Derivatives) ? u"_derivatives"_sv : u""_sv)
46 + u".frag.qsb"_sv, viewCount);
47 }
48
49 bool updateUniformData(RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect) override;
50};
51
52
53class Q_QUICK_EXPORT QSGCurveStrokeMaterial : public QSGMaterial
54{
55public:
56 QSGCurveStrokeMaterial(QSGCurveStrokeNode *node, bool strokeExpanding = false)
57 : m_node(node), m_strokeExpanding(strokeExpanding)
58 {
59 setFlag(Blending, true);
60 }
61
62 int compare(const QSGMaterial *other) const override;
63
64 QSGCurveStrokeNode *node() const
65 {
66 return m_node;
67 }
68
69protected:
70 QSGMaterialType *type() const override
71 {
72 static QSGMaterialType legacyType;
73 static QSGMaterialType strokeExpandingType;
74 return m_strokeExpanding ? &strokeExpandingType : &legacyType;
75 }
76 QSGMaterialShader *createShader(QSGRendererInterface::RenderMode renderMode) const override;
77
78 QSGCurveStrokeNode *m_node;
79 bool m_strokeExpanding = false;
80};
81
82QT_END_NAMESPACE
83
84#endif // QSGCURVESTROKENODE_P_P_H
Combined button and popup list for selecting options.