Commit Graph

81774 Commits

Author SHA1 Message Date
Matthias Clasen
1d7aa9e40b Merge branch 'matthiasc/for-main' into 'main'
Small cleanups

See merge request GNOME/gtk!7592
2024-08-11 11:01:58 +00:00
Benjamin Otte
8de4b04819 Merge branch 'wip/otte/for-main' into 'main'
color: NEVER EVER use memcpy() in critical path

See merge request GNOME/gtk!7593
2024-08-11 05:39:26 +00:00
Benjamin Otte
175dba86fd color: NEVER EVER use memcpy() in critical path
Unless there is a very good reason to use memcpy(), don't use it.

Not using it makes the compiler not screw up and waste tons of CPU that
it could have not wasted.

Gets my framerate back from 1250 => 1750 and makes sysprof no longer
report ~40% of render time spent in gsk_gpu_colorize_op().
2024-08-11 06:51:58 +02:00
Matthias Clasen
767b9b9405 Docs: Add the image tool to the list 2024-08-10 22:47:02 -04:00
Matthias Clasen
202a51d9e3 Cosmetics 2024-08-10 22:41:31 -04:00
Matthias Clasen
3014d36a61 Merge branch 'matthiasc/for-main' into 'main'
inspector: Show fine transform categories

See merge request GNOME/gtk!7591
2024-08-11 02:40:25 +00:00
Matthias Clasen
d718fda057 memory texture: Fix a memory leak
The callers assumed that gdk_memory_sanitize is transfer full in
both directions, but it wasn't. Make it so.
2024-08-10 22:24:29 -04:00
Matthias Clasen
bbb7b365d5 inspector: Show roles for nodes
For some node types, the child nodes play different roles. E.g.
for a mask node, one of the two children is the source, the other
the mask. Show this information in the inspector.
2024-08-10 21:51:06 -04:00
Matthias Clasen
740e485160 NEWS: Updates 2024-08-10 21:09:29 -04:00
Matthias Clasen
5a69127862 inspector: Show fine transform categories
This is information we care about in particular for offloading,
so show it.
2024-08-10 21:08:53 -04:00
Matthias Clasen
798883f21a Merge branch 'css-color-hookup-5' into 'main'
Make non-srgb css colors work for text nodes

See merge request GNOME/gtk!7558
2024-08-10 16:28:31 +00:00
Matthias Clasen
bec71a15b4 Merge branch 'matthiasc/for-main' into 'main'
Fix a copy-paste error

See merge request GNOME/gtk!7589
2024-08-10 12:55:32 +00:00
Matthias Clasen
c4baf60044 inspector: Rename add_color2_row to add_color_row
The original add_color_row is gone now, so we can rename its
successor back.
2024-08-10 08:16:40 -04:00
Matthias Clasen
d32081401f inspector: Show more details for text nodes
Show the color state, and create textures with the full color
information.

The GdkRGBA-based helper functions are no longer used with this
commit and have been dropped.
2024-08-10 08:16:40 -04:00
Matthias Clasen
ed119ae246 gtk: Port selection drawing to new apis
Preserve color state information when drawing selections or block
cursors in GtkTextView.
2024-08-10 08:16:40 -04:00
Matthias Clasen
51768d0e16 gtk: Port caret drawing to new apis
Preserve color state information here.
2024-08-10 08:16:40 -04:00
Matthias Clasen
6f1a4e5bb9 gtk: Use the new apis
It is not perfect, since PangoRenderer, GtkTextAppearance and
GtkTextTag all carry colors as PangoColor or GdkRGBA. But at least,
we get glowing foreground colors.
2024-08-10 08:14:23 -04:00
Matthias Clasen
e323d2a93e gtk: Add gtk_snapshot_append_text2/layout2
These are private snapshot functions that use the new constructor
to create a text node with a given color state.
2024-08-10 07:48:18 -04:00
Matthias Clasen
23922eebf1 gl: Handle text colors with color states
Since we don't have proper color management here, just convert
any color we meet to sRGB and hope for the best.
2024-08-10 07:48:18 -04:00
Matthias Clasen
92bd85ba30 nodeparser: Support color states in text nodes
Test included.
2024-08-10 07:37:01 -04:00
Matthias Clasen
ca7aa30bc5 gsk: Use private text node api 2024-08-10 07:37:01 -04:00
Matthias Clasen
d17972427a gsk: Add private text node api
Add a constructor that takes a GdkColor and a corresponding getter.
2024-08-10 07:37:01 -04:00
Matthias Clasen
25f0c81530 Fix a copy-paste error
This was introduced in ea28dc8cff.
2024-08-10 07:11:56 -04:00
Matthias Clasen
4f95d126ba Merge branch 'matthiasc/for-main' into 'main'
gl: Handle box shadow colors with color states

