Commit Graph

77325 Commits

Author SHA1 Message Date
Benjamin Otte
6fb33c775e node-editor: Don't reparse node when scaling
Makes scaling complex nodes bearable.
2023-07-31 16:51:04 +02:00
Benjamin Otte
ff9903d47f XXX: vulkan: Ignore stroke nodes
Useful for benchmarking.
2023-07-31 16:51:04 +02:00
Benjamin Otte
5eb0fa8b09 vulkan: Make the fill node use the contour output
For now, it only does a single standard contour.
And it can only do lines and cubics.
2023-07-31 16:51:04 +02:00
Benjamin Otte
7057f96c78 contour: Add gsk_contour_to_shader() function
This converts the contour into the format we pass to the GLSL shaders.

FIXME: Someone document that format maybe.
2023-07-31 16:51:04 +02:00
Benjamin Otte
8b6dffa5d2 vulkan: Add a naive fill node implementation 2023-07-31 16:51:04 +02:00
Benjamin Otte
19798883c4 xxx: stroke node bounds 2023-07-31 16:51:04 +02:00
Benjamin Otte
a7c842ee9d xxx debug-printf
Doesn't work yet, booo!
2023-07-31 16:51:04 +02:00
Matthias Clasen
802216e7c1 Add gsk vulkan tests
Add a testsuite called gsk-compare-vulkan to run
the gsk renderer tests with the Vulkan renderer.

The current stats:

Ok:                 184
Expected Fail:      0
Fail:               204
Unexpected Pass:    0
Skipped:            2
Timeout:            0

For now, we mark all the tests as failing to
avoid ci breakage. To run the tests locally,
you can do:

meson test -C_build --suite gsk-compare-vulkan
2023-07-31 16:51:04 +02:00
Benjamin Otte
30ed2603a9 node-editor: Add initial comparison UI
And yes, I'm aware of the icon I'm using.
2023-07-31 16:51:04 +02:00
Benjamin Otte
6631df684f node-editor: Add some form of undo stack
I have no idea about the UI for this yet, but there's a list of nodes
now that you can click on to get previous ones back.

Ultimately I want to have some way to compare nodes or do transitions,
but so far, this is an experiment.
2023-07-31 16:51:04 +02:00
Benjamin Otte
bc67bb3830 testsuite: Add a test for repeat node offscreen scaling
Ensure that the offscreens for repeat nodes pick the right xscale and
yscale so that they render pixel-aligned.
2023-07-31 16:51:04 +02:00
Benjamin Otte
1d02c78e1b testsuite: Add another test
This test ensures that offscreens for cross-fade children are properly
clipped and that the renderers can deal with the two not overlapping.
2023-07-31 16:51:04 +02:00
Benjamin Otte
29bd22025d testsuite: Add test for gradients
Test that it can do 64 color stops.

Should ensure that renderers either can do unlimited amounts or have
fallbacks in place.
2023-07-31 16:51:04 +02:00
Benjamin Otte
930ea4e019 testsuite: Test we don't crash with overly large nodes
... when these nodes are used as children of a complex transform nodes
and we lose the clip.
2023-07-31 16:51:04 +02:00
Benjamin Otte
7f5cca028a testsuite: Increase tolerances to make the path test work
I dislike the corner cases being so low (lower than 1% and off by a
whole point).
2023-07-31 16:51:04 +02:00
Benjamin Otte
e88d753f64 path: Handle segments of degenerate curves via lines
When curves have long straight parts that decompose into a single line,
don't try to split them. Instead, split at a well-known position and a
the part of that long straight line as a line.

This gives way more accurate numbers and is more accurate than 1% for
everything but contours with very small weight and
start_point == end_point, where the error is closer to 1.5%.
2023-07-31 16:51:04 +02:00
Benjamin Otte
34c52b4683 curve: Add a reason to decomposition
When decomposing curves that are too straight, we may emit lines for
long parts of the curve. These lines do not properly map
  t => distance
and it is better to treat them as a regular line than a curve.

This reason argument gives that information.

No users so far, that will happen in followup commits.
2023-07-31 16:51:04 +02:00
Benjamin Otte
ed737beda1 path: Move gsk_path_new_from_cairo() away
This is a regular path creation API, so treat it that way.

On top, it is rather awkward if the only constructor for a path that is
immediately visible to people reading the docs is the one that takes a
Cairo path - when we want to deprecate Cairo.
2023-07-31 16:51:04 +02:00
Matthias Clasen
5c7c452ea3 gtk-demo: Rewrite the text mask demo
Use GtkSnapshot and GskPath instead of cairo for this.
2023-07-31 16:51:04 +02:00
Benjamin Otte
25277d4d9e gtk-demo: Make path-text demo use gsk_builder_add_layout() 2023-07-31 16:51:04 +02:00
Matthias Clasen
a11d9cb942 path fill demo: Use gsk_path_builder_add_layout
We have an api now to hide the cairo use.
2023-07-31 16:51:04 +02:00
Matthias Clasen
49e3e8242a gsk: Add gsk_path_builder_add_layout
This api makes it easy to turn text into a path that
can be further manipulated. The implementation currently
goes via cairo.
2023-07-31 16:51:04 +02:00
Benjamin Otte
bae72fd737 path: Add gsk_path_builder_add_ellipse() 2023-07-31 16:51:04 +02:00
Benjamin Otte
4d4f4791e4 path: Change semantics of gtk_path_builder_add_segment()
Allow start >= end to mean that the path continues at the beginning
after reaching the end until it reaches the point at @end.
2023-07-31 16:51:04 +02:00
Benjamin Otte
ea3983b9ab path: Add gsk_path_measure_is_closed () 2023-07-31 16:51:04 +02:00
Benjamin Otte
c410e0510d path: Add gsk_path_measure_restrict_to_contour() 2023-07-31 16:51:04 +02:00
Matthias Clasen
67ee3ba0a3 Add gsk_path_measure_get_{path,tolerance}
These are just nice apis to have and avoid having to carry
these around as extra arguments in many places.

