Commit Graph

2906 Commits

Author SHA1 Message Date
Matthias Clasen
b3451dda04 css: Fix relative font sizes
This regression was introduced in aeac2b54.

We need percentage values to stay non-computed, since we otherwise
fail to compute relative font sizes properly. But we want percentages
not to stick around in relative colors, so tweak things to be more
aggressive with simplication when creating relative color values.

Update affected tests.

Fixes: #6868
2024-07-26 08:45:58 -04:00
Matthias Clasen
8d87ed1a6a Add tests
Add some more texture conversion roundtrips. They are currently
ifdefed out, since they need cicp api.

Also add another test binary for internal tests.
2024-07-24 16:45:21 -06:00
Benjamin Otte
9e27acb0a6 gpu: Allocate Vulkan descriptor pools dynamically
Instead of allocating one large descriptor pool and hoping we never run
out of descriptors, allocate small ones dynamically, so we know we never
run out.

Test incldued, though the test doesn't fail in CI, because llvmpipe
doesn't care about pool size limits. It does fail on my AMD though.

A fun side note about that test is that the GL renderer handles it best
in normal operationbecause it caches offscreens per node and we draw the
same node repeatedly.
But, the replay test expands them to duplicated unique nodes, and then
the GL renderer runs out of command queue length, so I had to disable
the test on it.
2024-07-22 19:40:24 +02:00
Benjamin Otte
9be7104b71 testsuite: Add a save=>load cycle test for PNGs with colorstates 2024-07-16 22:04:11 +02:00
Benjamin Otte
31e0ec71f2 png: Add color state support
When loading or saving png files, encode the CICP flags of the color
state into the PNG.

When loading, decode the CICP flags if available and detect the
colorstate they use.
If we do not support the cicp tags, we do not load the image.

So far, we ignore the ICC profiles.

Includes regeneration of nodeparse test *reference* output to include
the new tags we write to PNGs.
The original tests do not include those tags, so we implicitly test that
we read untagged files correctly.
2024-07-16 22:04:10 +02:00
Matthias Clasen
b33b68ef75 dmabuf texture: color state support 2024-07-16 21:23:44 +02:00
Benjamin Otte
77da45a173 testsuite: Update colorstate test 2024-07-16 21:23:44 +02:00
Benjamin Otte
05953a20cc testsuite: Allow colorstate properties to have SRGB as default value
This needs custom code because boxed paramspecs always default to NULL.
But we want to always default to SRGB.
2024-07-16 21:23:44 +02:00
Matthias Clasen
b0effee9b3 colorstate: Add tests for conversions
Test roundtrip tests between color states.

For now, this just tests srgb<>srgb-linear.
2024-07-12 18:14:54 -04:00
Matthias Clasen
4253bb9922 memoryformat: Add test for depth merging
We want to ensure a few invariants:
- merge (a, a) == a
- merge (a, b) == merge (b, a)

Add tests to verify that this is now the case.
2024-07-11 14:57:20 +02:00
Matthias Clasen
5297c5f2ee gdk: Give textures a color state
Adds gdk_texture_get_color_state() and GdkTexture::color-state property.

All texture implementations initialize the property to SRGB for now.
2024-07-11 14:57:19 +02:00
Matthias Clasen
aa746bc0c8 gdk: Add GdkColorState
This is mostly an empty shell for now. We only have static instances
for srgb and srgb-linear, which we will use as markers during our
node processing.

In the future, this object may grow more instances, as well as the
ability to create them from and save them to icc profiles or cicp
data. And a color conversion API.
2024-07-11 14:57:19 +02:00
Benjamin Otte
1001445d3e testsuite: Add test for empty glshader node
Everyone should draw the error pink here, because that's what the
renderers not supporting it do, and it's also what the default shader
does.

So no matter if a renderer supports GL shaders or not, it should draw
the same pink.
2024-07-11 13:34:36 +02:00
Benjamin Otte
6065165060 Add gdk_dihedral_swaps_xy
This function determines if a dihedral transform swaps x and y.
2024-07-10 21:34:12 +02:00
Matthias Clasen
61c22d1c72 Add a test for dihedral transforms
This reveals that the multiplication and inverse aren't quite
right.
2024-07-10 21:34:12 +02:00
Benjamin Otte
efacf2ff09 testsuite: Add tests for dihedral transforms
Just to make sure stuff shows up in the right place.
2024-07-10 21:34:12 +02:00
Benjamin Otte
83c2766e3f rendernode: Handle rotation transforms in opacity calculations
Tests included.
2024-07-10 21:34:12 +02:00
Benjamin Otte
3221a8bdab gdk: Rename GdkTextureTransform to GdkDihedral
... and put it into its own header.

