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 LinearGradient = 0x04,
37 RadialGradient = 0x08,
38 ConicalGradient = 0x10,
39 };
40
41 QSGCurveStrokeMaterialShader(int variant, int viewCount)
42 {
43 static constexpr auto baseName = u":/qt-project.org/scenegraph/shaders_ng/shapestroke"_sv;
44
45 setShaderFileName(VertexStage, baseName
46 + (variant & int(Variant::LinearGradient) ? u"_lg"_sv : u""_sv)
47 + (variant & int(Variant::RadialGradient) ? u"_rg"_sv : u""_sv)
48 + (variant & int(Variant::ConicalGradient) ? u"_cg"_sv : u""_sv)
49 + (variant & int(Variant::Expanding) ? u"_expanding"_sv : u""_sv)
50 + u".vert.qsb"_sv, viewCount);
51 setShaderFileName(FragmentStage, baseName
52 + (variant & int(Variant::LinearGradient) ? u"_lg"_sv : u""_sv)
53 + (variant & int(Variant::RadialGradient) ? u"_rg"_sv : u""_sv)
54 + (variant & int(Variant::ConicalGradient) ? u"_cg"_sv : u""_sv)
55 + (variant & int(Variant::Derivatives) ? u"_derivatives"_sv : u""_sv)
56 + u".frag.qsb"_sv, viewCount);
57 }
58
59 bool updateUniformData(RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect) override;
60 void updateSampledImage(RenderState &state, int binding, QSGTexture **texture, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
61};
62
63
64class Q_QUICK_EXPORT QSGCurveStrokeMaterial : public QSGMaterial
65{
66public:
67 QSGCurveStrokeMaterial(QSGCurveStrokeNode *node, bool strokeExpanding = false)
68 : m_node(node), m_strokeExpanding(strokeExpanding)
69 {
70 setFlag(Blending, true);
71 }
72
73 int compare(const QSGMaterial *other) const override;
74
75 QSGCurveStrokeNode *node() const
76 {
77 return m_node;
78 }
79
80protected:
81 QSGMaterialType *type() const override;
82 QSGMaterialShader *createShader(QSGRendererInterface::RenderMode renderMode) const override;
83
84 QSGCurveStrokeNode *m_node;
85 bool m_strokeExpanding = false;
86};
87
88QT_END_NAMESPACE
89
90#endif // QSGCURVESTROKENODE_P_P_H
Combined button and popup list for selecting options.