Commit Graph

67603 Commits

Author SHA1 Message Date
Benjamin Otte
8e2f90c887 path: Split GskPathBuilder into its own file
... and add missing API docs.
2020-12-06 18:53:17 +01:00
Benjamin Otte
705617a6d5 testsuite: Add a test using get_point() and get_closest_point() 2020-12-06 18:51:55 +01:00
Benjamin Otte
bc019bd1fc testsuite: Add a test for get_point() 2020-12-06 18:51:55 +01:00
Benjamin Otte
c9edcb1009 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-06 18:51:55 +01:00
Benjamin Otte
967968fb0b gtk-demo: Add cute maze demo 2020-12-06 18:51:55 +01:00
Benjamin Otte
9e7d3b4473 testsuite: Add tests for gsk_path_measure_get_closest_point() 2020-12-06 18:51:54 +01:00
Benjamin Otte
5819bfeca7 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-06 18:51:54 +01:00
Benjamin Otte
e611becb9f 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-06 18:51:54 +01:00
Benjamin Otte
541f7aa2bb testsuite: Add tests for gsk_path_measure_add_segment() 2020-12-06 18:51:54 +01:00
Benjamin Otte
7163015b1a gtk-demo: Add a text-on-path demo 2020-12-06 18:51:54 +01:00
Benjamin Otte
8422d7965f xxx: path_fill demo 2020-12-06 18:51:54 +01:00
Benjamin Otte
0092f55bd1 path: Add gsk_path_measure_get_point()
Allows querying the coordinates and direction of any specific point on a
path.
2020-12-06 18:51:54 +01:00
Matthias Clasen
3e8fcf4831 path: Add gsk_path_add_circle()
Adds a circle contour, too.
2020-12-06 18:51:54 +01:00
Benjamin Otte
a0c680011c 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-06 18:51:54 +01:00
Benjamin Otte
b8ddef040d path: Implement gsk_path_to_cairo() using foreach() 2020-12-06 18:51:54 +01:00
Benjamin Otte
a1f759336c path: Add gsk_path_foreach() 2020-12-06 18:51:54 +01:00
Benjamin Otte
acfcb9da6c path: Collect flags
We don't need them yet, but maybe later.
2020-12-06 18:51:50 +01:00
Benjamin Otte
b2fdb10aaa testsuite: Add path tests 2020-12-04 02:58:34 +01:00
Benjamin Otte
f92dbb8caa pathmeasure: Add gsk_path_measure_add_segment()
This allows chunking paths, weeee.
2020-12-04 02:58:34 +01:00
Benjamin Otte
484b7dd5f2 path: Add gsk_path_builder_add_path() 2020-12-04 02:58:34 +01:00
Benjamin Otte
307eccc451 gsk: Add GskPathMeasure
An object to do measuring operations on paths - determining their
length, cutting off subpaths, things like that.
2020-12-04 02:58:34 +01:00
Benjamin Otte
57227e8f64 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-04 02:58:34 +01:00
Benjamin Otte
a5b1842acf 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-04 02:58:34 +01:00
Benjamin Otte
e482dd739f snapshot: Add gtk_snapshot_push_stroke() 2020-12-04 02:58:34 +01:00
Benjamin Otte
c1b8eb50ed gsk: Add GskStrokeNode 2020-12-04 02:58:34 +01:00
Benjamin Otte
12c5bb6f8c gsk: Add GskStroke
It's unused in this commit. This just prepares the new object.
2020-12-04 02:58:34 +01:00
Benjamin Otte
16d504a78c demos: Add a simple demo filling a path 2020-12-04 02:58:34 +01:00
Benjamin Otte
e22a12bb42 snapshot: Add gtk_snapshot_push_fill() 2020-12-04 02:58:34 +01:00
Benjamin Otte
4fc6ef1a5f 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-04 02:58:31 +01:00
Benjamin Otte
5bda1e0d4b gsk: Add GskPath 2020-12-04 02:56:18 +01:00
Benjamin Otte
aca2f15f05 listview: Use the correct scroll policy
Use the horizontal policy for horizontal decisions, not the vertical
one.

