Commit Graph

111 Commits

Author SHA1 Message Date
Benjamin Otte
928c85ccc3 rendernodeparser: Parse Cairo nodes
We also print the script, but we don't parse it yet.
2019-05-26 00:50:13 +02:00
Benjamin Otte
fda643952d rendernode: Remove unused function 2019-05-25 23:50:46 +02:00
Benjamin Otte
29cb9230bf rendernode: Blur alpha channel for cairo blur node
The blur node still doesn't properly blur with a transform, but at least
it now doesn't turn semi-transparent stuff black.
2019-05-21 06:43:59 +02:00
Benjamin Otte
b90a66cab5 rendernodeparser: Allow parsing strings
Instead of only allowing for glyph indexes, allow ASCII characters as
replacements. So this glyph sequence
  glyphs: 65 8, 66 8, 67 8
Can be replaced by
  glyphs: "ABC"
provided that the glyph for "A", "B" and "C" are 65, 66 and 67
respectively and their advance is exactly 8.
x offset and y offset must always be 0 and every glyph must start a
cluster.
2019-05-21 06:43:59 +02:00
Benjamin Otte
a1d08b4b52 rendernode: Take a graphene_point_t for the offset
... instead of 2 floats.
2019-05-21 06:43:59 +02:00
Benjamin Otte
4505f4f17b rendernode: Set EXTEND_PAD when drawing textures 2019-05-12 15:41:53 +02:00
Timm Bäder
fb63364f30 rendernode: Remove old GVariant (de)serialization code
We're doing the CSS thing now.
2019-05-05 07:18:39 +02:00
Benjamin Otte
19227d9789 rendernode: Compute border node colors properly
Change the way we compute border color cutoffs to the same method that
browsers use. This method does not consider the corner sizes at all and
only looks at border-width.
2019-05-02 19:35:45 +02:00
Benjamin Otte
9b6f822f15 rendernode: Fix border rendering
This fixed the reftest introduced in the previous commit.

I'm using a mesh gradient here instead of drawing 4 individual sides to
avoid artifacts when those sides overlap in rounded corners.
2019-04-19 03:39:57 +02:00
Benjamin Otte
96f9cbcabf cssimage: Make cross-fade() an array
The new spec at https://drafts.csswg.org/css-images-4/#cross-fade-function
allows infinite images to cross-fade and we want to, too.
2019-04-12 19:34:28 +02:00
Benjamin Otte
c04190e761 rendernode: Round pixel colors in color matrix drawing
Fixes symbolic-icon-translucent-color.ui reftest
2019-03-29 09:56:52 +01:00
Benjamin Otte
18da852e15 rendernode: Add can_diff implementation for transform nodes
That one was missing and killing performance in the fishbowl.
2019-03-06 12:40:58 +01:00
Benjamin Otte
dbe58452d7 rendernode: Implement diffing of transform nodes
This reinstates diffing in the same way that it worked for offset nodes.

It would be possible to add diffing for affine transforms or even all
transforms, but I think this is unnecessary right now - and also quite
expensive to compute.
2019-03-04 23:41:51 +01:00
Benjamin Otte
bd113aa85c transform: Redo querying API
Make the API expect a tranform of the proper category instead of
doing the check ourselves and returning TRUE/FALSE.

The benefit is that the mai use case is switch (transform->category)
statements and in those we know the category and don't need to check
TRUE/FALSE.

Using the wrong matrix will now cause a g_warning().
2019-03-04 23:41:51 +01:00
Benjamin Otte
3cc84d2860 transform: Make category public API
Also rename it from GskMatrixCategory to GskTransformCategory.
2019-03-04 23:15:24 +01:00
Benjamin Otte
3a3c2d14ab rendernode: Make the transform node take a GskTransform
This is an attempt to push GskTransform deeper into the stack.
2019-03-04 23:15:07 +01:00
Timm Bäder
bbd4e2f60d transformnode: Avoid matrix multiplication if we can
If the given matrix is explicitly of category IDENTITY, we don't need to
do anything, and in the 2D_TRANSLATE case, just offset the child bounds.
Those are the two most common cases.
2019-02-28 07:22:34 +01:00
Benjamin Otte
0d119f81c8 snapshot: Refactor text rendering
The code didn't change, it was just shuffled around to make the
with_bounds() versions of the text rendering unnecessary and instead
pass through the generic append_node() path.
2019-02-21 19:47:28 +01:00
Benjamin Otte
e1570e9ebc snapshot: Add gtk_snapshot_append_border()
This is adding functions for the remaining render nodes.
2019-02-21 19:47:28 +01:00
Benjamin Otte
6a4bf2b993 gsk: Remove offset nodes
They were a neat idea while they lasted. But now, it's time for
categorized transform nodes, where matrices with
GSK_MATRIX_CATEGORY_2D_TRANSLATE are the exact replacement.

Renderers have not been adapted for this purpose, so they (continue to)
run slow paths.
2019-02-21 19:47:28 +01:00
Benjamin Otte
70a1233a28 gsk: Add GskMatrixCategory
We'll use that soon.
2019-02-21 19:47:27 +01:00
Timm Bäder
a0b8e32462 rendernodes: Fix unconditionally impossible diffs
Some of the _diff implementations did a whole bunch of work just to
throw it away afterwards and invalidate the entire union of the two
render nodes, most notably the two clip nodes. Fix this to only call
gsk_render_node_diff_impossible if the previous if-condition is FALSE
and not always.
2018-07-08 21:50:59 +02:00
Benjamin Otte
9fb3b84253 rendernode: Make offset nodes use floats
It's OpenGL stuff, use floats.
2018-07-04 15:05:37 +02:00
Benjamin Otte
49f9d2108d gsk: Add GskDebugNode 2018-04-24 04:06:58 +02:00
Benjamin Otte
1792f3b21e rendernode: Add missing return
Don't to extra work when not needed.
2018-04-05 18:40:54 +02:00
Benjamin Otte
200bbe8fda diff: Allow aborting a diff
When the max cost for finding a path gets to high, the diff can now be
aborted.

