Commit Graph

179 Commits

Author SHA1 Message Date
Matthias Clasen
ca3120919f docs: Improve gsk docs
Convert link formats, add summaries, and make
a few missing things show up in the docs.
2021-03-11 16:37:31 +00:00
Matthias Clasen
bf59ddd01d gsk: Add gsk_border_node_get_uniform_color
Maintain this bit of information separately,
it will be useful in the next commit.
2021-03-09 12:15:25 -05:00
Bilal Elmoussaoui
6e903e13a5 g-i: add missing since annotations for 4.2 2021-03-07 19:50:32 +01:00
Emmanuele Bassi
a9c616284a gsk: Move from g_memdup() to g_memdup2()
The g_memdup() function is replaced by a safer version in newer versions
of GLib.
2021-02-11 14:22:22 +00:00
Christian Hergert
161ddcfa92 gsk: make render node getters const
This also removes the return if fail macros from these as a good portion
of them didn't have them anyway. I think it's fair to say that access to
these incorrectly is a programmer error.

It significantly reduces the amount of code generated into generally a
movss,ret.
2021-02-08 11:29:36 -08:00
Fabio Lagalla
0088f840fe gskrendernode: Cache angle in conic gradients 2021-01-27 12:44:10 +01:00
Timm Bäder
108933b655 Merge branch 'wip/chergert/volatile-fixes' into 'master'
types: fix various use of volatile in type registration

See merge request GNOME/gtk!2865
2020-12-29 07:49:12 +00: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
dee863dbb2 rendernode: Bail if matrix is invalid
Invalid matrices are okay in GSK (and GL), but not in Cairo.

Testcase included.
2020-12-24 06:38:45 +01:00
Timm Bäder
9fefa7b44c rendernode: Different uniformity in border nodes
Means they are different and a diff is impossible.
2020-12-21 10:26:03 +01:00
Timm Bäder
a2a70c3b65 rendernode: Sort diff() requirements by complexity 2020-12-21 10:26:03 +01:00
Matthias Clasen
e1df9a043f Add a doc comment for GskConicGradientNode 2020-12-15 14:18:26 -05: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
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
Benjamin Otte
55a242bd81 gsk: Add GskConicGradientNode 2020-12-03 00:47:54 +01:00
Emmanuele Bassi
0f62ab6c42 docs: Annotate all render node types 2020-12-01 15:51:52 +00:00
Christian Hergert
0d2ea14ac1 types: fix various use of volatile in type registration
The use of volatile was incorrect in GLib and has been that way for
a long time. Recently however that has changed, and this makes GTK
follow suit to avoid using volatile in the type registration.

See also: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1719

Combined with the above merge request for GLib, this fixes a large
number of compilation warnings when using Clang.
2020-11-18 20:21:33 -08:00
Benjamin Otte
1c7daece7a Merge branch 'wip/otte/for-master' into 'master'
Wip/otte/for master

See merge request GNOME/gtk!2855
2020-11-17 19:08:01 +00:00
Benjamin Otte
f2284ff40f rendernode: Rename all gsk_render_node_peek_*() functions
Those are getters, they should be gsk_render_node_get_*() functions.
2020-11-17 19:04:39 +01:00
Emmanuele Bassi
5a938ad83d Annotate the gsk_border_node_peek_widths() return value
We return a fixed sized C array of floats.
2020-11-17 13:48:07 +00:00
Matthias Clasen
07c338b487 gsk: Document radial gradient api 2020-09-29 07:04:07 -04:00
Alexander Larsson
7ea755e206 Add GskGLShaderNode and GskGLShader
A GskGLShader is an abstraction of a GLSL fragment shader that
can produce pixel values given inputs:
 * N (currently max 4) textures
 * Current arguments for the shader uniform
Uniform types are: float,(u)int,bool,vec234)
There is also a builder for the uniform arguments which are
passed around as immutable GBytes in the built form.

A GskGLShaderNode is a render node that renders a GskGLShader inside a
specified rectangular bounds. It renders its child nodes as textures
and passes those as texture arguments to the shader. You also pass it
a uniform arguments object.
2020-09-29 09:51:16 +02:00
Timm Bäder
f938377464 rendernodes: Clarify color_stops arguments 2020-09-18 19:01:10 +02:00
Timm Bäder
6e14b26622 gsk: Add docs for radial gradient nodes 2020-09-18 18:41:01 +02:00
Timm Bäder
5d5fbc69a4 rendernodes: Enfore end > start for radial gradient nodes 2020-09-18 18:29:08 +02:00
Timm Bäder
b8e4240751 gl renderer: Add radial gradient shader 2020-09-18 15:39:07 +02:00
Timm Bäder
2c5a4a799a rendernode: Pull local variable into closest scope 2020-09-18 15:39:07 +02:00
Timm Bäder
dbfc172f6a radial gradients: Allow 0 start/end values 2020-09-18 15:39:07 +02:00
Matthias Clasen
ebfb3e771d rendernode: switch to h/vradius 2020-09-18 15:39:04 +02:00
Matthias Clasen
0c6226c20b gsk: Add a radial gradient node
Only a fallback implementation for now.

