Details
-
User Story
-
Resolution: Fixed
-
P2: Important
-
None
-
6.4.0 FF
-
None
-
-
be813b995 (dev), 4a1e5d8e7 (dev), 69225ac60 (6.6), 73324c379 (dev), 218507a8a (6.6), ec6c05f4c (dev), 84d719baa (6.6), eb6af63f6 (dev), aca17e677 (6.6), 5546f41b0 (dev), 8ee3871d8 (6.6)
Description
Qt Quick Shape is Qt Quick's solution to rendering arbitrary painter paths.
The current approach in Qt subdivides and flattens curves and then triangulates the resulting shape. This looks good at scales close to the original size, but if you zoom too far you will see the straight edges and will have to regenerate the mesh for it to look correct. It also currently depends on MSAA for antialiasing.
If we could render the curves on the GPU, then we could generate the render data for the shape only once and keep it there. There are multiple ways of doing this, but we have decided to investigate an approach like https://www.microsoft.com/en-us/research/wp-content/uploads/2005/01/p1000-loop.pdf but only for quadratic curves.
A proof-of-concept is available at https://codereview.qt-project.org/c/qt/qtdeclarative/+/430854
The renderer will be opt-in and the default will still be the flattening algorithm, so it does not need to cover all corner cases, but it should be robust and as complete as possible. It should have built-in support for anti-aliasing and we should consider animation a prime use case, which probably means that generating the meshes has to be very fast.
Other approaches are: https://medium.com/@evanwallace/easy-scalable-text-rendering-on-the-gpu-c3f4d782c5ac which requires a pre-pass for rendering the shape which might be expensive on a lot of hardware.
Distance fields are also relevant for this, but since generating the distance fields themselves is so expensive, it will not perform well enough for animated shapes, so this was not explored.
Attachments
Issue Links
- covers
-
QTBUG-112169 No antialiasing for QML Shape
- Closed
- relates to
-
QTBUG-112463 Very pixelated edges of text in PathText
- Closed
-
QTBUG-106529 QtQuick.Shapes docs lacks mentionning how to make it smooth
- Closed
-
QTBUG-106335 Implement hardware accelerated QPainterPath for Qt Quick shapes
- Closed