tests/wayland-test-clients: Remove unused create_shm_buffer

We moved the last user of `create_shm_buffer` and can now get rid of it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3350>
This commit is contained in:
Sebastian Wick 2023-12-12 16:48:36 +01:00 committed by Marge Bot
parent 2c23a94be0
commit 6f4da83b36
2 changed files with 0 additions and 84 deletions

View File

@ -459,83 +459,6 @@ wayland_display_init (WaylandDisplay *display)
{
}
static void
handle_buffer_release (void *data,
struct wl_buffer *buffer)
{
wl_buffer_destroy (buffer);
}
static const struct wl_buffer_listener buffer_listener = {
handle_buffer_release
};
gboolean
create_shm_buffer (WaylandDisplay *display,
int width,
int height,
struct wl_buffer **out_buffer,
void **out_data,
int *out_size)
{
struct wl_shm_pool *pool;
static struct wl_buffer *buffer;
int fd, size, stride;
int bytes_per_pixel;
void *data;
bytes_per_pixel = 4;
stride = width * bytes_per_pixel;
size = stride * height;
fd = create_anonymous_file (size);
if (fd < 0)
{
fprintf (stderr, "Creating a buffer file for %d B failed: %m\n",
size);
return FALSE;
}
data = mmap (NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
if (data == MAP_FAILED)
{
fprintf (stderr, "mmap failed: %m\n");
close (fd);
return FALSE;
}
pool = wl_shm_create_pool (display->shm, fd, size);
buffer = wl_shm_pool_create_buffer (pool, 0,
width, height,
stride,
WL_SHM_FORMAT_ARGB8888);
wl_buffer_add_listener (buffer, &buffer_listener, buffer);
wl_shm_pool_destroy (pool);
close (fd);
*out_buffer = buffer;
*out_data = data;
*out_size = size;
return TRUE;
}
static void
fill (void *buffer_data,
int width,
int height,
uint32_t color)
{
uint32_t *pixels = buffer_data;
int x, y;
for (y = 0; y < height; y++)
{
for (x = 0; x < width; x++)
pixels[y * width + x] = color;
}
}
void
draw_surface (WaylandDisplay *display,
struct wl_surface *surface,

View File

@ -99,13 +99,6 @@ WaylandSurface * wayland_surface_new (WaylandDisplay *display,
int default_height,
uint32_t color);
gboolean create_shm_buffer (WaylandDisplay *display,
int width,
int height,
struct wl_buffer **out_buffer,
void **out_data,
int *out_size);
void draw_surface (WaylandDisplay *display,
struct wl_surface *surface,
int width,