Fixes #2262
2020-09-18 15:38:55 +02:00
Timm Bäder
51b398b960 rendernodes: Whitespace 2020-08-29 16:46:28 +02:00
Timm Bäder
e970c69843 gsk: Fix border node diff implementation
This was showing up in the interactive constraint demo in gtk4-demo.
2020-08-29 11:11:29 +02:00
Björn Daase
6315cd977c *: Fix spelling mistakes found by codespell 2020-08-21 15:29:34 +02:00
Matthias Clasen
9e5ddeaa8a gsk: Don't leak cairo nodes
Not chaining up in finalize is a leak, after all.
2020-08-06 18:35:41 -04:00
Rico Tzschichholz
7a58a6a097 gsk: Add annotations to improve GIR API 2020-07-31 20:56:36 +02:00
Emmanuele Bassi
4fa891b55d Remove stray gtk-doc annotation
It confuses the g-i scanner, and gtk-doc.
2020-07-28 16:49:13 +01:00
Timm Bäder
a3b452725b render nodes: Simplify diffing of uniform border nodes 2020-07-28 05:34:12 +02:00
Timm Bäder
2fa9dddea6 gsk: Remember border node uniformity
Lots of border nodes have all the same width and the same color.
Renderers might be able to simplifty that, so keep an extra bit per
border node.
2020-07-28 05:34:11 +02:00
Benjamin Otte
3078b180fe Replace "gdouble" with "double" 2020-07-25 00:47:36 +02:00
Benjamin Otte
d7266b25ba Replace "gint" with "int" 2020-07-25 00:47:36 +02:00
Timm Bäder
4800dd3f95 rendernode: Trivial whitespace change 2020-06-27 11:22:54 +02:00
Matthias Clasen
3d7c1f8950 gsk: Documentation fixups
Document a few missing symbols.
2020-06-05 20:19:45 -04:00
Yuri Chornoivan
01bd4cc4e1 Fix minor typos 2020-05-28 11:00:03 +03:00
Timm Bäder
b2b2070415 Implement diff() for color matrix nodes
This way we don't redraw color matrix nodes all the time.
2020-05-16 08:22:55 +02:00
Corentin Noël
076b2f11d2 docs: Fix several missing references in the documentation
This fixes several typos and missing references
2020-05-11 19:26:20 +02:00
Emmanuele Bassi
3f0a830f3c Properly annotate the render node constructors
Now that the GskRenderNode subclasses are recognised as proper
sub-types, we can annotate the constructors with their type. The C API
remains the same.
2020-04-08 16:17:08 +01:00
Emmanuele Bassi
e0323fcdc2 Add get_type() functions for GskRenderNode subclasses
The introspection scanner tries to match a type name with a get_type()
function, in order to correctly identify a type as a class.

If the function is not available, we have two choices:

 - add some special case inside the introspection scanner, similar to
   how GParamSpec subclasses are handled in GObject
 - add a simple get_type() function

The latter is the simplest approach, and we don't need to change that
much, since we still register all render nodes at once.
2020-04-08 16:07:04 +01:00
Emmanuele Bassi
d701a89281 Turn GskRenderNode into a derivable type
Language bindings—especially ones based on introspection—cannot deal
with custom type hiearchies. Luckily for us, GType has a derivable type
with low overhead: GTypeInstance.

By turning GskRenderNode into a GTypeInstance, and creating derived
types for each class of node, we can provide an introspectable API to
our non-C API consumers, with no functional change to the C API itself.
2020-04-08 15:40:15 +01:00
Benjamin Otte
6203cecf97 gsk: Clip shadow node before push_group()
We want to be sure to push a group that's as small as possible, so we
clip to the child's bounds, because that's the smallest we can go.
2020-02-13 07:36:38 +01:00
Benjamin Otte
6f9f18009c gsk: Add a utility function for rectangles
... and use it.
2020-02-13 07:36:38 +01:00