4#ifndef QQUICKSHAPEGENERICRENDERER_P_H
5#define QQUICKSHAPEGENERICRENDERER_P_H
18#include <QtQuickShapes/private/qquickshapesglobal_p.h>
19#include <QtQuickShapes/private/qquickshape_p_p.h>
20#include <QtQuick/private/qsggradientcache_p.h>
22#include <qsggeometry.h>
23#include <qsgmaterial.h>
24#include <qsgrendererinterface.h>
25#include <qsgtexture.h>
26#include <QtCore/qrunnable.h>
53 m_asyncCallback(
nullptr),
54 m_asyncCallbackData(
nullptr)
58 void beginSync(
int totalCount,
bool *countChanged)
override;
59 void setPath(
int index,
const QPainterPath &path, QQuickShapePath::PathHints pathHints = {})
override;
63 void setFillColor(
int index,
const QColor &color)
override;
64 void setFillRule(
int index, QQuickShapePath::FillRule fillRule)
override;
65 void setJoinStyle(
int index, QQuickShapePath::JoinStyle joinStyle,
int miterLimit)
override;
66 void setCapStyle(
int index, QQuickShapePath::CapStyle capStyle)
override;
67 void setStrokeStyle(
int index, QQuickShapePath::StrokeStyle strokeStyle,
68 qreal dashOffset,
const QVector<qreal> &dashPattern)
override;
69 void setFillGradient(
int index, QQuickShapeGradient *gradient)
override;
73 void endSync(
bool async)
override;
91 QSGGeometry::Type *indexType,
92 bool supportsElementIndexUint,
93 qreal triangulationScale);
98 const QSize &clipSize,
99 qreal triangulationScale);
102 void maybeUpdateAsyncItem();
104 struct ShapePathData {
107 Color4ub strokeColor = { uchar(0), uchar(0), uchar(0), uchar(0) };
108 Color4ub fillColor = { uchar(0), uchar(0), uchar(0), uchar(0) };
109 Qt::FillRule fillRule;
111 FillGradientType fillGradientActive;
112 QSGGradientCache::GradientDesc fillGradient;
113 QQuickItem *fillTextureProviderItem =
nullptr;
114 QSGTransform fillTransform;
117 QSGGeometry::Type indexType;
120 int effectiveDirty = 0;
132 QVector<ShapePathData> m_sp;
134 void (*m_asyncCallback)(
void *);
135 void *m_asyncCallbackData;
136 float m_triangulationScale = 1.0;
210 void handleTextureProviderDestroyed();
213 QScopedPointer<QSGMaterial> m_material;
242 QSGMaterial *oldMaterial)
override;
244 QSGMaterial *newMaterial, QSGMaterial *oldMaterial)
override;
247 QSGTransform m_fillTransform;
263 setFlag(Blending | RequiresFullMatrix);
282 QSGMaterial *oldMaterial)
override;
284 QSGMaterial *newMaterial, QSGMaterial *oldMaterial)
override;
287 QSGTransform m_fillTransform;
288 QVector2D m_focalPoint;
289 QVector2D m_focalToCenter;
290 float m_centerRadius;
300 setFlag(Blending | RequiresFullMatrix);
319 QSGMaterial *oldMaterial)
override;
321 QSGMaterial *newMaterial, QSGMaterial *oldMaterial)
override;
324 QSGTransform m_fillTransform;
325 QVector2D m_centerPoint;
335 setFlag(Blending | RequiresFullMatrix);
354 QSGMaterial *oldMaterial)
override;
356 QSGMaterial *newMaterial, QSGMaterial *oldMaterial)
override;
359 QSGTransform m_fillTransform;
360 QVector2D m_boundsOffset;
361 QVector2D m_boundsSize;
370 setFlag(Blending | RequiresFullMatrix);
382 return m_dummyTexture;
387 m_dummyTexture = texture;
392 QSGPlainTexture *m_dummyTexture =
nullptr;
virtual void setTriangulationScale(qreal)
virtual void setFillTextureProvider(int index, QQuickItem *textureProviderItem)=0
virtual void beginSync(int totalCount, bool *countChanged)=0
virtual void setStrokeColor(int index, const QColor &color)=0
virtual void setPath(int index, const QPainterPath &path, QQuickShapePath::PathHints pathHints={})=0
virtual void setStrokeStyle(int index, QQuickShapePath::StrokeStyle strokeStyle, qreal dashOffset, const QVector< qreal > &dashPattern)=0
virtual void setAsyncCallback(void(*)(void *), void *)
virtual Flags flags() const
virtual void setCapStyle(int index, QQuickShapePath::CapStyle capStyle)=0
virtual void setFillGradient(int index, QQuickShapeGradient *gradient)=0
virtual ~QQuickAbstractPathRenderer()
virtual void setFillColor(int index, const QColor &color)=0
virtual void setCosmeticStroke(int index, bool c)=0
virtual void setPath(int index, const QQuickPath *path)
virtual void setFillRule(int index, QQuickShapePath::FillRule fillRule)=0
virtual void setStrokeWidth(int index, qreal w)=0
virtual void setFillTransform(int index, const QSGTransform &transform)=0
virtual void endSync(bool async)=0
virtual void updateNode()=0
virtual void handleSceneChange(QQuickWindow *window)=0
virtual void setJoinStyle(int index, QQuickShapePath::JoinStyle joinStyle, int miterLimit)=0
QSGMaterialType * type() const override
This function is called by the scene graph to query an identifier that is unique to the QSGMaterialSh...
QQuickShapeConicalGradientMaterial(QQuickShapeGenericStrokeFillNode *node)
int compare(const QSGMaterial *other) const override
Compares this material to other and returns 0 if they are equal; -1 if this material should sort befo...
QSGMaterialShader * createShader(QSGRendererInterface::RenderMode renderMode) const override
This function returns a new instance of a the QSGMaterialShader implementation used to render geometr...
QQuickShapeGenericStrokeFillNode * node() const
void updateSampledImage(RenderState &state, int binding, QSGTexture **texture, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override
This function is called by the scene graph to prepare use of sampled images in the shader,...
bool updateUniformData(RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override
This function is called by the scene graph to get the contents of the shader program's uniform buffer...
QQuickShapeConicalGradientRhiShader(int viewCount)
bool supportsElementIndexUint
QQuickShapeGenericRenderer::Color4ub fillColor
QQuickShapeGenericRenderer::VertexContainerType fillVertices
QQuickShapeGenericRenderer::IndexContainerType fillIndices
static QSGMaterial * createLinearGradient(QQuickWindow *window, QQuickShapeGenericStrokeFillNode *node)
static QSGMaterial * createTextureFill(QQuickWindow *window, QQuickShapeGenericStrokeFillNode *node)
static QSGMaterial * createConicalGradient(QQuickWindow *window, QQuickShapeGenericStrokeFillNode *node)
static QSGMaterial * createVertexColor(QQuickWindow *window)
static QSGMaterial * createRadialGradient(QQuickWindow *window, QQuickShapeGenericStrokeFillNode *node)
QQuickShapeGenericStrokeFillNode * m_fillNode
QQuickShapeGenericStrokeFillNode * m_strokeNode
QQuickShapeGenericNode * m_next
void setAsyncCallback(void(*)(void *), void *) override
QVector< QSGGeometry::TexturedPoint2D > TexturedVertexContainerType
void setTriangulationScale(qreal scale) override
void setFillGradient(int index, QQuickShapeGradient *gradient) override
QQuickShapeGenericRenderer(QQuickItem *item)
void setFillTransform(int index, const QSGTransform &transform) override
void setCosmeticStroke(int index, bool c) override
static void triangulateFill(const QPainterPath &path, const Color4ub &fillColor, VertexContainerType *fillVertices, IndexContainerType *fillIndices, QSGGeometry::Type *indexType, bool supportsElementIndexUint, qreal triangulationScale)
void setPath(int index, const QPainterPath &path, QQuickShapePath::PathHints pathHints={}) override
void setStrokeColor(int index, const QColor &color) override
void setFillRule(int index, QQuickShapePath::FillRule fillRule) override
QVector< quint32 > IndexContainerType
void setFillTextureProvider(int index, QQuickItem *textureProviderItem) override
void setFillColor(int index, const QColor &color) override
QVector< QSGGeometry::ColoredPoint2D > VertexContainerType
void setJoinStyle(int index, QQuickShapePath::JoinStyle joinStyle, int miterLimit) override
void setStrokeWidth(int index, qreal w) override
~QQuickShapeGenericRenderer()
void setRootNode(QQuickShapeGenericNode *node)
void handleSceneChange(QQuickWindow *window) override
void beginSync(int totalCount, bool *countChanged) override
void setCapStyle(int index, QQuickShapePath::CapStyle capStyle) override
Flags flags() const override
static void triangulateStroke(const QPainterPath &path, const QPen &pen, const Color4ub &strokeColor, VertexContainerType *strokeVertices, const QSize &clipSize, qreal triangulationScale)
void updateNode() override
void setStrokeStyle(int index, QQuickShapePath::StrokeStyle strokeStyle, qreal dashOffset, const QVector< qreal > &dashPattern) override
void endSync(bool async) override
QSGGradientCache::GradientDesc m_fillGradient
void preprocess() override
Override this function to do processing on the node before it is rendered.
QSGTransform m_fillTransform
QSGTextureProvider * m_fillTextureProvider
void activateMaterial(QQuickWindow *window, Material m)
QQuickShapeLinearGradientMaterial(QQuickShapeGenericStrokeFillNode *node)
QSGMaterialShader * createShader(QSGRendererInterface::RenderMode renderMode) const override
This function returns a new instance of a the QSGMaterialShader implementation used to render geometr...
int compare(const QSGMaterial *other) const override
Compares this material to other and returns 0 if they are equal; -1 if this material should sort befo...
QSGMaterialType * type() const override
This function is called by the scene graph to query an identifier that is unique to the QSGMaterialSh...
QQuickShapeGenericStrokeFillNode * node() const
void updateSampledImage(RenderState &state, int binding, QSGTexture **texture, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override
This function is called by the scene graph to prepare use of sampled images in the shader,...
QQuickShapeLinearGradientRhiShader(int viewCount)
bool updateUniformData(RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override
This function is called by the scene graph to get the contents of the shader program's uniform buffer...
QQuickShapeGenericStrokeFillNode * node() const
QQuickShapeRadialGradientMaterial(QQuickShapeGenericStrokeFillNode *node)
QSGMaterialType * type() const override
This function is called by the scene graph to query an identifier that is unique to the QSGMaterialSh...
QSGMaterialShader * createShader(QSGRendererInterface::RenderMode renderMode) const override
This function returns a new instance of a the QSGMaterialShader implementation used to render geometr...
int compare(const QSGMaterial *other) const override
Compares this material to other and returns 0 if they are equal; -1 if this material should sort befo...
bool updateUniformData(RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override
This function is called by the scene graph to get the contents of the shader program's uniform buffer...
QQuickShapeRadialGradientRhiShader(int viewCount)
void updateSampledImage(RenderState &state, int binding, QSGTexture **texture, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override
This function is called by the scene graph to prepare use of sampled images in the shader,...
QQuickShapeGenericRenderer::Color4ub strokeColor
QQuickShapeGenericRenderer::VertexContainerType strokeVertices
QQuickShapeTextureFillMaterial(QQuickShapeGenericStrokeFillNode *node)
void setDummyTexture(QSGPlainTexture *texture)
QSGMaterialShader * createShader(QSGRendererInterface::RenderMode renderMode) const override
This function returns a new instance of a the QSGMaterialShader implementation used to render geometr...
int compare(const QSGMaterial *other) const override
Compares this material to other and returns 0 if they are equal; -1 if this material should sort befo...
QSGPlainTexture * dummyTexture() const
QQuickShapeGenericStrokeFillNode * node() const
~QQuickShapeTextureFillMaterial() override
QSGMaterialType * type() const override
This function is called by the scene graph to query an identifier that is unique to the QSGMaterialSh...
QQuickShapeTextureFillRhiShader(int viewCount)
bool updateUniformData(RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override
This function is called by the scene graph to get the contents of the shader program's uniform buffer...
void updateSampledImage(RenderState &state, int binding, QSGTexture **texture, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override
This function is called by the scene graph to prepare use of sampled images in the shader,...
Q_STATIC_LOGGING_CATEGORY(lcAccessibilityCore, "qt.accessibility.core")
static void initResources()
static void vpe_clear(QQmlListProperty< QObject > *property)
static void vpe_append(QQmlListProperty< QObject > *property, QObject *obj)
Q_GHS_KEEP_REFERENCE(QQuickShapes_initializeModule)
QSGTransform fillTransform
QQuickShapeStrokeFillParams()
QVector< qreal > dashPattern
QQuickShapeGradient * fillGradient