Commit Graph

78503 Commits

Author SHA1 Message Date
Benjamin Otte
1e19629ce1 testsuite: Add a testcase for extensive rounded clips
The GL renderer can't handle this, so it's excluded.
2023-12-28 07:35:46 +01:00
Benjamin Otte
c7b4347342 roundedrect: Fix an intersection cornercase
These 2 rectangles used to intersect fine:
  0 0 50 50 / 50 0
  0 0 50 50 / 0 50
But the computed result was:
  0 0 50 50 / 50
which is not a valid rectangle, because the corners overlap.

Make sure such rectangles return NOT_REPRESENTABLE.

The above rectangle has been added to the testsuite.
2023-12-28 07:35:46 +01:00
Benjamin Otte
1c3e8d5280 testsuite: Add stroke tests
Same as the recent fill tests, just with strokes.
2023-12-28 07:35:46 +01:00
Benjamin Otte
ed8bca1548 path: Make gsk_path_to_string() work in non-US locales 2023-12-28 07:35:46 +01:00
Benjamin Otte
e1ca4b4569 testsuite: Add opacity handling test for fill nodes 2023-12-28 07:35:46 +01:00
Benjamin Otte
34392ca018 testsuite: Add a test filling 3d content
Checks that a simple Cairo fallback cannot be used.
2023-12-28 07:35:46 +01:00
Benjamin Otte
0c3c8a6a85 stroke: Turn stroke copy intialization into a macro
That way I can use it in static initializers.
2023-12-28 07:35:46 +01:00
Matthias Clasen
ea5768cb42 Merge branch 'wip/otte/for-main' into 'main'
rendernode: Use different hilights

See merge request GNOME/gtk!6694
2023-12-27 22:15:05 +00:00
Matthias Clasen
6683909dda Merge branch 'wip/sophie-h/native-nullables' into 'main'
gtk: Add nullables in native

Closes #6301

See merge request GNOME/gtk!6696
2023-12-27 22:13:49 +00:00
Luca Bacci
e4e0c27f58 Merge branch 'fix-wgl-leak' into 'main'
GdkWin32: Do not create multiple WGL contexts for the dummy window

Closes #6285

See merge request GNOME/gtk!6688
2023-12-27 15:43:54 +00:00
Luca Bacci
4e5456c8c3 GdkWin32: Do not create multiple WGL contexts for the dummy window
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/6285
2023-12-27 16:26:06 +01:00
Sophie Herold
4563f9353a gtk: Add nullables in native
GdkSurface and GskRenderer are not available before realized. Therefore mark
functions returning them in GtkNative as nullable.

Closes #6301
2023-12-27 13:59:03 +01:00
Matthias Clasen
906b88067a Merge branch 'matthiasc/for-main' into 'main'
Add a few annotations

See merge request GNOME/gtk!6695
2023-12-27 12:34:50 +00:00
Matthias Clasen
062902c003 Add a few annotations
Add a few pure, const and malloc annotations. These were suggested
by the gcc -Wsuggest-attribute option.
2023-12-26 21:57:04 -05:00
Matthias Clasen
6d57bbe7dd Fix a typo 2023-12-26 21:54:48 -05:00
Benjamin Otte
0c036c0c21 inspector: Make the "show fallbacks" actually do the right thing
After reshuffling debug categories, that toggle didn't do what was
expected anymore. Fix that.

Also clarify the message and add a tooltip.
2023-12-26 17:28:08 +01:00
Benjamin Otte
af014007f4 gl: Remove old Cairo fallback drawing code
We use gsk_render_node_draw_fallback() now which does all of that for
us.
2023-12-26 17:28:08 +01:00
Benjamin Otte
3f97ba2041 gsk: Clarify debug category messages a bit
After discussion on IRC about debug messages:

 - FALLBACK is meant to be used for printing stuff about fallbacks
   (Cairo, offscreens, conversion when uploading, etc)
 - CAIRO is for overdrawing everything drawn with Cairo
2023-12-26 17:28:08 +01:00
Benjamin Otte
4ce08a7b89 rendernode: Use different hilights
When hilighting Cairo nodes, use a different hilight color than when
hilighting other nodes.

This allows differentiating application use of Cairo (via nodes) from
renderer use of Cairo (via fallback).
2023-12-26 17:28:08 +01:00
Benjamin Otte
914e9bc316 Merge branch 'wip/otte/lots-of-tests' into 'main'
Lots of rendering tests and fixes

