tests/wayland-test-clients: Use WaylandBuffer in draw_surcace
Most tests use the draw_surface function to draw a solid color to a surface. This moves it from the shm-only path to WaylandBuffer which makes all of those tests usable via dma-buf. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3350>
This commit is contained in:
parent
d842fe601d
commit
2c23a94be0
1 changed files with 11 additions and 8 deletions
|
@ -543,17 +543,20 @@ draw_surface (WaylandDisplay *display,
|
||||||
int height,
|
int height,
|
||||||
uint32_t color)
|
uint32_t color)
|
||||||
{
|
{
|
||||||
struct wl_buffer *buffer;
|
WaylandBuffer *buffer;
|
||||||
void *buffer_data;
|
|
||||||
int size;
|
|
||||||
|
|
||||||
if (!create_shm_buffer (display, width, height,
|
buffer = wayland_buffer_create (display, NULL,
|
||||||
&buffer, &buffer_data, &size))
|
width, height,
|
||||||
g_error ("Failed to create shm buffer");
|
DRM_FORMAT_ARGB8888,
|
||||||
|
NULL, 0,
|
||||||
|
GBM_BO_USE_LINEAR);
|
||||||
|
|
||||||
fill (buffer_data, width, height, color);
|
if (!buffer)
|
||||||
|
g_error ("Failed to create buffer");
|
||||||
|
|
||||||
wl_surface_attach (surface, buffer, 0, 0);
|
wayland_buffer_fill_color (buffer, color);
|
||||||
|
|
||||||
|
wl_surface_attach (surface, wayland_buffer_get_wl_buffer (buffer), 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Add table
Reference in a new issue