Commit Graph

81350 Commits

Author SHA1 Message Date
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
3d3e935c91 offload: Use gsk_color_node_get_color2
We want the blackest black.
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
87e9c940a4 gsk: Use the private color node api
Use the color state returned by this function instead of assuming
the color of a color node is always sRGB.

Node colors are converted to the css on the cpu. That is necessary
since we don't know if they are in one of the default color states,
and our shaders can't deal with non-default color states.
2024-08-05 11:11:14 -04:00
Matthias Clasen
6a02fa4be8 gsk: Add private color node api
Add a constructor that takes a color state, a getter for it, and
also a getter for the color coordinates that avoids GdkRGBA.
2024-08-05 11:11:14 -04:00
Matthias Clasen
9f548efd32 gsk: Change color op apis
Make color-related ops take the ccs and a GdkColor, and make
decisions about color conversion on the cpu vs the gpu.

This makes the node processor code simpler, and lets use convert
the color directly into the op instance without extra copying.

We also pass opacity to the op, so it can be applied when we
write the color into the instance.

Lastly, rorder the offset to come right after the opacity argument.

Treat the color and rounded color ops the same way.

Update all callers.

With this, the prepare_color apis in gskgpunodeprocessor.c are
no longer used and have been dropped.
2024-08-05 11:11:14 -04:00
Matthias Clasen
9eebe8e547 gsk: Change the clear op api
A clear op is just a fancy memcpy. Make it the callers responsibility
to convert the color to the right color state before passing it
to the clear op.
2024-08-05 11:11:14 -04:00
Matthias Clasen
f9612533c2 css: Add gtk_css_color_to_color
This api lets one obtain a color state and color values from
a GtkCssColor. We don't want to force everything though sRGB,
but we can't quite avoid conversion here, since we don't have
a 100% match between the css color spaces and color states.

css color cleanup
2024-08-05 11:11:14 -04:00
Matthias Clasen
c9c0d444a2 cairo: Add gdk_cairo_set_source_color
This lets us set a GdkColor as a cairo source.
2024-08-05 11:11:14 -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
Arjan Molenaar
f20714262c Merge branch 'macos-fix-window-transparency' into 'main'
macos: fix window transparency

Closes #6838

See merge request GNOME/gtk!7544
2024-08-05 12:20:32 +00:00
Matthias Clasen
11ffeeb55c Merge branch 'wip/otte/for-alice' into 'main'
Fix warning on startup

See merge request GNOME/gtk!7547
2024-08-05 12:18:00 +00:00
Sergey Bugaev
85830c059e Plug GTask leaks
The error-prone pattern seems to be:

  GTask *task = g_task_new (...);

  if (condition)
    {
      g_task_return_... (task, ...);
      /* need g_object_unref (task) here! */
      return;
    }

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
2024-08-05 14:38:23 +03:00
Matthias Clasen
ffc89e40a0 colorstate: Add a color conversion function
Add a function for converting a single color from one
color state to another. This is a generalization of the
already existing function to convert a GdkRGBA to another
color state.
2024-08-04 14:21:15 -04:00
Matthias Clasen
1c92f2d963 Merge branch 'matthiasc/for-main' into 'main'
Disable blur-performance build

See merge request GNOME/gtk!7549
2024-08-04 02:52:53 +00:00
Matthias Clasen
12e0ec0b48 Add gtk_css_parser_has_percentage 2024-08-03 22:31:32 -04:00
Matthias Clasen
5574bf59f6 Disable blur-performance build
This is an old test that isn't very relevant anymore, and it has
some linking problems because it includes private headers that
have inlined functions.
2024-08-03 22:31:21 -04:00
Matthias Clasen
7ee27cc0ad Merge branch 'matthiasc/for-main' into 'main'
gpu: Rename function

See merge request GNOME/gtk!7548
2024-08-04 01:23:41 +00:00
Benjamin Otte
040974c8a2 iconhelper: Size no longer depends on scale
This is a leftover from GTK3 when iconhelper sizes depended on the
texture size.

Now we only need to queue a redraw with the new icon.

Fixes warnings about resizes during allocate caused by scale change
notification during allocation of GtkWindow.
2024-08-04 03:11:56 +02:00
Benjamin Otte
126d689086 gpu: Rename function
We want to reuse gsk_gpu_color_to_float() for use with GdkColor and this
function will be replaced. But until that's fully done, we need 2
different names.

So rename this one to something else
2024-08-03 20:59:40 -04:00
Benjamin Otte
8e676c7360 windowcontrols: No need to listen to scale factor changes
This is a GTK3 leftover where the icons were manually drawn and sized.
Now that they're managed by actual widgets that enforce a correct size
that is independent of scale factor, this is no longer necessary.

Fixes warnings about resizes during allocate caused by scale change
notification during allocation of GtkWindow.
2024-08-04 01:23:07 +02:00
Arjan Molenaar
84847e46fa macos: fix window transparency
Revert window decoration changes from
a6ce506714.
2024-08-02 17:30:48 +02:00
Matthias Clasen
3fca84f974 Merge branch 'matthiasc/for-main' into 'main'
Fix a copy-paste error