This broke in 0011ce949c.
2020-12-04 02:56:18 +01:00
Benjamin Otte
b69e956d60 docs: Put render nodes in their own sections 2020-12-04 02:56:17 +01:00
Benjamin Otte
feaff8825c roundedbox: Remove unused API 2020-12-04 02:55:57 +01:00
Emmanuele Bassi
f1ff8f9aad Merge branch 'wip/chergert/macos-decelerate' into 'master'
macos: fix typo when creating scroll events

Closes #3418

See merge request GNOME/gtk!2916
2020-12-03 22:54:46 +00:00
Christian Hergert
115ea624d9 macos: fix typo when creating scroll events
This fixes an issue where we would ignore events with Y delta
and no X delta while scrolling due to a typo when checking for
any delta.

This fixes deceleration of kinetic scrolling on the macOS backend.

Fixes #3418
2020-12-03 13:46:47 -08:00
Matthias Clasen
6ecae6c5f8 Merge branch 'wip/chergert/gdk-macos-for-master' into 'master'
macos: fix motion event delivery after closing transient window

Closes #3419

See merge request GNOME/gtk!2910
2020-12-03 20:07:16 +00:00
Matthias Clasen
6d76b587cf Merge branch 'wip/chergert/shadertoy-macos-fix' into 'master'
demos: make alienplanet demo work on macOS OpenGL

See merge request GNOME/gtk!2915
2020-12-03 19:00:39 +00:00
Christian Hergert
8e62ff50fe demos: make alienplanet demo work on macOS OpenGL
On the macOS OpenGL implementation, the use of noise2 as a
function within the glsl shader collides with the builtin noise2 of a
different signature.

This changes the name to something similar (noize2) so that we
do not risk colliding names when linking.

With this commit, the shadertoy alienplanet demo works on mac
OpenGL (albeit still with the Cairo renderer).
2020-12-03 10:23:13 -08:00
Matthias Clasen
0daa905a27 Merge branch 'wip/otte/conic' into 'master'
Implement a GL shader for conic gradients

See merge request GNOME/gtk!2913
2020-12-03 17:14:01 +00:00
Emmanuele Bassi
d1a4ad3db6 Merge branch 'wip/tintou/gdk-backends-header' into 'master'
build: Use the correct path to the header of the wayland and x11 backends

See merge request GNOME/gtk!2914
2020-12-03 12:32:24 +00:00
Benjamin Otte
2c1bd399d2 glrenderer: Implement a shader for conic gradients 2020-12-03 13:07:17 +01:00
Benjamin Otte
fac5fba0dc rendernode: Fix some wrong constants for conic gradients
copy/paste from other nodes left some wrong values in there and that
screwed things up quite a bit.
2020-12-03 13:07:17 +01:00
Benjamin Otte
c907ad83b0 glrenderer: Emit more useful error messages
Catch the error when it happens, so that we can emit a specific and more
helpful error message.

Also verify that all branches in the code now do indeed set a proper
GError when they fail, so that the final catch-all is no longer needed.
Instead, assert that the error is set so that we catch future code
additions early that do not set the GError.
2020-12-03 13:07:17 +01:00
Corentin Noël
585ba777c2 build: Use the correct path to the header of the wayland and x11 backends 2020-12-03 10:02:03 +01:00
Matthias Clasen
f8ee4cfea5 NEWS: Updates 2020-12-02 23:10:39 -05:00
Matthias Clasen
35d2cbefe6 Merge branch 'wip/otte/conic' into 'master'
Add support for conic gradients

See merge request GNOME/gtk!2911
2020-12-03 03:54:24 +00:00
Christian Hergert
004f0a6596 macos: plug leak of application windows
This ensures that we don't leak window references inside the action muxer.
Otherwise, we risk not disposing the windows upon gtk_window_destroy()
and blocking the main loop from quitting.

Fixes #3419
2020-12-02 19:44:02 -08:00
Christian Hergert
b68e0bb3fb muxer: add helper to get group by name
This is useful when you need to read a group back out of the muxer.
2020-12-02 19:44:02 -08:00
Christian Hergert
92f0216605 macos: ensure element is part of queue
We don't want to risk decrementing length field unless this is actually
part of the queue.
2020-12-02 19:44:02 -08:00
Christian Hergert
e317b9be00 macos: maintain GList element consistency
We need to keep this consistent so that we can look things up
faster in other places. Therefore, just take the hit here and clear
the entire list ensuring prev/next poniters are cleared.
2020-12-02 19:44:01 -08:00