Commit Graph

67968 Commits

Author SHA1 Message Date
Benjamin Otte
47ca0834a1 testsuite: Add relative path functions
They're making the paths slightly weirder, but they test public API, so
woohoo!
2020-12-27 20:08:52 +01:00
Benjamin Otte
d0f6346922 pathbuilder: Add relative path commands
And gsk_path_builder_get_current_point().

They will be needed by the string parser.
2020-12-27 20:08:52 +01:00
Benjamin Otte
8b330e3772 path: Add GSK_CIRCLE_POINT_INIT() to initialize points on the circle
This is just splitting out a commonly done operation into a macro.
2020-12-27 20:08:52 +01:00
Benjamin Otte
01a12b0fc8 pathbuilder: Redo semantics for starting curves
We now always have a "current point" which is either the last point an
operation was made to, or (0, 0) if no drawing operation has
been made yet.

Adding a contour of any kind to the builder will always update the
current point to that contour's end point.
2020-12-27 20:08:52 +01:00
Benjamin Otte
f3dfcbde4c xxx: demo 2020-12-27 20:08:52 +01:00
Benjamin Otte
1c308f00b9 path: Split GskPathBuilder into its own file
... and add missing API docs.
2020-12-27 20:08:52 +01:00
Benjamin Otte
4d38358b3a testsuite: Add a test using get_point() and get_closest_point() 2020-12-27 20:08:52 +01:00
Benjamin Otte
e9f4047251 testsuite: Add a test for get_point() 2020-12-27 20:08:52 +01:00
Benjamin Otte
cc2523b12f testsuite: Update create_random_path()
1. Allow specifying the max number of contours
2. Be smarter about creating the paths:
   With 10% chance, create a "weird" path like the empty one or only
   points or things like that.
   Otherwise create a bunch of contours, with 2/3 a standard contour,
   with 1/3 a predetermined one.
2020-12-27 20:08:52 +01:00
Benjamin Otte
0c3c5c95f7 gtk-demo: Add cute maze demo 2020-12-27 20:08:52 +01:00
Benjamin Otte
3533d58ff0 testsuite: Add tests for gsk_path_measure_get_closest_point() 2020-12-27 20:08:52 +01:00
Benjamin Otte
2cd08ecf77 path: Add gsk_path_measure_get_closest_point()
... and gsk_path_measure_get_closest_point_full().

