Commit Graph

191 Commits

Author SHA1 Message Date
Matthias Clasen
915c229396 gsk: Use harfbuzz for color fonts
harfbuzz has all the information we need, so we
can avoid poking directly at freetype apis. Also
drop the caching of color glyph information until
it turns out to be a problem.
2021-07-31 16:34:38 -04:00
Matthias Clasen
a7a2dbc3ea gsk: Cache per-glyph color information
We don't really want to load the bitmaps every time
we create a render node, so do it once and cache the
information on the PangoFont.
2021-07-31 16:34:38 -04:00
Matthias Clasen
bb9dccd773 gsk: Mark color glyphs
Steal a bit from PangoGlyphVisAttr to mark glyphs
that have color.
2021-07-31 16:34:24 -04:00
Matthias Clasen
b695ef9168 gsk: Add a shortcut for a common transform case
Add a private getter for the translation part of a
transform node, to avoid pulling it out of the transform
over and over.
2021-07-24 18:48:09 -04:00
Matthias Clasen
7fb1389648 gsk: Add a private getter for container children
No need to get them one-by-one, in our inner loop.
2021-07-24 18:48:09 -04:00
Matthias Clasen
2d266d107b gsk: Clean up docs syntax
Replace leftover gtk-doc syntax (#Type) with backquotes.
2021-05-22 17:25:26 -04:00
Matthias Clasen
7fe0610b68 introspection: Stop using allow-none
allow-none has been deprecated for a long time
already. Instead use optional and nullable everywhere.
2021-05-20 19:17:49 -04:00
Matthias Clasen
e6599c6c4f gsk: Don't overshadow
Reduce the cairo shadows to the same size as their GL brethren.
2021-04-09 21:47:55 -04:00
Matthias Clasen
2c33550048 gsk: Avoid empty glyphs early
Strip out PANGO_GLYPH_EMPTY when text nodes are
constructed. Then we don't have to check this special
case in the inner loop in visit_text_node.
2021-03-30 00:34:52 -04:00
Matthias Clasen
2d5dd7b3d7 gsk: Make rendernode diffing smarter
Allow comparing container nodes to any other
node, by pretending the other node is a single
child container (if it isn't one already).

This fixes a glitch where we redraw the full
entry text when the blinking cursor goes to
opacity 0, since GskSnapshot then optimizes
away first the opacity node, and then the
single-child container.
2021-03-28 10:26:06 -04:00
Matthias Clasen
0904dd29c2 gsk: Use floorf for floats 2021-03-28 10:26:06 -04:00
Andrey Kozlovskiy
6b48fb767d Fix a typo in gsk_border_node_diff
Typo was introduced in !3278 and results in an incorrect handling of different uniformity.
2021-03-17 15:38:01 +00:00
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