See merge request GNOME/gtk!6692
2023-12-26 15:22:35 +00:00
Benjamin Otte
9a5490c0cc Merge branch 'wip/otte/for-main' into 'main'
gsk: Repurpose GSK_DEBUG=cairo

See merge request GNOME/gtk!6693
2023-12-26 05:11:01 +00:00
Benjamin Otte
1385ffd2c2 gsk: Repurpose GSK_DEBUG=cairo
Use it to overlay an error pattern over all Cairo drawing done by
renderers.

This has 2 purposes:
1. It allows detecting fallbacks in GPU renderers.
2. Application code can use it to detect where it is using Cairo
   drawing.

As such, it is meant to trigger both with cairo nodes as well as when
renderers fallback for regular nodes.

The old use of the debug flag - which were 2 not very useful print
statements - was removed.
2023-12-26 05:31:05 +01:00
Benjamin Otte
a28915bffb testsuite: Disable all failing tests on GL renderer
Of all the recently added tests, disable the ones that fail on the GL
renderer, so that CI passes.
2023-12-26 05:03:25 +01:00
Benjamin Otte
2af5f7ffd1 testsuite: Limit compare --mask tests to 1000x1000
There are some tests that generate large images.

However, if we mask that image, we might have to generate offscreens
both for the source and for the mask.
And if we do that, it can take a long time. And especially on CI with
software rendering, that can quickly become noticable and result in
timeouts.
2023-12-26 05:03:25 +01:00
Benjamin Otte
e1bae384f0 testsuite: Add a shadow test
This test tests that shadows that are offset to outside the clip region
but where the blur goes back into the clip region get correctly drawn
and not optimized away.

To view what the test actually draws, remove at least the color-matrix
- it's only used so the blurring algorithm doesn't cause different
results - and maybe also the clip node.
2023-12-26 05:03:24 +01:00
Benjamin Otte
12a97ef422 testsuite: Add a forgotten test
The test existed in git but wasn't hooked up. So let's do that by:

1. Adding it to the build
2. Adapting it a bit so rounding errors really don't trigger (as the
   original commit claimed they shouldn't).
3. Re-renaming it because this was actually about 3d gradients
2023-12-26 05:03:24 +01:00
Benjamin Otte
9a6d6e80b5 testsuite: Add a nonorthogonal linear-gradient transform
The actual gradient line is covered by blocks, so there are no
artifacts. But if a renderer screws this up, the blue/red will seep
through these blocks.
2023-12-26 05:03:24 +01:00
Benjamin Otte
7ed6c39862 snapshot: linear-gradients cannot be affine-transformed
When different scale factors are used to transform a diagonal
linear gradient, the angle between the gradient line and its
perpendicular is no longer a right angle, which makes the
gradient come out different.

So it is necessary to use transform nodes in that case so that the
correct gradient gets rendered.

Technically, the code could check if the scales are equal or the
gradient line is horizontal/vertical, but I don't think that's worth it.
2023-12-26 05:03:24 +01:00
Benjamin Otte
57a4500bae rendernode: Don't mark impure functions as pure
Functions with out arguments can never be pure, because they write to a
pointer.

But pure functions must have no side effects.
2023-12-26 05:03:24 +01:00
Benjamin Otte
b01ed4ce39 rendernode: Set better size for mask nodes
Mask nodes are transparent outside of the intersection of source and
mask, unless the mask ode is inverted alpha.

Set the bounds accordingly.

Tests have been updated accordingly.
2023-12-26 05:03:24 +01:00
Benjamin Otte
2b142a59a1 testsuite: Add compare tests for mask modes inside an opacity node 2023-12-26 05:03:24 +01:00
Benjamin Otte
20c81d90c9 testsuite: Add yet another repeat node test
This one tests that when no offscreen is created for repeating but we
drw everything individually, we still respect the clip set via
child_bounds.
2023-12-26 05:03:24 +01:00
Benjamin Otte
3167a5b4d6 testsuite: Rewrite the --repeat option
* Don't grow the size too much - clip the size to 1000x1000
 * Add an offset, so the repeating doesn't always start top left
