wayland/single-pixel: Add API to check if buffer is opaque black

Which is the typical background color we also use for fullscreen
padding. This will allow us to apply optimizations.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3177>
This commit is contained in:
Robert Mader 2023-08-24 19:03:02 +02:00 committed by Marge Bot
parent adc776d0d7
commit 50f8f1e8b3
2 changed files with 11 additions and 0 deletions

View File

@ -169,6 +169,15 @@ meta_wayland_single_pixel_buffer_free (MetaWaylandSinglePixelBuffer *single_pixe
g_free (single_pixel_buffer);
}
gboolean
meta_wayland_single_pixel_buffer_is_opaque_black (MetaWaylandSinglePixelBuffer *single_pixel_buffer)
{
return (single_pixel_buffer->a == UINT32_MAX &&
single_pixel_buffer->r == 0x0 &&
single_pixel_buffer->g == 0x0 &&
single_pixel_buffer->b == 0x0);
}
void
meta_wayland_init_single_pixel_buffer_manager (MetaWaylandCompositor *compositor)
{

View File

@ -35,3 +35,5 @@ MetaWaylandSinglePixelBuffer * meta_wayland_single_pixel_buffer_from_buffer (Met
void meta_wayland_init_single_pixel_buffer_manager (MetaWaylandCompositor *compositor);
void meta_wayland_single_pixel_buffer_free (MetaWaylandSinglePixelBuffer *single_pixel_buffer);
gboolean meta_wayland_single_pixel_buffer_is_opaque_black (MetaWaylandSinglePixelBuffer *single_pixel_buffer);