Commit Graph

92 Commits

Author SHA1 Message Date
Timm Bäder
52c46e5c24 rendernode: Don't clip when _draw()ing 2020-02-12 16:54:49 +01:00
Timm Bäder
05b9a99661 gsk: Remove some unused defines
These are from the GVariant days of render nodes.
2020-01-26 18:21:07 +01:00
Timm Bäder
77e0d360ed Add pure and const annotations to various functions 2020-01-26 18:21:07 +01:00
Benjamin Otte
4a19bab5b3 gsk: Fix annotations for ref()/unref() 2019-06-18 15:58:49 -04:00
Matthias Clasen
69016825aa render node: Optimize type checks
The GSK_IS_RENDER_NODE macro is a bit silly,
and not worth having in g_return_if_fail checks
in trivial getters.
2019-06-05 04:25:43 +00:00
Niels De Graef
df9aed6c61 Fix some GObject introspection annotations
Fixes several warnings by the GIR compiler.
2019-05-30 20:34:43 +02:00
Matthias Clasen
848f658b32 Trivial 2019-05-26 00:08:39 -04:00
Benjamin Otte
20d1bc2ccc rendernodeparser: Skip root node when it's a container
When printing, behave the same way as when parsing:
Magically skip a container node if there is one - just like the
parser magically creates a container node to hold all the nodes
it parses.
2019-05-21 06:43:59 +02:00
Timm Bäder
dde69802cd Add error func to node deserialization 2019-05-05 07:18:39 +02:00
Timm Bäder
01a7c7a8b2 Parse render nodes from text files
Instead of the previous approach using GVariant, this new approach uses
human-readable text files as the serialization format for render nodes.

The format is a custom one, but it is inspired by QML and conforms to
the CSS syntax. Because of that, we can use the CSS machinery from GTK
to parse it, and in particular share code to parse properties that GTK's
CSS machinery also supports, such as colors.

This commit breaks all existing usages of node files - such as the
testsuite and various test tools - they will be fixed in further
commits.
2019-05-05 07:18:39 +02:00
Benjamin Otte
c48be6ef96 Revert "Add aligned allocator functions to GSK"
This reverts commit 8e74eb382f.

This code is not necessary. It worked around a bug in graphene where
graphene was requiring stricter alignment than glib allocators could
guarantee.
2018-06-19 20:00:53 +02:00
Руслан Ижбулатов
a394a86151 Use aligned allocators for GskRenderNode
Any data that is later fed to graphene must be
allocated with proper alignment, if graphene
uses SSE2 or GCC vector instructions.
2018-06-09 14:05:49 +00:00
Benjamin Otte
b49dccb86d rendernode: Remove gsk_render_node_set_name()
And of course, gsk_render_node_get_name() is gone, too.
The replacement is of course debug nodes.

As a side effect, GskRenderNode is now *really* immutable.
2018-04-24 04:06:58 +02:00
Benjamin Otte
271820b677 rendernode: Add gsk_render_node_diff()
... and gsk_render_node_can_diff(). Those are vfuncs to compute a region
containing all the pixels that differ between the two nodes.

This is just the plumbing that chains into node classes. No node
implements it yet.
2018-04-05 14:56:38 +02:00
Alexander Larsson
391727bd0d GdkWindow -> GdkSurface initial type rename
This renames the GdkWindow class and related classes (impl, backend
subclasses) to surface. Additionally it renames related types:
GdkWindowAttr, GdkWindowPaint, GdkWindowWindowClass, GdkWindowType,
GdkWindowTypeHint, GdkWindowHints, GdkWindowState, GdkWindowEdge

This is an automatic conversion using the below commands:

git sed -f g GdkWindowWindowClass GdkSurfaceSurfaceClass

git sed -f g GdkWindow GdkSurface
git sed -f g "gdk_window\([ _\(\),;]\|$\)" "gdk_surface\1" # Avoid hitting gdk_windowing
git sed -f g "GDK_WINDOW\([ _\(]\|$\)" "GDK_SURFACE\1" # Avoid hitting GDK_WINDOWING
git sed "GDK_\([A-Z]*\)IS_WINDOW\([_ (]\|$\)" "GDK_\1IS_SURFACE\2"
git sed GDK_TYPE_WINDOW GDK_TYPE_SURFACE
git sed -f g GdkPointerWindowInfo GdkPointerSurfaceInfo