We want to use it in more places and the name and location are awkward.
2024-07-10 12:36:07 +02:00
Benjamin Otte
bd3e596243 Merge branch 'wip/otte/for-main' into 'main'
rect: There's no coverage witout overlap

Closes #6849

See merge request GNOME/gtk!7435
2024-07-09 23:39:51 +00:00
Benjamin Otte
9a6e61e510 rect: There's no coverage witout overlap
The rectangles need to touch/overlap in both directions, otherwise
there's no coverage that covers both rectangles.

Test included.

Fixes rendering glitches in various apps when redrawing.

Fixes: #6849
2024-07-10 00:28:33 +02:00
Matthias Clasen
56d2d65e25 Merge branch 'css-color-fixes' into 'main'
css: Resolve color coordinates properly

Closes #6833

See merge request GNOME/gtk!7430
2024-07-09 14:20:00 +00:00
Benjamin Otte
1dd905d976 gpu: Fix wrong rect check in occlusion fallback path
We need to check that the clip is inside the opaque region, not that the
opaque region is inside the clip.

Test included, using the only not that hits the fallback path with an
opaque region smaller than its bounds.
2024-07-08 23:07:36 +02:00
Matthias Clasen
960967623a Add css value tests
Add some tests that check the details of calling compute() and
resolve() on number and color values.
2024-07-08 16:47:29 -04:00
Matthias Clasen
168203ab0c css: Fix a font-weight parser test
0 is not a valid font weight.
2024-07-08 16:09:35 -04:00
Matthias Clasen
f2fff53169 testsuite fixes 2024-07-08 16:09:35 -04:00
Matthias Clasen
f74b8f715a css: Fix legacy relative colors
If the color was specified using the legacy rgb(), we must accept
values in the range [0, 255]. But when serializing it as
color(srgb...), we must scale those values to [0, 1].

Update the one affected test.
2024-07-08 16:09:35 -04:00
Matthias Clasen
95c21acec1 css: For color, inherit the used value
When the color property is inherited, don't resolve the inherited
value to find the used value, just inherit the used value of the
parent style.

This is what browsers do, even though the spec says something else.

Update the currentcolor4 style test to reflect these changes.

Fixes: #6833
2024-07-08 14:53:00 -04:00
Matthias Clasen
7f6dce1c22 Add another css style test 2024-07-08 14:53:00 -04:00
Matthias Clasen
657e536941 Add more currentcolor css tests 2024-07-08 13:51:26 -04:00
Benjamin Otte
6d564075f3 gsk: texture-scale nodes with non-integer bounds aren't opaque
Due to the way the intermediate offscreen gets drawn, we might end up
with seams at the edges.

And I don't think it's worth spending more time on than saying "not
opaque".

Fixes the compare-render testsuite

New testcase included.
2024-07-08 15:28:14 +02:00
Benjamin Otte
329dc9e0cf gpu: Change get_opaque() implementation of containers
We want to be able to express opaque grids. This means that the app
provides either a row of columns of opaque nodes or a column of rows,
and then the containers will magically figure it out.

The main use case for this is terminals, which are uilt using cells. And
when there's a transparent background configured but the contents are
opaque, it'd be nice if we could figure that out.

Also remove the 80% requirement. It is rather arbitrary and while it
helps for some cases, the aforementioned grid would suffer.
2024-07-08 15:28:14 +02:00
Benjamin Otte
1a2b1575d6 rendernode: Add fully-opaque flag
Allows rendernodes to advertise themselves as fully opaque.

This is used as a fast path for get_opaque_rect().
2024-07-08 15:28:14 +02:00
Benjamin Otte
cc25fdf602 testsuite: Add test runner for opacity tests
Tests are node files dumped into testsuite/gsk/opaque
They are named "name-X-Y-W-H.node" with X Y W H being the expected
opaque rectangle or "name.node" if there is no opacity.

A simple example is included here.
2024-07-08 15:28:14 +02:00
Matthias Clasen
5a59548d72 Merge branch 'fix-offload-transforms' into 'main'
offload: Don't assert things that might fail

Closes #6824

See merge request GNOME/gtk!7407
2024-07-08 12:58:28 +00:00
Matthias Clasen
a858736516 Merge branch 'matthiasc/for-main' into 'main'
ci: Add another offload test

See merge request GNOME/gtk!7414
2024-07-08 12:16:49 +00:00
Matthias Clasen
880c33a777 offload: Don't assert things that might fail
We can in fact meet complex transforms here. Asserting that they
are simple doesn't make it so. Instead, simply bail out if a
transform is too complex; in this case we can't offload anyway,
so no need to walk the tree further.

Test included.

Fixes: #6824
2024-07-08 08:15:02 -04:00
Matthias Clasen
c32ab9440d Merge branch 'document-save-icon' into 'main'
Add missing icon

See merge request GNOME/gtk!7416
2024-07-08 11:01:00 +00:00
Benjamin Otte
31a907be35 gpu: Make sure textures used as image are mipmapped
When getting a texture as image, we were always returning the texture
unconditionally.

However, we want to mipmap textures when the scale factor is too large,
and this code path did not do that.

The same codepath on the GL renderer doesn't do that either, so the test
is disabled for it.
2024-07-07 12:54:05 +02:00
Benjamin Otte
10a7650411 testsuite: Generate mask correctly
There's a corner case with width/height being exactly 25 pixels.
And of course I was hitting it with one of my tests.
2024-07-07 12:54:05 +02:00
Balló György
017510ea5f Add missing icon
The fullcolor 'document-save' icon is used in the print dialog for the
'Print to File' element.
2024-07-05 13:22:54 +02:00
Benjamin Otte
c43c0275e3 testsuite: Improve memorytexture printing code
* The variables are const. Keep them const when casting

* Print float16 values

* Print integer values as hex. This is better for detecting
  byteswapping, off by one, and such. Besides, we tend to use values
  that have the same 2 hex digits, so detecting corruption is also easy.
2024-07-05 13:16:56 +02:00
Benjamin Otte
df5d233155 testsuite: Print the right pixel
Typo made us pass the wrong values
2024-07-05 13:16:56 +02:00
Benjamin Otte
a8238c2251 testsuite: Make png file argument optional
Just default to the node file but with a .png extension.
2024-07-05 10:43:28 +02:00
Benjamin Otte
32625381fa gsk: Deprecate GskGLShader and the rendernode
The new renderers don't support them due to the required complexity of
integrating them with Vulkan and the assumptions those nodes make about
the renderer (the GL renderer exports its internal APIs into the
GLShader).

There haven't been any complaints that I'm aware of since 4.14 was
released where the default renderer does not support the nodes, so usage
in public seems to be close to nonexistant.

The 2 uses I know of were workarounds about missing features in GTK that
have stopped since GTK now supports them:

1. GStreamer used in to do premultiplication when the old GL renderer
   did not do so in hardware but on the CPU.
2. Adwaita used it for masking before the mask node wa added in 4.10.
2024-07-04 21:28:06 +02:00
Matthias Clasen
7f7e4ab69e ci: Add another offload test
Sadly, it fails to demonstrate the crash I'm after.
But its still useful to have.
2024-07-04 06:41:09 -04:00
Matthias Clasen
db4f60cc9d Cosmetics 2024-07-04 06:40:52 -04:00
Matthias Clasen
6aba047ace expander: Don't leave dangling a11y relations
If we unparent the widget, we should sever a11y relations too.
Otherwise, an a11y implementation might follow them and be surprised
to find a parentless widget (and not in a good way).

Updated tests to not check the relation on an unexpanded expander.
2024-07-03 12:55:15 -04:00
Matthias Clasen
28c91bf767 Merge branch 'ci-catch-segfaults' into 'main'
testsuite: Use catch as testwrapper

See merge request GNOME/gtk!7406
2024-07-02 02:59:46 +00:00
Matthias Clasen
b6e79a7234 testsuite: Use catch as testwrapper
If we find a binary named catch, use it as test wrapper. This
will be used to capture stacktraces for crashes in ci.
2024-07-01 22:29:36 -04:00
Benjamin Otte
b80e33b209 testsuite: Add tests for empty mask children
The compare tests use an empty container node, but running them with
--replay ends up with empty nodes in snapshots due to how containers are
replayed.

Related: !7396
Related: #6761
2024-07-02 02:04:06 +02:00