2023-12-26 05:03:24 +01:00
Benjamin Otte
f5584b178d testsuite: Add a test for repeat node offscreen scaling
Ensure that the offscreens for repeat nodes pick the right xscale and
yscale so that they render pixel-aligned.
2023-12-26 05:03:24 +01:00
Benjamin Otte
332fd1b840 testsuite: Add a repeat testcase
This test tests multiple things:

1. That huge contents are properly clipped by repeat nodes, even if the
   repeat happens in the visible part
2. That repeating only horizontally or only vertically is done quickly
   via offscreens when lots of repeating is done
2023-12-26 05:03:23 +01:00
Benjamin Otte
5e85b1aa02 testsuite: Add a repeat test
Ensures that repeating actually causes repeating in the renderer by
repeating a 1x1 image a lot.
2023-12-26 05:03:23 +01:00
Benjamin Otte
7f7254f10b testsuite: Add a repeat test for child bounds
Test that if the child is a texture that extends the child bounds, that
extension does not get repeated when rendering.

This can easily happen when the child is not drawn as an offscreen, but
instead the texture cache is consulted and no check for matching size is
done.
2023-12-26 05:03:23 +01:00
Benjamin Otte
72c58ccd7d testsuite: Add another test
This test ensures that offscreens for cross-fade children are properly
clipped and that the renderers can deal with the two not overlapping.
2023-12-26 05:03:23 +01:00
Benjamin Otte
f574cc2936 testsuite: Add test for gradients
Test that it can do 64 color stops.

Should ensure that renderers either can do unlimited amounts or have
fallbacks in place.
2023-12-26 05:03:23 +01:00
Benjamin Otte
2b59c4cf16 testsuite: Test we don't crash with overly large nodes
... when these nodes are used as children of a complex transform nodes
and we lose the clip.
2023-12-26 05:03:23 +01:00
Benjamin Otte
72b35a32fd testsuite: Fix corner case when testing repeats
When we test repeat nodes, make sure we round the size of the original
node up to an integer.
The reference image for the node is a rounded up, so when we generate a
new reference image we cannot deal with anything else.

Fixes huge-width test with --repeat.
2023-12-26 05:03:23 +01:00
Benjamin Otte
97b78cede0 testsuite: Unify renderer exclusion naming
Instead of using "-3d" to exclude Cairo rendering, use "-no$renderer" to
allow excluding any renderer.
And because we use contains() for the check, we can exclude multiple
renderers by naming the test sth like "test-nogl-nocairo.node"
2023-12-26 05:03:23 +01:00
Benjamin Otte
653d1eec55 testsuite: Add a variant of an existing test
This variant ccreates a huge node in the clipped region and tests that
renderers properly clip it away.
2023-12-26 04:25:11 +01:00
Benjamin Otte
4cc2a660e3 testsuite: Add a render test for a recent segfault
Renderer tend to ignore the clip when offscreening the child of a blur
node. So make a test that oversizes that child.
2023-12-26 04:25:11 +01:00
Benjamin Otte
6ab6109149 rendernode: Redo repeat handling
The previous approach could lead to offscreens that were too large and
cause errors.
2023-12-25 19:12:57 +01:00
Matthias Clasen
e93acc5762 Merge branch 'fix-focus-events' into 'main'
main: Fix a corner case in crossing events

See merge request GNOME/gtk!6690
2023-12-23 19:23:54 +00:00
Matthias Clasen
290c02b123 window: Fix focus event generation
Sync the code in gtkwindow.c that generates focus change events
with the similar code in gtkmain.c that generates crossing events.

This fixes assertion failures that would trigger in nautilus when
opening a folder.
2023-12-23 13:00:29 -05:00
Matthias Clasen
64db415e67 main: Fix a corner case in crossing events
We don't want to set a misleading descendent in the case that
we don't have a shared ancestor at all (because the old and the
new targets are on different toplevels).
2023-12-23 13:00:29 -05:00
Matthias Clasen
ed7ff78a0d Merge branch 'enums-docs' into 'main'
docs: Improve docs for enums

See merge request GNOME/gtk!6609
2023-12-22 15:50:10 +00:00
Maximiliano Sandoval R.
e857f0a3af Add Since annotations to enums
Doing this in a way that is picked up by gobject-introspection
requires splitting off new enum members into separate doc
comments, which is a bit unfortunate.
2023-12-22 08:47:47 -05:00