See merge request GNOME/gtk!7543
2024-08-02 13:45:40 +00:00
Matthias Clasen
2be48a8f86 Pass ccs to the cairo blur code
This is needed to set the color properly.
2024-08-02 09:13:41 -04:00
Matthias Clasen
389d246af8 Fix up the blur-performance test
Add a hack to work aroundt he fact that the blur performance test
includes private headers which inline accesses to non-exported
variables.
2024-08-02 09:12:37 -04:00
Matthias Clasen
9e0f41bd05 Fix a copy-paste error
We were using the wrong api to get the color of an outset shadow
node. This just worked by luck.
2024-08-02 09:00:51 -04:00
Matthias Clasen
564a237454 Merge branch 'matthiasc/for-main' into 'main'
Cosmetics: Remove a leftover line

See merge request GNOME/gtk!7540
2024-08-01 22:24:55 +00:00
Matthias Clasen
86b59ba643 Cosmetics: Remove a leftover line
This looks just like a copy-paste leftover. Suprisingly, it compiled
just fine and worked too.
2024-08-01 17:19:50 -04:00
Matthias Clasen
487e568722 Merge branch 'matthiasc/for-main' into 'main'
vulkan: Don't try srgb for the atlas

Closes #6887

See merge request GNOME/gtk!7539
2024-08-01 19:40:00 +00:00
Matthias Clasen
67080dab21 vulkan: Don't try srgb for the atlas
This makes the Emoji rendering come out wrong.

Fixes: #6887
2024-08-01 14:43:49 -04:00
Benjamin Otte
0809e6585d Merge branch 'wip/otte/for-main' into 'main'
vulkan: Add error checking in a place

See merge request GNOME/gtk!7538
2024-08-01 11:14:12 +00:00
Benjamin Otte
809b98c96e vulkan: Don't leak fds
It makes sense to close the fds before doing an early return.
D'oh.
2024-08-01 12:51:46 +02:00
Benjamin Otte
059af1365a vulkan: Add error checking in a place
Doesn't hurt to have, but I just added it while debugging something
unrelated.
2024-08-01 12:51:46 +02:00
Matthias Clasen
fbcffb36c8 Merge branch 'matthiasc/for-main' into 'main'
Drop debug code

See merge request GNOME/gtk!7536
2024-08-01 01:31:16 +00:00
Matthias Clasen
3af0cfb53b Drop debug code
The dmabuf download code for P010 had a hack left in it that
was preventing it from working.
2024-07-31 21:08:14 -04:00
Matthias Clasen
96422fcf52 Merge branch 'no-cursor-viewport' into 'main'
wayland: No viewporter for cursors

See merge request GNOME/gtk!7531
2024-07-31 20:23:34 +00:00
Matthias Clasen
2754f2be2d Merge branch 'test-cal-31' into 'main'
ci: avoid another date-dependent failure

See merge request GNOME/gtk!7535
2024-07-31 20:12:16 +00:00
Matthias Clasen
3d802177be wayland: No viewporter for cursors
The outlook for mutter supporting this in GNOME 47 are cloudy,
so lets flip the switch back. You can still set
USE_POINTER_VIEWPORT in the environment to try this code.
2024-07-31 07:44:48 -04:00
Matthias Clasen
a02d4ba2a1 Merge branch 'matthiasc/for-main' into 'main'
dmabuf: Fix the disjointness check

See merge request GNOME/gtk!7529
2024-07-31 05:04:02 +00:00
Matthias Clasen
249cf0833c dmabuf: Fix the disjointness check
We were checking the wrong fds here.

This came up while toying with udmabuf and creating multi-plane
NV12 buffers.
2024-07-30 23:44:07 -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
Matthias Clasen
269dcaaadf Post-release version bump 2024-07-30 15:14:25 -04:00
Matthias Clasen
322bbd2376 4.15.4 2024-07-30 12:50:22 -04:00
Benjamin Otte
52bec248ce Merge branch 'wip/otte/for-main' into 'main'
gpu: Fix shadows even more

See merge request GNOME/gtk!7527
2024-07-30 16:29:59 +00: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
65e02a3bae Merge branch 'wip/otte/for-main' into 'main'
gpu: Fix shadows some more

Closes #6896

See merge request GNOME/gtk!7526
2024-07-30 14:48:34 +00:00
Benjamin Otte
defc4d335e gpu: Fix shadows some more
It turns out the "step" variable could up as 0 when p.y ~= 3.0 ||
p.y ~= r.y - 3.0
That was not enough to trigger it though because if "start" and "end"
were the same value, the "y <= end" check in the loop would immediately
terminate it.

However, if start + epsilon == end so that end != start but (end - start)
/ 7 == 0, then step would end up as 0 and the loop would never
terminate.

And if that happened, it would bring down GPUs.
So recode this whole machinery to make it impossible to infloop.

Fixes #6896
2024-07-30 16:09:38 +02:00
Benjamin Otte
bdcfcfa5b9 Merge branch 'wip/otte/for-main' into 'main'
gpu: Draw proper shadows again

Closes #6888

See merge request GNOME/gtk!7518
2024-07-30 00:19:37 +00: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