aboutsummaryrefslogtreecommitdiffstats
path: root/src/quickshapes/qquickshape_p.h
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2022-09-06 12:45:55 +0200
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2023-05-26 14:45:21 +0200
commitbe813b9955aad4628dba4a270ba1de226a7c9496 (patch)
treea952ebee2528e684196d5721b84b73c6420c64ee /src/quickshapes/qquickshape_p.h
parentf6e5a11f0c382dfd831e4ec0bb1c34ff2e6540e6 (diff)
Introduce hardware accelerated curve renderer for Shapes
This implements the Loop/Blinn algorithm for quadratic curves as an optional backend for Qt Quick Shapes, basically distance fields where the distance to curves are calculated in the fragment shader. This means cubic curves are approximated, which will give varying results, but for many shapes (such as text) this is efficient and means the shapes can be zoomed indefinitely while still retaining curvature as well as anti-aliasing working without MSAA. Preliminary results give some frame rate improvements compared to doing MSAA and GeometryRenderer, but the major improvement is that you can get smooth curves at any zoom level without re-triangulating the shape. Note that the renderer currently does not do antialiasing for straight lines. This would still require MSAA, but at a lower cost than for GeometryRenderer since there are much fewer triangles. Adding AA here as well is work in progress. Task-number: QTBUG-104122 Done-with: Paul Olav Tvete <paul.tvete@qt.io> Done-with: Eirik Aavitsland <eirik.aavitsland@qt.io> Done-with: Amr Elsayed <amr.elsayed@qt.io> Change-Id: I6b4a1103546fbdfe760906f7a183101f8eedb9d3 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'src/quickshapes/qquickshape_p.h')
-rw-r--r--src/quickshapes/qquickshape_p.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/quickshapes/qquickshape_p.h b/src/quickshapes/qquickshape_p.h
index f1e2eea546..a7c8611856 100644
--- a/src/quickshapes/qquickshape_p.h
+++ b/src/quickshapes/qquickshape_p.h
@@ -288,8 +288,12 @@ class Q_QUICKSHAPES_PRIVATE_EXPORT QQuickShape : public QQuickItem
Q_PROPERTY(RendererType rendererType READ rendererType NOTIFY rendererChanged)
Q_PROPERTY(bool asynchronous READ asynchronous WRITE setAsynchronous NOTIFY asynchronousChanged)
Q_PROPERTY(bool vendorExtensionsEnabled READ vendorExtensionsEnabled WRITE setVendorExtensionsEnabled NOTIFY vendorExtensionsEnabledChanged)
+ Q_PROPERTY(RendererType preferredRendererType READ preferredRendererType
+ WRITE setPreferredRendererType NOTIFY preferredRendererTypeChanged REVISION(6, 6))
Q_PROPERTY(Status status READ status NOTIFY statusChanged)
Q_PROPERTY(ContainsMode containsMode READ containsMode WRITE setContainsMode NOTIFY containsModeChanged REVISION(1, 11))
+ Q_PROPERTY(QRectF boundingRect READ boundingRect NOTIFY boundingRectChanged REVISION(6, 6))
+
Q_PROPERTY(QQmlListProperty<QObject> data READ data)
Q_CLASSINFO("DefaultProperty", "data")
QML_NAMED_ELEMENT(Shape)
@@ -300,7 +304,8 @@ public:
UnknownRenderer,
GeometryRenderer,
NvprRenderer,
- SoftwareRenderer
+ SoftwareRenderer,
+ CurveRenderer
};
Q_ENUM(RendererType)
@@ -325,6 +330,11 @@ public:
bool asynchronous() const;
void setAsynchronous(bool async);
+ Q_REVISION(6, 6) RendererType preferredRendererType() const;
+ Q_REVISION(6, 6) void setPreferredRendererType(RendererType preferredType);
+
+ Q_REVISION(6, 6) QRectF boundingRect() const override;
+
bool vendorExtensionsEnabled() const;
void setVendorExtensionsEnabled(bool enable);
@@ -349,6 +359,8 @@ Q_SIGNALS:
void asynchronousChanged();
void vendorExtensionsEnabledChanged();
void statusChanged();
+ Q_REVISION(6, 6) void preferredRendererTypeChanged();
+ Q_REVISION(6, 6) void boundingRectChanged();
Q_REVISION(1, 11) void containsModeChanged();
private: