Commit Graph

2968 Commits

Author SHA1 Message Date
Benjamin Otte
8da478ab34 testsuite: Disable a bunch of tests on the GL renderer
We want to generate reference images with the renderers and the GL
renderer can't deal with textures well enough to generate these
reference images.
2024-08-29 20:34:20 +02:00
Benjamin Otte
aa81df921b testsuite: Correct values for red
The value used was for rec2020 (9/14/0/1), not rec2100-pq (9/16/0/1).
2024-08-29 03:01:30 +02:00
Corey Berla
8eb05850cb single-selection: Don't allow unselecting with autoselect
According to the documentation, when autoselect is TRUE it will
"will disallow unselecting the current item".
2024-08-27 21:18:56 +00:00
Matthias Clasen
5e6cf622e3 compare-render: Do less work for replay
We don't need to render the node, we have a reference image.
2024-08-24 20:11:32 -04:00
Matthias Clasen
107ef2017c tests: Use dmabufs in compare tests
Make the --replay mode of compare-render randomly turn textures it
finds into dmabuf textures, using /dev/udmabuf.
2024-08-24 13:10:25 -04:00
Matthias Clasen
acad180cee Add dmabuf tests that can run in ci
This is a test balloon tests that use /dev/udmabuf to produce
dmabufs that we can use in ci, even if we don't have a GPU.
Currently, the tests we can do are somewhat limited, since mesas
software renderers don't support dmabufs yet.
2024-08-24 13:10:25 -04:00
Benjamin Otte
58f7b966d0 reftests: Make glarea-gl-only test XFAIL
With CI now using udmabufs, we run into bugs in Mesa. So we disable
some tests for now.

https://gitlab.freedesktop.org/mesa/mesa/-/issues/11773 is the bug
report for this one.
2024-08-23 22:53:13 +02:00
Benjamin Otte
dd59c90842 rendernode: repeeat nodes with empty child bounds are transparent
So they must not copy the fully_opaque flag from the child.

Adapted the testcase that accidentally caught it do now always catch it
by setting a proper background.
2024-08-21 21:13:26 +02:00
Benjamin Otte
9ff31dd29b testsuite: Improve testcase
This should have gone into !7619 but gitlab managed to finish the CI run
just as I was pushing a new version to the MR with
merge_request.merge_when_pipeline_succeeds and apparently gitlab applied
that to the previous version or something.

So now that MR merged an incomplete version to main. And here's the fix
for that.
2024-08-17 21:31:14 +02:00
Benjamin Otte
0815359a20 Merge branch 'wip/otte/for-main' into 'main'
gsk: Don't print any sRGB color as rgb() or rgba()

See merge request GNOME/gtk!7619
2024-08-17 19:28:07 +00:00
Benjamin Otte
96139a902d gsk: Don't print any sRGB color as rgb() or rgba()
If the color value is not inside the proper range for rgb() or rgba()
values being integers, use color() instead.

Tests added/adapted.
2024-08-17 21:09:25 +02:00
Benjamin Otte
a6233ac852 rendernodeparser: Check color values aren't out of range
Use the clamp() API from the previous commit to:

1. Clamp values into range
2. Emit an error if values were out of range

Unlike CSS, which just clamps and doesn't emit an error, we do want to
emit one because we care about colors being correct in our node files.
2024-08-17 18:12:23 +02:00
Matthias Clasen
5af2d95bff checkbutton: Add a 'grouped' style class
This will make it easier for themes to style radio buttons
differently from check buttons, since out CSS does not have
:has().

The concrete desire here is to use a different outline for
the focus rectangle.

Update affected tests.

Fixes: #6936
2024-08-17 08:22:54 -04:00
Matthias Clasen
4aea2d2e09 css: Don't pass style variables redundantly
The context->variables field is expected by the resolve code to be
the keyframe variables. That code takes the style variables from
context->style anyway, so no need to pass them as context->variables
too. And crucially, the lookup code treats the keyframes variables
differently to the style variables, since it doesn't expect the
hierarchical structure that comes from parent styles. This change
fixes infinite recursion in variable lookup with css like

:root {
  --a: var(--b);
}

.foo {
  --b: var(--a);
  color: var(--a);
}

Test included.

Fixes: #6881
2024-08-16 11:38:56 -04:00
Matthias Clasen
c9e4abcd3a css: Fix a crash in variables
We were not careful enough when checking for reference cycles.

Fixes: #6935

Test included.
2024-08-15 10:16:47 -04:00
Matthias Clasen
f62606105e Fix up transfer function symmetry
The easiest things trigger the silliest mistakes. Add tests
for various properties we want our transfer functions to have,
such as:
- be inverse of each other
- stay within the defined ranges
- by symmetric around 0
2024-08-14 11:45:25 -04:00
Matthias Clasen
cb339f85b8 testsuite: build fix
The statically linked tests need to have -DGTK_COMPILATION=1
in their cflags.
2024-08-12 19:19:15 -04:00
Benjamin Otte
68d73dcce5 nodeparser: Handle disallowed values for radial gradients
Make sure the radii are strictly positive.

Also handle the case where start >= end.
We can't really underline that error, because we don't track the
locations of the start/end properties until we know that there's an
error.
So just underline the whole radial gradient declaration.

Test included
2024-08-11 19:07:40 +02:00
Benjamin Otte
9643a21827 gl: Interpolate gradient colors as premultiplied
Tests included
2024-08-11 19:07:40 +02:00
Matthias Clasen
92bd85ba30 nodeparser: Support color states in text nodes
Test included.
2024-08-10 07:37:01 -04:00
Benjamin Otte
04ee41d7b0 Merge branch 'wip/otte/for-main' into 'main'
lots of small things

See merge request GNOME/gtk!7585
2024-08-10 01:10:12 +00:00
Benjamin Otte
23af1cd8ad gpu: When transforming to simpler transform, we might be all clipped
When transforming back from a complex transform to a simpler transform,
the resulting clip might turn out to clip everything, because clips can
grow while transforming, but the scissor rect won't. So when this
process happens, we can end up with an empty clip by transforming:

1. Set a clip that also sets the scissor
2. transform in a way that grows the clip, say rotate(45)
3. modify the clip to shrink it
4. transform in a way that simplifies the transform, say another
   rotate(45)
5. Figure out that this clip and the scissor rect do no longer overlap

Catch this case and avoid drawing anything.
2024-08-10 02:38:13 +02:00
Matthias Clasen
92c119e12c testsuite: Replay shadow nodes properly
Use the new apis for this.
2024-08-09 20:17:04 -04:00
Matthias Clasen
0f7c0f616c nodeparser: Handle shadows with color state
Test included.
2024-08-09 20:09:31 -04:00
Benjamin Otte
d6322c6389 gsk: Switch box shadow nodes to use offsets
Instead of
  float dx;
  float dy;
have a
  graphene_point_t offset;
in the object and in all APIs relating to them.
2024-08-10 01:40:45 +02:00
Matthias Clasen
4ea1319c6b Replay inset and outset shadow nodes properly 2024-08-08 16:01:06 -04:00
Matthias Clasen
ea28dc8cff nodeparser: Support color states for box shadows
Just switch from parse_color to parse_color2, and apply the
corresponding changes to serialization too.

Test included.
2024-08-08 15:49:55 -04:00
Benjamin Otte
99d291eb69 Merge branch 'wip/otte/occlusion' into 'main'
Implement advanced occlusion culling

See merge request GNOME/gtk!7570
2024-08-08 14:22:22 +00:00
Matthias Clasen
56c02dd7d1 Merge branch 'css-color-hookup-2' into 'main'
Make non-srgb css colors work for borders

See merge request GNOME/gtk!7550
2024-08-07 23:14:35 +00:00
Benjamin Otte
88c9a30f77 testsuite: Half the runtime of offscreens test
It times out too much in CI.
2024-08-07 23:26:03 +02:00
Jeremy Bícha
8ee465c630 testsuite: add more files to test_data 2024-08-06 20:28:58 -04:00
Matthias Clasen
2960bb7cb2 Add a compare test for colorstates in borders 2024-08-06 07:35:00 -04:00
Matthias Clasen
a3691d311b nodeparser: Support color states in border nodes
Test included.
2024-08-06 07:35:00 -04:00
Matthias Clasen
89d449352f testsuite: Replay border nodes properly
Use the new apis for this.
2024-08-06 07:35:00 -04:00
Matthias Clasen
582dba54b1 Try to fix win32 build of compare-render 2024-08-06 07:10:04 -04:00
Matthias Clasen
0775432ed9 Add a compare test for premultiplied colors
This test checks a that a specific combination of mask with alpha
inside opacity works as expected. We were treating the mask color
as premultiplied here, although it isn't.
2024-08-06 00:59:23 -04:00
Matthias Clasen
71d6392572 nodeparser: Rewrite the color parsing
Use gtk_css_parser_consume_function, for better error handling.
We are now getting the expected error for

  color(srgb 1 2 3 4 5 6)

Test included.
2024-08-06 00:23:07 -04:00
Matthias Clasen
c1a99bf901 tests: Link compare-render statically
This is a temporary change, only needed until we make the new
snapshot and rendernode apis public.
2024-08-05 16:09:42 -04:00
Matthias Clasen
b8989b7ff6 Add a compare test for color states
This checks that the red values in all 4 default color states
come out identical to a plain old red png.
2024-08-05 11:11:15 -04:00
Matthias Clasen
d6a6cfe6c5 gtk: Fix gtk_snapshot_collect_repeat
This creates a new color node that is meant to be identical to
an existing one, so we need to use gsk_color_node_new2 to preserve
the color state information.

Test included.
2024-08-05 11:11:15 -04:00
Matthias Clasen
16431da3f2 nodeparser: Add support for cicp color states
Allow defining cicp color states with an @-rule:

    @cicp "jpeg" {
      primaries: 1;
      transfer: 13;
      matrix: 6;
      range: full;
    }

And allow using them in color() like this:

    color("jpeg" 50% 0.5 1 / 75%)

Note that custom color states use a string, unlike default color
states which use an ident.

Test included.
2024-08-05 11:11:15 -04:00
Matthias Clasen
842949fcf3 nodeparser: Support color states
And allow using color states for colors with a syntax similar
to modern css color syntax.

color(srgb 50% 0.5 1 / 75%)

Both floating point numbers and percentages can be used.

Currently, this is only supported for color nodes.

Test included.
2024-08-05 11:11:15 -04:00
Matthias Clasen
d5ae94ca5d testsuite: Update replay nodes
We can't currently recreate color nodes with public api, so cheat
and reuse the node we got.
2024-08-05 11:11:15 -04:00
Matthias Clasen
13a8704f51 Add GdkColor
For now, this is all private api.

Parts of it will be opened up in 4.18.
2024-08-05 11:11:14 -04:00
Jeremy Bícha
20b00d3947 ci: avoid another date-dependent failure
Set the day before setting the month to avoid
failure when running the test on the 31st day of a month
2024-07-30 15:50:12 -04:00
Benjamin Otte
9f71528a05 gpu: Fix shadows even more
Math is hard.

But this time, it comes with a test!
2024-07-30 18:01:45 +02:00
Benjamin Otte
4a94c91772 gpu: Don't blur tiny blur radii
We get those wrong, and there's not really a visual effect.

And since we do a check anyway, just disallow them and treat them as
unblurred.
2024-07-30 01:50:56 +02:00
Benjamin Otte
cc3ed89e34 gpu: Draw proper shadows again
The fix in commit 5e7f227d broke shadows while trying to make them
faster.
So use a better way to make them faster.

With the normalized blur radius, we can now conclude that all the values
too far from p.y will cause the gauss() call to return close to 0, so we
can skip any y value that is too far from p.y.

And that allows us to put an upper limit on the loop iterations.

Tests included

Fixes #6888
2024-07-30 01:50:56 +02:00
Matthias Clasen
1040d7c7e4 Merge branch 'matthiasc/for-main' into 'main'
cicp: Fill in some more transfer functions

See merge request GNOME/gtk!7515
2024-07-28 20:51:40 +00:00
Benjamin Otte
b8890ca27d Merge branch 'wip/smcv/warnings' into 'main'
Fix compiler warnings on 32-bit

See merge request GNOME/gtk!7507
2024-07-28 18:40:46 +00:00