Those 2 functions allow finding the closest point on a path to a given
point.
2020-12-27 20:08:52 +01:00
Benjamin Otte
758958a56e spline: Use Skia's tolerance checks
This avoids measuring being too far off (it's still off, but it's less
than a percent now.
2020-12-27 20:08:52 +01:00
Benjamin Otte
8cd37aa678 testsuite: Add tests for gsk_path_measure_add_segment() 2020-12-27 20:08:52 +01:00
Benjamin Otte
e6249c6318 gtk-demo: Add a text-on-path demo 2020-12-27 20:08:52 +01:00
Benjamin Otte
073c98aaeb xxx: path_fill demo 2020-12-27 20:08:52 +01:00
Benjamin Otte
4a1dcefca6 path: Add gsk_path_measure_get_point()
Allows querying the coordinates and direction of any specific point on a
path.
2020-12-27 20:08:52 +01:00
Matthias Clasen
e024982055 path: Add gsk_path_add_circle()
Adds a circle contour, too.
2020-12-27 20:08:52 +01:00
Benjamin Otte
9fd1dea356 pathmeasure: Implement support for beziers
Instead of treating bezier curves as lines, we properly decompose them
into line segments now so that we can treat those as lines.
2020-12-27 20:08:52 +01:00
Benjamin Otte
865c4dabda path: Implement gsk_path_to_cairo() using foreach() 2020-12-27 20:08:52 +01:00
Benjamin Otte
7ff39c6b60 path: Add gsk_path_foreach() 2020-12-27 20:08:52 +01:00
Benjamin Otte
811d24895d path: Collect flags
We don't need them yet, but maybe later.
2020-12-27 20:08:52 +01:00
Benjamin Otte
cda8d6608d testsuite: Add path tests 2020-12-27 20:08:52 +01:00
Benjamin Otte
53b64f63f1 pathmeasure: Add gsk_path_measure_add_segment()
This allows chunking paths, weeee.
2020-12-27 20:08:52 +01:00
Benjamin Otte
1783c9bdd8 path: Add gsk_path_builder_add_path() 2020-12-27 20:08:52 +01:00
Benjamin Otte
0e69f58c2b gsk: Add GskPathMeasure
An object to do measuring operations on paths - determining their
length, cutting off subpaths, things like that.
2020-12-27 20:08:52 +01:00
Benjamin Otte
d270456645 path: Change data structure for standard path
Instead of the Cairo method and imitating cairo_path_data_t, use the
Skia method and keep points and operations separate.

That way we get a points array that includes the starting point -
because it's always the end point of the previous operation.
2020-12-27 20:08:52 +01:00
Benjamin Otte
1a03d73f2d popover: Use fill and stroke nodes instead of Cairo
... to render the arrow.

The arrow should really be turned into a real thing - maybe an icon?
2020-12-27 20:08:52 +01:00
Benjamin Otte
ca2059bb13 snapshot: Add gtk_snapshot_push_stroke() 2020-12-27 20:08:52 +01:00
Benjamin Otte
7752462914 gsk: Add GskStrokeNode 2020-12-27 20:08:52 +01:00
Benjamin Otte
b9c6586d96 gsk: Add GskStroke
It's unused in this commit. This just prepares the new object.
2020-12-27 20:08:52 +01:00
Benjamin Otte
2713766632 demos: Add a simple demo filling a path 2020-12-27 20:08:52 +01:00
Benjamin Otte
95e72be25c snapshot: Add gtk_snapshot_push_fill() 2020-12-27 20:08:52 +01:00
Benjamin Otte
89cb8625fa gsk: Add GskFillNode
Take a rendernode as source and a GskPath and fill the region in the
path just like cairo_fill() would.
2020-12-27 20:08:52 +01:00
Benjamin Otte
8c6c1c6ffc gsk: Add GskPath 2020-12-27 20:08:52 +01:00
Benjamin Otte
72f5c6d931 API: Add gtk_picture_add_paintable_bounds()
Allows a caller to see where a picture has placed a paintable.
2020-12-27 20:08:52 +01:00
Benjamin Otte
08ee6c7acf mediafile: Load extension at startup with GTK_MEDIA
When the GTK_MEDIA env var is set, check at startup that it works, not
only when the first MeidaFile is instantiated.

This has the fortunate side effect that it prints help output for
GTK_MEDIA=help at startup, too.
2020-12-27 00:31:17 +01:00
Benjamin Otte
c815496fe3 gtk: Build as static library first
This allows linking against the static libgtk from the testsuite.

We build the dynamic library by linking all the static libraries into
the final product.
2020-12-27 00:31:16 +01:00
Benjamin Otte
9c84fa127a Merge branch 'unused-static-inline' into 'master'
Remove unused static inline function

See merge request GNOME/gtk!3002
2020-12-25 18:05:11 +00:00
Emmanuel Gil Peyrot
84c6708366 Remove unused static inline function
This was causing a warning on AArch64 since __LITTLE_ENDIAN__ and
__BIG_ENDIAN__ weren’t set, but the functions were actually completely
unused.
2020-12-25 16:16:43 +01:00
Benjamin Otte
f7e3016949 Merge branch 'gles-gears' into 'master'
Fix gtk4-demo’s gears demo on OpenGL ES

See merge request GNOME/gtk!3000
2020-12-25 01:36:34 +00:00
Emmanuel Gil Peyrot
dd1110ca5c Fix some of gtk4-demo’s transitions example on OpenGL ES
Same issue as the previous commit, int+float is error, and pow() only
works on floats.
2020-12-25 01:36:21 +01:00
Emmanuel Gil Peyrot
28c4adac24 Fix gtk4-demo’s gears demo on OpenGL ES
Here is a command to reproduce this testcase:
GDK_DEBUG=gl-gles gtk4-demo --run gears

Without this patch, Mesa throws this compile error:
0:130(13): error: no matching function for call to `mod(error, float)'; candidates are:

This is caused by `u_rotation - 90` being of type error since
`u_rotation` is a float and it’s illegal to subtract it with an integer.
2020-12-25 01:21:08 +01:00
Matthias Clasen
7e579bb59a Merge branch 'wip/otte/for-master' into 'master'
Wip/otte/for master

See merge request GNOME/gtk!2997
2020-12-24 07:13:22 +00:00
Benjamin Otte
96e1b85c2c gdkarray: Add a "stolen" boolean to splice()
If set to TRUE, does not call the free func for the removed items.

This can be used to move items between arrays without having to do the
refcounting dance.
2020-12-24 06:38:45 +01:00
Benjamin Otte
71e616d17e listview: Use the correct scroll policy
Use the horizontal policy for horizontal decisions, not the vertical
one.

This broke in 0011ce949c.
2020-12-24 06:38:45 +01:00
Benjamin Otte
f85d939e5e docs: Put render nodes in their own sections 2020-12-24 06:38:45 +01:00
Benjamin Otte
8d014d6cb0 roundedbox: Remove unused API 2020-12-24 06:38:45 +01:00
Benjamin Otte
f7f8990f7a picture: Fix copy/paste error in docs 2020-12-24 06:38:45 +01:00
Benjamin Otte
d6f288427a video: When autoplaying, start playing once the video is prepared
This fixe video sources with longer loading times not automatically
playing.
2020-12-24 06:38:45 +01:00