Commit Graph

2220 Commits

Author SHA1 Message Date
Matthias Clasen
4229a37e90 arc: Fix the derivative
Scale the derivative such that computing the arc length
of a unit quarter circle wil produce the expected result
of PI/2.
2023-08-23 22:18:52 -04:00
Matthias Clasen
12297fd88a arc curve: Simplify derivative 2023-08-23 22:11:22 -04:00
Matthias Clasen
7943610066 curve: Fix arc decomposition 2023-08-23 22:11:15 -04:00
Matthias Clasen
f6c2b6bb88 Make foreach work efficiently with arcs 2023-08-23 14:51:31 -04:00
Matthias Clasen
4ab03e79b7 Drop some unnecessary code
We tell path_foreach to split into lines or cubics,
so no point in having code to handle quads and arcs.
2023-08-23 14:33:25 -04:00
Matthias Clasen
7a12abdea3 Incorporate review feedback 2023-08-23 14:16:43 -04:00
Matthias Clasen
71584107b0 Add gsk_path_builder_html_arc_to
This one draws circular arcs with a given radius.
2023-08-23 12:43:52 -04:00
Matthias Clasen
88c0ace644 Make gsk_path_builder_svg_arc_to public
This is useful to port SVG paths using this syntax.
2023-08-23 12:43:52 -04:00
Matthias Clasen
d33ed4f9ab path: Add elliptical arcs
Add a new curve type for elliptical arcs
and use it for rounded rectangles and circles.
We use the 'E' command to represent elliptical
arcs in serialized paths.
2023-08-23 12:43:52 -04:00
Benjamin Otte
de8fdd822c Merge branch 'wip/otte/for-main' into 'main'
widget: Remove unused headers from gtkwidget.h

See merge request GNOME/gtk!6319
2023-08-22 07:38:57 +00:00
Matthias Clasen
486674927a Make sure stroke bounds are big enough
Our standard 'empty path' in gtk4-node-editor
was getting its pointy corners cut off.
2023-08-21 23:59:08 -04:00
Matthias Clasen
b367bf83b4 docs: Tweaks 2023-08-21 22:40:22 -04:00
Matthias Clasen
b84f60877d docs: Drop a nonexisting enum value 2023-08-21 21:52:53 -04:00
Matthias Clasen
fb0f5b5c14 curve: Add a get_crossing vfunc 2023-08-21 11:29:14 -04:00
Matthias Clasen
2b4e577b53 docs: Add more illustrations
Add illustrations to the various curve_to methods
of GskPathBuilder.
2023-08-20 22:28:06 -07:00
Benjamin Otte
29cdac18e8 rendernodeparser: Handle dashing in strokes
That part of the original MR got lost while refactoring.

