Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quickshapes/qquickshapenvprrenderer_p.h |
Switch to Source code | Preprocessed file |
Line | Source | Count |
---|---|---|
1 | - | |
2 | - | |
3 | - | |
4 | - | |
5 | - | |
6 | class QQuickShapeNvprRenderNode; | - |
7 | class QOpenGLFramebufferObject; | - |
8 | class QOpenGLBuffer; | - |
9 | class QOpenGLExtraFunctions; | - |
10 | - | |
11 | class QQuickShapeNvprRenderer : public QQuickAbstractPathRenderer | - |
12 | { | - |
13 | public: | - |
14 | enum Dirty { | - |
15 | DirtyPath = 0x01, | - |
16 | DirtyStyle = 0x02, | - |
17 | DirtyFillRule = 0x04, | - |
18 | DirtyDash = 0x08, | - |
19 | DirtyFillGradient = 0x10, | - |
20 | DirtyList = 0x20 | - |
21 | }; | - |
22 | - | |
23 | void beginSync(int totalCount) override; | - |
24 | void setPath(int index, const QQuickPath *path) override; | - |
25 | void setStrokeColor(int index, const QColor &color) override; | - |
26 | void setStrokeWidth(int index, qreal w) override; | - |
27 | void setFillColor(int index, const QColor &color) override; | - |
28 | void setFillRule(int index, QQuickShapePath::FillRule fillRule) override; | - |
29 | void setJoinStyle(int index, QQuickShapePath::JoinStyle joinStyle, int miterLimit) override; | - |
30 | void setCapStyle(int index, QQuickShapePath::CapStyle capStyle) override; | - |
31 | void setStrokeStyle(int index, QQuickShapePath::StrokeStyle strokeStyle, | - |
32 | qreal dashOffset, const QVector<qreal> &dashPattern) override; | - |
33 | void setFillGradient(int index, QQuickShapeGradient *gradient) override; | - |
34 | void endSync(bool async) override; | - |
35 | - | |
36 | void updateNode() override; | - |
37 | - | |
38 | void setNode(QQuickShapeNvprRenderNode *node); | - |
39 | - | |
40 | struct NvprPath { | - |
41 | QVector<GLubyte> cmd; | - |
42 | QVector<GLfloat> coord; | - |
43 | QByteArray str; | - |
44 | }; | - |
45 | - | |
46 | private: | - |
47 | struct ShapePathGuiData { | - |
48 | int dirty = 0; | - |
49 | NvprPath path; | - |
50 | qreal strokeWidth; | - |
51 | QColor strokeColor; | - |
52 | QColor fillColor; | - |
53 | QQuickShapePath::JoinStyle joinStyle; | - |
54 | int miterLimit; | - |
55 | QQuickShapePath::CapStyle capStyle; | - |
56 | QQuickShapePath::FillRule fillRule; | - |
57 | bool dashActive; | - |
58 | qreal dashOffset; | - |
59 | QVector<qreal> dashPattern; | - |
60 | FillGradientType fillGradientActive; | - |
61 | GradientDesc fillGradient; | - |
62 | }; | - |
63 | - | |
64 | void convertPath(const QQuickPath *path, ShapePathGuiData *d); | - |
65 | - | |
66 | QQuickShapeNvprRenderNode *m_node = nullptr; | - |
67 | int m_accDirty = 0; | - |
68 | - | |
69 | QVector<ShapePathGuiData> m_sp; | - |
70 | }; | - |
71 | - | |
72 | QDebug operator<<(QDebug debug, const QQuickShapeNvprRenderer::NvprPath &path); | - |
73 | - | |
74 | class QQuickNvprMaterialManager | - |
75 | { | - |
76 | public: | - |
77 | enum Material { | - |
78 | MatSolid, | - |
79 | MatLinearGradient, | - |
80 | MatRadialGradient, | - |
81 | MatConicalGradient, | - |
82 | - | |
83 | NMaterials | - |
84 | }; | - |
85 | - | |
86 | struct MaterialDesc { | - |
87 | GLuint ppl = 0; | - |
88 | GLuint prg = 0; | - |
89 | int uniLoc[8]; | - |
90 | }; | - |
91 | - | |
92 | void create(QQuickNvprFunctions *nvpr); | - |
93 | MaterialDesc *activateMaterial(Material m); | - |
94 | void releaseResources(); | - |
95 | - | |
96 | private: | - |
97 | QQuickNvprFunctions *m_nvpr = nullptr; | - |
98 | MaterialDesc m_materials[NMaterials]; | - |
99 | }; | - |
100 | - | |
101 | class QQuickNvprBlitter | - |
102 | { | - |
103 | public: | - |
104 | bool create(); | - |
105 | void destroy(); | - |
106 | bool isCreated() const { return never executed: m_program != nullptr;return m_program != nullptr; never executed: }return m_program != nullptr; | 0 |
107 | void texturedQuad(GLuint textureId, const QSize &size, | - |
108 | const QMatrix4x4 &proj, const QMatrix4x4 &modelview, | - |
109 | float opacity); | - |
110 | - | |
111 | private: | - |
112 | QOpenGLShaderProgram *m_program = nullptr; | - |
113 | QOpenGLBuffer *m_buffer = nullptr; | - |
114 | int m_matrixLoc = -1; | - |
115 | int m_opacityLoc = -1; | - |
116 | QSize m_prevSize; | - |
117 | }; | - |
118 | - | |
119 | class QQuickShapeNvprRenderNode : public QSGRenderNode | - |
120 | { | - |
121 | public: | - |
122 | ~QQuickShapeNvprRenderNode(); | - |
123 | - | |
124 | void render(const RenderState *state) override; | - |
125 | void releaseResources() override; | - |
126 | StateFlags changedStates() const override; | - |
127 | RenderingFlags flags() const override; | - |
128 | - | |
129 | static bool isSupported(); | - |
130 | - | |
131 | private: | - |
132 | struct ShapePathRenderData { | - |
133 | GLuint path = 0; | - |
134 | int dirty = 0; | - |
135 | QQuickShapeNvprRenderer::NvprPath source; | - |
136 | GLfloat strokeWidth; | - |
137 | QVector4D strokeColor; | - |
138 | QVector4D fillColor; | - |
139 | GLenum joinStyle; | - |
140 | GLint miterLimit; | - |
141 | GLenum capStyle; | - |
142 | GLenum fillRule; | - |
143 | GLfloat dashOffset; | - |
144 | QVector<GLfloat> dashPattern; | - |
145 | QQuickAbstractPathRenderer::FillGradientType fillGradientActive; | - |
146 | QQuickAbstractPathRenderer::GradientDesc fillGradient; | - |
147 | QOpenGLFramebufferObject *fallbackFbo = nullptr; | - |
148 | bool fallbackValid = false; | - |
149 | QSize fallbackSize; | - |
150 | QPointF fallbackTopLeft; | - |
151 | - | |
152 | bool hasFill() const { return never executed: !qFuzzyIsNull(fillColor.w()) || fillGradientActive;return !qFuzzyIsNull(fillColor.w()) || fillGradientActive; never executed: }return !qFuzzyIsNull(fillColor.w()) || fillGradientActive; | 0 |
153 | bool hasStroke() const { return never executed: strokeWidth >= 0.0f && !qFuzzyIsNull(strokeColor.w());return strokeWidth >= 0.0f && !qFuzzyIsNull(strokeColor.w()); never executed: }return strokeWidth >= 0.0f && !qFuzzyIsNull(strokeColor.w()); | 0 |
154 | }; | - |
155 | - | |
156 | void updatePath(ShapePathRenderData *d); | - |
157 | void renderStroke(ShapePathRenderData *d, int strokeStencilValue, int writeMask); | - |
158 | void renderFill(ShapePathRenderData *d); | - |
159 | void renderOffscreenFill(ShapePathRenderData *d); | - |
160 | void setupStencilForCover(bool stencilClip, int sv); | - |
161 | - | |
162 | static bool nvprInited; | - |
163 | static QQuickNvprFunctions nvpr; | - |
164 | static QQuickNvprMaterialManager mtlmgr; | - |
165 | - | |
166 | QQuickNvprBlitter m_fallbackBlitter; | - |
167 | QOpenGLExtraFunctions *f = nullptr; | - |
168 | - | |
169 | QVector<ShapePathRenderData> m_sp; | - |
170 | - | |
171 | friend class QQuickShapeNvprRenderer; | - |
172 | }; | - |
173 | - | |
174 | - | |
Switch to Source code | Preprocessed file |