git sed -f g "BROADWAY_WINDOW" "BROADWAY_SURFACE"
git sed -f g "broadway_window" "broadway_surface"
git sed -f g "BroadwayWindow" "BroadwaySurface"
git sed -f g "WAYLAND_WINDOW" "WAYLAND_SURFACE"
git sed -f g "wayland_window" "wayland_surface"
git sed -f g "WaylandWindow" "WaylandSurface"
git sed -f g "X11_WINDOW" "X11_SURFACE"
git sed -f g "x11_window" "x11_surface"
git sed -f g "X11Window" "X11Surface"
git sed -f g "WIN32_WINDOW" "WIN32_SURFACE"
git sed -f g "win32_window" "win32_surface"
git sed -f g "Win32Window" "Win32Surface"
git sed -f g "QUARTZ_WINDOW" "QUARTZ_SURFACE"
git sed -f g "quartz_window" "quartz_surface"
git sed -f g "QuartzWindow" "QuartzSurface"

git checkout NEWS* po-properties
2018-03-20 11:40:08 +01:00
Matthias Clasen
4c150d8eb5 The big versioning cleanup
Remove all the old 2.x and 3.x version annotations.
GTK+ 4 is a new start, and from the perspective of a
GTK+ 4 developer all these APIs have been around since
the beginning.
2018-02-06 01:16:32 -05:00
Matthias Clasen
ba21a7764b gsk: Reorganize env vars
Get rid of GSK_RENDERING_MODE and add the flags to GSK_DEBUG,
following the same pattern we use in gdk now.
2018-01-14 17:05:04 -05:00
Matthias Clasen
c56419818f gsk: make logging per-renderer
Add a setter for per-renderer debug flags, and use
them where possible. Some places don't have easy access
to a renderer, so this is not complete.
Also, use g_message instead of g_print throughout.
2018-01-14 17:05:04 -05:00
Benjamin Otte
52b1cd40d1 gsk: Remove gsk_render_node_set_scaling_filters()
This is a leftover from the very early rendernode that we forgot to delete.

This can be seen by the fact that it is settable on an immutable object.
2017-12-03 21:57:21 +01:00
Benjamin Otte
ca3c23662c GskTexture => GdkTexture
We want this thing to replace GdkPixbuf, so it has to live in GDK.
2017-11-04 00:07:13 +01:00
Matthias Clasen
e474e9e274 Remove some outdated information
Render nodes don't have transformations, currently.
Only transform nodes do.
2017-10-20 13:54:01 +02:00
Matthias Clasen
f6626a9e0e gsk: Documentation additions
Document newly added apis, and ensure that all public apis
are listed in the docs.
2017-09-24 22:26:39 -04:00
Matthias Clasen
8db13c3362 gsk: Improve debug output
If we don't have node names, we can still print class names.
2017-09-03 10:32:55 -04:00
Garrett Regier
23d10df6c6 gsk: Fix memory leak in gsk_render_node_write_to_file() 2016-12-23 07:22:41 -08:00
Benjamin Otte
4bb0c70c11 gsk: Add docs and error handling to serialization API 2016-12-23 08:11:01 +01:00
Benjamin Otte
5e089c4345 gsk: Add gsk_render_node_write_to_file()
For when you're in a debugger and need to have a closer look at this
node...
2016-12-23 08:11:01 +01:00
Benjamin Otte
087ea8e531 gsk: Warn on cairo errors during gsk_render_node_draw()
It's the same warning we use inside GTK for when stuff weirdly goes
wrong.
2016-12-23 08:11:01 +01:00
Benjamin Otte
c88d279416 gsk: Add gsk_render_node_serialize/deserialize()
This does a conversion to/from GBytes and is intended for writing tests.

It's really crude but it works.
And that probably means Alex will (ab)use it for broadway.
2016-12-23 08:11:00 +01:00
Alexander Larsson
230d27b079 GskRenderNode: Use C99 flexible arrays to avoid extra allocation
Instead of a separate allocation for any arrays in the render node
we allocate these as part of the render node itself, using C99
flexible arrays.

This leads to less allocations, which is nice, but the major reason
for this is that it allows us to change the allocation scheme further
in the future. For instance, we want to do stack-like allocation so
that all the render-nodes for an entire frame are allocated in one
(or a few) chunks.
2016-12-21 14:01:34 +01:00
Alexander Larsson
22110ef5a4 gsk: Add bounds member to RenderNode
Instead of constantly recalculating this (especially recursively for
parents!) we do it only on construction, because everything is
immutable anyway. Also, most nodes had a bounds already and can
use the new parent member instead.

