diff options
Diffstat (limited to 'src/imports/shapes/qquickshape_p_p.h')
-rw-r--r-- | src/imports/shapes/qquickshape_p_p.h | 104 |
1 files changed, 18 insertions, 86 deletions
diff --git a/src/imports/shapes/qquickshape_p_p.h b/src/imports/shapes/qquickshape_p_p.h index 888488efcd..6ca752de56 100644 --- a/src/imports/shapes/qquickshape_p_p.h +++ b/src/imports/shapes/qquickshape_p_p.h @@ -62,39 +62,6 @@ QT_BEGIN_NAMESPACE class QSGPlainTexture; -struct QQuickShapePathCommands -{ - enum Command { - MoveTo, - LineTo, - QuadTo, - CubicTo, - ArcTo - }; - - QVector<Command> cmd; - QVector<float> coords; - - QPainterPath toPainterPath() const; -}; - -struct QQuickShapeStrokeFillParams -{ - QQuickShapeStrokeFillParams(); - - QColor strokeColor; - qreal strokeWidth; - QColor fillColor; - QQuickShapePath::FillRule fillRule; - QQuickShapePath::JoinStyle joinStyle; - int miterLimit; - QQuickShapePath::CapStyle capStyle; - QQuickShapePath::StrokeStyle strokeStyle; - qreal dashOffset; - QVector<qreal> dashPattern; - QQuickShapeGradient *fillGradient; -}; - class QQuickAbstractPathRenderer { public: @@ -110,11 +77,7 @@ public: virtual void endSync(bool async) = 0; virtual void setAsyncCallback(void (*)(void *), void *) { } virtual Flags flags() const { return 0; } - // - QML API virtual void setPath(int index, const QQuickPath *path) = 0; - // - JS API - virtual void setJSPath(int index, const QQuickShapePathCommands &path) = 0; - // - stroke/fill parameters virtual void setStrokeColor(int index, const QColor &color) = 0; virtual void setStrokeWidth(int index, qreal w) = 0; virtual void setFillColor(int index, const QColor &color) = 0; @@ -131,6 +94,23 @@ public: Q_DECLARE_OPERATORS_FOR_FLAGS(QQuickAbstractPathRenderer::Flags) +struct QQuickShapeStrokeFillParams +{ + QQuickShapeStrokeFillParams(); + + QColor strokeColor; + qreal strokeWidth; + QColor fillColor; + QQuickShapePath::FillRule fillRule; + QQuickShapePath::JoinStyle joinStyle; + int miterLimit; + QQuickShapePath::CapStyle capStyle; + QQuickShapePath::StrokeStyle strokeStyle; + qreal dashOffset; + QVector<qreal> dashPattern; + QQuickShapeGradient *fillGradient; +}; + class QQuickShapePathPrivate : public QQuickPathPrivate { Q_DECLARE_PUBLIC(QQuickShapePath) @@ -177,63 +157,15 @@ public: static QQuickShapePrivate *get(QQuickShape *item) { return item->d_func(); } - bool componentComplete; bool spChanged; QQuickShape::RendererType rendererType; bool async; QQuickShape::Status status; QQuickAbstractPathRenderer *renderer; - - struct { - QVector<QQuickShapePath *> sp; - } qmlData; - - struct { - bool isValid() const { Q_ASSERT(paths.count() == sfp.count()); return !paths.isEmpty(); } - QVector<QQuickShapePathCommands> paths; - QVector<QQuickShapeStrokeFillParams> sfp; - } jsData; - + QVector<QQuickShapePath *> sp; bool enableVendorExts; }; -class QQuickShapePathObject : public QObject -{ - Q_OBJECT - -public: - QQuickShapePathObject(QObject *parent = nullptr) : QObject(parent) { } - - void setV4Engine(QV4::ExecutionEngine *engine); - QV4::ReturnedValue v4value() const { return m_v4value.value(); } - - QQuickShapePath path; - - void clear(); - -private: - QV4::PersistentValue m_v4value; -}; - -class QQuickShapeStrokeFillParamsObject : public QObject -{ - Q_OBJECT - -public: - QQuickShapeStrokeFillParamsObject(QObject *parent = nullptr) : QObject(parent) { } - - void setV4Engine(QV4::ExecutionEngine *engine); - QV4::ReturnedValue v4value() const { return m_v4value.value(); } - - QQuickShapeStrokeFillParams sfp; - QV4::PersistentValue v4fillGradient; - - void clear(); - -private: - QV4::PersistentValue m_v4value; -}; - #if QT_CONFIG(opengl) class QQuickShapeGradientCache : public QOpenGLSharedResource |