Put it back.
2023-08-21 05:23:44 +02:00
Benjamin Otte
418f6b35af gsk: Add gsk_rect_to_float()
... and use it.
2023-08-21 05:23:42 +02:00
Benjamin Otte
d665d2fb89 vulkan: Add nonuniformEXT() where needed
The magical term to know about (because the GLSL compiler or the
validation layers sure as hell don't) is:

  "dynamically uniform expression"

because if you don't have that when indexing a texture or buffer array,
you need to add nonuniformEXT() around the index variable.

Fixes the close icon on AMD having glitches of the previous icon visible
in some pixels.
2023-08-21 05:19:44 +02:00
Benjamin Otte
8862666b5a build: GSK doesn't depend on gdk-pixbuf 2023-08-21 05:19:37 +02:00
Benjamin Otte
3adf02445f build: Don't use configure_file() when custom_target() works
These two files don't need to be built when configuring, they are only
needed during build.
2023-08-21 05:19:37 +02:00
Matthias Clasen
b12a27083d path: Drop special contour parsing
This is not used currently, since we don't
have custom contours.
2023-08-18 18:06:44 -04:00
Matthias Clasen
07ec266a00 curve: Add a get_derivative vfunc 2023-08-18 13:46:42 -04:00
Matthias Clasen
88e74ca21e path: Don't accept 'O' as path command
We don't have conics atm.
2023-08-18 13:19:48 -04:00
Matthias Clasen
148da12cfc Cosmetics 2023-08-18 13:19:33 -04:00
Matthias Clasen
0c39890e0f contour: Optimize bounds
Cache the bounds in the contour, and compute
the stroke bounds based on it as well.
2023-08-18 10:02:14 -04:00
Matthias Clasen
73853f1a6b contour: Add an assertion 2023-08-16 16:18:38 -04:00
Matthias Clasen
8634d67cff Some fixes for gsk_path_builder_add_segment
We must be careful with single-point contours
that contain just a move. These never occur in
practice, but our randomized tests produce them
regularly.
2023-08-16 16:15:26 -04:00
Matthias Clasen
125ea90894 Rename an internal function
We want the number of ops, not the number of points.
2023-08-16 15:54:46 -04:00
Benjamin Otte
7d5ef1117e Merge branch 'color-matrix' into 'main'
Color matrix node fixes & clarifications

See merge request GNOME/gtk!6290
2023-08-16 17:07:35 +00:00
Sergey Bugaev
246a7cfeab rendernode, snapshot: Slightly expand color matrix docs
Based on reverse engineering the color node and contrary to my
expectations, the matrix/offset is expressed in, and applied to,
unpremultiplied colors. The colors are being explicitly
unpremultiplied, transformed according to the matrix/offset, and
premultiplied back (see color_matrix.glsl). The matrix is getting
transposed.

Also, copy the same blurb to the corresponding GtkSnapshot function.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
2023-08-16 13:55:04 +03:00
Philip Chimento
823cb714ec introspection: Remove 'caller-allocates' from POD types
The (out caller-allocates) and (out callee-allocates) annotations are
meant for structured or pointer types. Plain old data types are just
regular out parameters and don't need the annotation about who allocates
them.

See glib!2005, gjs#570
2023-08-15 22:30:27 -07:00
Matthias Clasen
5cf9a09c07 gsk: Add more details to the docs 2023-08-15 12:38:24 -04:00
Matthias Clasen
45aa8e4e00 Fix GskStandardContour to have a 'good' size
We need the size of GskStandardContour to be
at least as aligned as graphene_point_t, or
things break in hard to debug ways.
2023-08-14 15:59:45 -04:00
Matthias Clasen
a85ab3585e Revise gsk_path_point_get_tangent
Update the directions enum to allow all four
tangents to be obtained. Add an illustration
to the docs for clarity.

Update all callers.
2023-08-14 14:58:22 -04:00
Matthias Clasen
a1d40c5236 Add gsk_path_point_get_rotation
This returns the tangent in the form of an angle.
2023-08-14 14:58:22 -04:00
Matthias Clasen
6ace4b60d8 pathpoint: Revise argument order
In order for introspection and documentation to
not be confused, we need to have the GskPathPoint
be the first argument.

Update all callers.
2023-08-14 13:20:34 -04:00
Bilal Elmoussaoui
f5d47a4658 gi: Add missing since annotation 2023-08-14 08:41:12 +00:00
Matthias Clasen
4b7e1b1233 Fix gsk_path_builder_add_segment
We were splitting the last segment, but did not
actually use the result of the split. Oops.
2023-08-13 09:40:19 -04:00
Benjamin Otte
73500f9ebb Merge branch 'wip/otte/for-main' into 'main'
treeviewcolumn: Set ascending class for ascending order

Closes #6002

See merge request GNOME/gtk!6277
2023-08-13 03:54:19 +00:00
Benjamin Otte
67a4279d3f rendernode: Put typedef into gsktypes.h
Makes includes simpler for headers that want to use GskRenderNode.
2023-08-12 23:13:47 +02:00
Benjamin Otte
dd4b8a4c89 gl: Pass swizzle array directly
There's no need to pass pointers to arrays, as arrays are already
pointers.
2023-08-12 23:13:23 +02:00
Benjamin Otte
d1c7376b05 gdkcontext: Make has_unpack_subimage() do the version check
Makes the code look simpler when we actually use that function.
2023-08-12 23:13:23 +02:00
Matthias Clasen
11f48f3c5b Add gsk_path_builder_add_rounded_rect
For now, this is using gsk_path_builder_svg_arc_to
to approximate elliptical arcs.
2023-08-12 15:34:54 -04:00
Matthias Clasen
fa4ad1590d Merge branch 'matthiasc/for-main' into 'main'
path: Some documentation improvements

See merge request GNOME/gtk!6273
2023-08-11 16:42:25 +00:00
Matthias Clasen
47ddc742fc path: Some documentation improvements
Among other things, add a quick summary of
SVG path syntax, and add a few illustrations.
2023-08-11 12:09:12 -04:00
Matthias Clasen
f2835bb48b pathbuilder: Treat current point consistently
Arrange that none of the 'add' methods change
the current point.
2023-08-10 22:56:47 -04:00
Matthias Clasen
fff1645060 path builder: Fix add_cairo_path
We were forgetting to end the current contour.
2023-08-10 16:08:32 -04:00
Matthias Clasen
4e91cd1155 Merge branch 'matthiasc/for-main' into 'main'
pathpoint: Use the right type

See merge request GNOME/gtk!6266
2023-08-09 20:37:14 +00:00
Matthias Clasen
2d923d362f Merge branch 'bilelmoussaoui/gi-gsk' into 'main'
gsk/gi: new Path api fixes

See merge request GNOME/gtk!6265
2023-08-09 19:40:53 +00:00
Matthias Clasen
b7544636d4 contour: Skip the move
When jumping between segments, we always
need to skip index 0, since thats the move.

This fixes the tangent checks in the
rectangle tests.
2023-08-09 15:12:58 -04:00