This was showing up as inconvenience in writing tests
for the measure apis.
2023-07-31 16:51:04 +02:00
Benjamin Otte
2f7ef4832e xxx path)_fill 2023-07-31 16:51:04 +02:00
Matthias Clasen
f728418d22 Add gsk_path_get_stroke_bounds
A relatively cheap way to get bounds for the area
that would be affected by stroking a path.
2023-07-31 16:51:04 +02:00
Benjamin Otte
5328e6d1ca testsuite: Add tests for the dasher 2023-07-31 16:51:04 +02:00
Benjamin Otte
70319b0316 path: Add a foreach function that dashes a path 2023-07-31 16:51:04 +02:00
Benjamin Otte
eb543bc58b path: Deal with non-uniformness of progress parameter
The progress is non-uniform, so simple translation of progress doesn't work.
So check if larger and smaller values inch closer towards minimal distance.
2023-07-31 16:51:04 +02:00
Benjamin Otte
e277bcdd12 path: Always decompose conics into at least 2 segments
Conics are evil in that their parameter skews towards the center, and if
it's a very flat conic (weight almost equal to 0), then we'd approximate
it with a single segment and not subdivide, which would cause the
parameter to be wildly off around 0.25 or 0.75.

And that would cause offset calculations to fail.
2023-07-31 16:51:04 +02:00
Matthias Clasen
e52d9d55a8 testsuite Add curve tangent tests 2023-07-31 16:51:04 +02:00
Benjamin Otte
b66935f168 testsuite: Add a test for the conic that got us segment() 2023-07-31 16:51:04 +02:00
Benjamin Otte
947e813d4b path: Add gsk_curve_segment()
Using split() twice with scaled t values does not work with conics.
2023-07-31 16:51:04 +02:00
Benjamin Otte
673d85ff16 testsuite: Add a test for gsk_curve_decompose() 2023-07-31 16:51:04 +02:00
Benjamin Otte
5a85046c09 testuite: Add tests for gsk_curve_get_tangent() 2023-07-31 16:51:04 +02:00
Matthias Clasen
887c1ff416 testuite: Add tests for gsk_curve_get_point()
Add a few tests for gsk_curve_get_point().

Since GskCurve is not public api, we add gskcurve.c
as source to the test binary.
2023-07-31 16:51:04 +02:00
Benjamin Otte
5877155c40 curve: Split eval() into get_point() and get_tangent()
That's more in line with the get_start/end_point/tangent() functions.

Plus, those calls are independent and we usually want one or the other.
2023-07-31 16:51:04 +02:00
Matthias Clasen
041b9170cc Add gsk_curve_get_{start,end}_tangent
Add a way to get the tangents at the start and end of the curve.
This will be used in stroking.
2023-07-31 16:51:04 +02:00
Benjamin Otte
968f5aea61 testsuite: Add conics to the random paths 2023-07-31 16:51:04 +02:00
Benjamin Otte
2badf27114 path: Add GskCurve
GskCurve is an abstraction for path operations. It's essentially a
collection of vfuncs per GskPathOperation.

GskStandardContour has been ported to use it where appropriate.
2023-07-31 16:51:04 +02:00
Benjamin Otte
0a05d864d1 path: Introduce gskpathop
A gskpathop is a pointer to a graphene_point_t* with the low bits used
to encode the GskPathOperation. It's an easy way to introduce API for
operations.

So far it's just used to replace GskStandardOperation.
2023-07-31 16:51:04 +02:00
Benjamin Otte
46fe43c5df WIP: css: Replace border rendering code with GskPath
The weight is wrong still, I need to compute the correct one to get real
45deg circle corners and not just roughly correct ones.
2023-07-31 16:51:04 +02:00
Benjamin Otte
74164440f6 WIP: pathbuilder: Add gsk_path_builder_add_rounded_rect()
It works, but does not use a custom contour yet.
2023-07-31 16:51:04 +02:00
Benjamin Otte
0cea93777a path: Add conic curves
So far this just adds the API, if you use it, you'll get lots of
g_warnings().

This will be fixed in future commits.
2023-07-31 16:51:04 +02:00
Benjamin Otte
70077d9a2a path: Rename to gtk_path_builder_add_segment()
It's about bulding paths, not about measuring them.
2023-07-31 16:51:04 +02:00
Benjamin Otte
df34aceee1 path: Split contours into their own file
I'm not sure I want to keep all contours in one file, but for now that's
how it is.
2023-07-31 16:51:04 +02:00
Benjamin Otte
70c6756639 path: Make all private contour APIs take a GskContour
... instead of a path, index tuple.
2023-07-31 16:51:04 +02:00