See merge request GNOME/gtk!7588
2024-08-10 03:05:26 +00:00
Matthias Clasen
310196cc59 gl: Handle box shadow colors with color states
Since we don't have proper color management here, just convert
any color we meet to sRGB and hope for the best.
2024-08-09 22:27:57 -04:00
Matthias Clasen
8052bcc69c Updates 2024-08-09 22:11:35 -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
Benjamin Otte
4426194ee6 Merge branch 'css-color-hookup-4' into 'main'
Make non-srgb css colors work for shadows

See merge request GNOME/gtk!7557
2024-08-10 00:36:28 +00: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
ff02665407 inspector: Show more shadow node details
Show the color state, and create textures with the full color
information.

With this commit, add_color_row and get_color_texture are no longer
used and have been dropped.
2024-08-09 20:17:04 -04:00
Matthias Clasen
d471ed5912 gtk: Use new shadow snapshot apis
Preserve color states from css as much as possible.
2024-08-09 20:17:04 -04:00
Matthias Clasen
b92ca5da02 gtk: Add gtk_snapshot_push_shadow2
This is a private snapshot function that uses the new constructor
to create a shadow node with the given color states.
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
Matthias Clasen
5551f30400 gsk: Use private shadow node api 2024-08-09 20:09:31 -04:00
Matthias Clasen
2c10d72fe5 gsk: Add private shadow node api
Add a new GskShadow2 struct that has a GdkColor instead of
a GdkRGBA, and a new constructor and getter to go along with
it.

With this commit, my_color_get_depth is no longer used and
has been dropped.
2024-08-09 20:09:31 -04:00
Matthias Clasen
44fe51247c gsk: Change the blur op api
Pass the ccs, opacity and GdkColor to the op to let it make
decisions about color conversion.

Update the callers.
2024-08-09 20:09:31 -04:00
Matthias Clasen
3a99f1e9f1 gsk: Change the colorize op api
Pass the ccs, opacity and GdkColors to the op to let it make
decisions about color conversion.

Update the callers.
2024-08-09 20:09:30 -04:00
Matthias Clasen
d233f0ca3e node parser: Move parse_color2 up
We will use this function more so move it where it belongs.
2024-08-09 20:09:30 -04:00
Matthias Clasen
c548bdc3fe css: Add gtk_css_parser_consume_number_or_percentage
This comes in handy in the render node parser.
2024-08-09 20:09:30 -04:00
Benjamin Otte
839d797292 build: Don't set G_SLICE=always-malloc
That environment variable has been gone since GSlice went away in glib
2.76. Which is our minimum requirement.
2024-08-10 01:53:46 +02:00
Benjamin Otte
f8a30ddfc1 gdk: Deprecate gdk_surface_set_opaque_region() 2024-08-10 01:40:46 +02:00
Benjamin Otte
bb0eb3af45 gtk: Stop calling gdk_window_set_opaque_region()
Now that GDK can figure it out from the rendernode, doing all this work
trying to figure it out is no longer necessary.

Plus, it was sometimes wrong and lead to obscure artifacts.
2024-08-10 01:40:46 +02:00
Benjamin Otte
999d9bc73b gdk: Introduce gdk_surface_is_opaque()
... and use it in the mac backend instead of a hand-rolled version.
2024-08-10 01:40:46 +02:00
Benjamin Otte
16c7003acb gdk: Pass the opaque rect to begin_frame() actually
We know it at begin_frame() time, so if we pass it there instead of
end_frame(), we can use it then to make decisions about opacity.

For example, we could notice that the whole surface is opaque and choose
an RGBx format.
We don't do that yet, but now we could.
2024-08-10 01:40:46 +02:00
Benjamin Otte
f64045c229 gdk: Pass the opaque rect on to the opaque region
The opaque rect from the rendernodes are now used to set the opaque
region in the backend.

This means applications can now set a transparent window background and
make indivual parts of their window opaque.
But because this is a best effort method, it is not guaranteed to
succeed in finding all opaque regions, in particular if the rendernodes
used to build it are not straightforward to analyze.
2024-08-10 01:40:46 +02:00
Benjamin Otte
58aebc4447 surface: Put opaque_region in the priv structure
This is in preparation for future patches.
2024-08-10 01:40:46 +02:00
Benjamin Otte
3b3b6036f8 mac: Remove clear optimization
1. We want to get rid of exposing the opaque region

2. Cairo optimizes clearing the whole surface
2024-08-10 01:40:46 +02:00
Benjamin Otte
75748f4ae9 gl: Remove update_area() trick
This is poking into the surface directly, so not a good idea.
And I want to hide that struct in the priv member.

Technically, this code should look at the opaque region, but I am lazy
and the GL renderer is on its way out, so I think it's not worth doing.
2024-08-10 01:40:46 +02:00
Benjamin Otte
f90fb68aec gdk: Deprecate public begin/end_frame() APIs
We are using so many internal extra features that it is no longer a good
idea to use these functions.
And they aren't really used anyway.

These extra features are also constantly in flux and rely on internal
APIs, so exposing them would just cause extra pain.
2024-08-10 01:40:45 +02:00