We also do direct access to the node bounds rather than calling
gsk_render_node_get_bounds in various places, which means
we do less copying.
2016-12-21 14:01:34 +01:00
Alexander Larsson
2d4b46f4f9 gsk: Drop gsk_render_node_make_immutable, nodes are always immutable 2016-12-21 14:01:34 +01:00
Benjamin Otte
cf520b7a1f gsk: Add blend nodes
Implement blend mode support in GTK background compositing with it.
2016-12-20 18:01:11 +01:00
Benjamin Otte
07d39299ea gsk: Replace gsk_render_node_set_opacity()
... with gsk_opacity_node_new().

Also implement support for opacity in gtk_widget_snapshot() using this
new node.
2016-12-20 18:01:10 +01:00
Benjamin Otte
e82d02432e gsk: Add gsk_render_node_draw()
Draws a node to a given cairo_t. This is mostly intended for fallback
usage.
2016-12-20 18:01:10 +01:00
Benjamin Otte
67fb129ed7 gsk: gsk_render_node_set_transform() => GskTransformNode
Instead of having a setter for the transform, have a GskTransformNode.

Most of the oprations that GTK does do not require a transform, so it
doesn't make sense to have it as a primary attribute.

Also, changing the transform requires updating the uniforms of the GL
renderer, so we're happy if we can avoid that.
2016-12-20 18:01:10 +01:00
Benjamin Otte
19753062c4 gsK: Move children handling to GskContainerNode 2016-12-20 18:01:09 +01:00
Benjamin Otte
e2625f8649 gsk: Remove GskRenderNode::parent
... and all related APIs.
2016-12-20 18:01:09 +01:00
Benjamin Otte
a8f2b3e75e gsk: Remove world matrix support
Use the real transform and compute it manually.
2016-12-20 18:01:09 +01:00
Benjamin Otte
3eb7c4719b gsk: Remove gsk_render_node_set_bounds()
gsk_render_node_get_bounds() still exists and is computed via vfunc
call:
- containers dynamically compute the bounds from their children
- surface and texture nodes get bounds passed on construction
2016-12-20 18:01:09 +01:00
Benjamin Otte
4d376c80f3 gsk: Remove gsk_render_node_get_size()
In the brave new world of refactored render nodes, this function doesn't
really make any sense anymore. We could turn it into a vfunc, but I
don't think it's useful.

Especially because even in the brave old world, this function was
causing a vastl overallocation of nodes when the GL renderer needed render
targets.
2016-12-20 18:01:09 +01:00
Benjamin Otte
d907f60843 gsk: Add GskRenderNodeClass.make_immutable() 2016-12-20 18:01:09 +01:00
Benjamin Otte
e4ee65fd19 gsk: Remove gsk_render_node_set_opaque()
If we ever feel, we need this function again, we can readd it later.

But nobody is using it other than for overriding opactiy. And you can
just override opacity directly if you care.
2016-12-20 18:01:09 +01:00
Benjamin Otte
684d25bd1a gsk: Add custom structs to RenderNode subclasses
So now we don't need to keep a texture pointer and a surface pointer and
so on in the base struct.
2016-12-20 18:01:09 +01:00
Benjamin Otte
be8b9406e5 gsk: Add GskRenderNodeClass.finalize() 2016-12-20 18:01:09 +01:00
Benjamin Otte
f16d523cb2 gsk: Introduce GskRenderNodeClass
This is modeled after GtkCssValueClass. So far it doesn't do anything.
2016-12-20 18:01:09 +01:00
Benjamin Otte
3af4fba895 gsk: Split render node subclasses out into their own file 2016-12-20 18:01:09 +01:00
Benjamin Otte
abd184efc9 gsk: Remove gsk_render_node_is_surface/texture()
Use gsk_render_node_get_node_type() instead.
2016-12-20 18:01:09 +01:00
Benjamin Otte
cb5c5170f4 gsk: Remove unneeded children modifiers
Creating render nodes is fire-and-forget, so all one should do is create
a container, append, append, append and then send it off to the
renderer. So there's no need to replace, insert between or anything
else.
2016-12-20 18:01:09 +01:00
Benjamin Otte
52d2faef88 gsk: Add gsk_cairo_node_new()
Split off Cairo drawn content nodes and require you to allocate them
using this new function.
2016-12-20 18:01:09 +01:00
Benjamin Otte
8c8691b469 gsk: Add gsk_texture_node_new()
Start the transition into the different node types.
2016-12-20 18:01:09 +01:00