Because render nodes have a fallback method (by just marking the whole
bounds of the nodes as different), we use this to improve performance
of diffs.

This brings fishbowl (which is basically a container node with N images
that change every frame) back to close to previous performance.
2018-04-05 14:56:38 +02:00
Benjamin Otte
4b72ea33ac diff: Introduce GskDiffSettings
We can put lots of settings there to allow tuning the diff algorithm
used.
2018-04-05 14:56:38 +02:00
Benjamin Otte
a6079b9b7b gsk: Implement gsk_render_node_diff()
This includes a copy of the diff(1) algorithm used by git diff by Davide
Libenzi.

It's used for the common case ofcontainer nodes having only very few
changes for the few nodes of child widgets that changed (like a button
lighting up when hilighted or a spinning spinner).
2018-04-05 14:56:38 +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
Benjamin Otte
353ad30b12 rendernode: Fix serializing
Adding the offset node broke serialization in 2 ways:

1. We store the enum value in the node, so make sure to not change it
   for existing values
2. The offset node was missing in the deserialization lookup table
2018-03-26 19:43:06 +02:00
Benjamin Otte
ce743f28a1 rendernode: Add an offset node
This is a special case of the transform node that does a 2D translation.

The implementation in the Vulkan and GL renderers is crude and just does
the same as the transform node.

Nothing uses that node yet.
2018-03-26 18:16:36 +02:00
Benjamin Otte
e84c6acc4f rendernode: Remove renderer argument
It's not needed to create Cairo nodes anymore.
2018-03-24 21:57:20 +01:00
Benjamin Otte
df600669a2 rendernode: Create Cairo surfaces as recording surfaces
This way, we can postpone the actual rendeing of the node until the
renderer. This allows the renderer to choose the right scale to
render at, so it can decide to use 2x scale for hidpi on its own.

Last but not least, it makes all nodes independent of the context they
are created in, because they do not need to know at snapshot time what
they will ultimately be rendered into.
2018-03-24 21:57:20 +01:00
Timm Bäder
a9fec38680 rendernode: Don't use gdk_texture_download_surface
It can't handle the texture sizes we'd like to support
2018-03-20 09:40:10 +01:00
Timm Bäder
22780044ec rendernode: Don't use gdk_texture_download_surface
It can't handle the texture sizes we'd like to support
2018-03-20 09:37:59 +01:00
Benjamin Otte
d54ca3c74f gdk: Add GDK_MEMORY_DEFAULT
This is the default memory format.

I added it because it is way better than including a private header and
using GDK_MEMORY_CAIRO_FORMAT_ARGB32.
2018-03-18 05:57:07 +01:00
Benjamin Otte
ee8e42f19b gdk: Remove gdk_texture_new_from_data()
Use gdk_memory_texture_new() instead.
2018-03-18 05:57:07 +01:00
Timm Bäder
2d50d9ebe6 rendernodes: Add gsk_text_node_new_with_bounds
An alternative GskTextNode constructor that does no text measuring. That
way, we can measure the text before and check if the node will be
outside of the current clip anyway.
2018-03-04 19:12:04 +01:00
Timm Bäder
ee8132a439 rendernodes: Add missing nullable annotation 2018-03-04 19:12:04 +01:00
Timm Bäder
cac3e7705d gsk: Increase blur node bounds by blur radius
Otherwise, the resulting node will be too small and the result looks
clipped.
2018-02-27 14:12:25 +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
Benjamin Otte
83a687f891 rendernode: Don't alloca() 8MB
This happens when deserializing testcases and it really confuses
valgrind into thinking we're longjmp()ing.

And deserializing rendernodes is slow anyway, so who cares about a few
more malloc()s.
2018-02-03 16:24:13 +01:00
Timm Bäder
5e7b3030b9 rendernodeimpl: Fix a crash
We may get a NULL renderer here.
2018-01-17 21:57:20 +01: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
Matthias Clasen
2bab983ecf gsk: Fix hexbox drawing for fallback rendering
pango does not currently export api for drawing hex boxes,
but by using pango_cairo_show_glyph_string, we can reuse its
implementation.
2018-01-05 18:55:23 -05:00
Rico Tzschichholz
543b21430b gsk: Add docs for gsk_texture_node_get_texture 2018-01-03 08:17:23 +01:00
Emmanuele Bassi
481b5d1b89 Partially revert GskTexture → GdkTexture rename
Excessive use of sed when moving GskTexture to GDK; the GskTextureNode
should still live under the GSK namespace.
2017-11-04 15:06:00 +00: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
ea91ab1d99 gsk: Make text nodes more compact
The copy of the PangoGlyphString we do here was showing up
in some profiles. To avoid it, allocate the PangoGlyphInfo array
as part of the node itself. Update all callers to deal with
the slight api change required for this.
2017-10-27 17:13:40 -04:00
Emmanuele Bassi
dd4c800542 Remove unnecessary const
We return a scalar value, so we don't need it to be constant.

https://bugzilla.gnome.org/show_bug.cgi?id=789351
2017-10-23 15:23:09 +01:00