shared: remove load_image()

We have a single user of load_image(), and that can be easily replaced
by the new and more flexible weston_image_load() function.

So replace and drop load_image() from the code.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
This commit is contained in:
Leandro Ribeiro 2024-04-25 11:38:28 -03:00
parent e015081f5d
commit cf59ed0ebe
3 changed files with 7 additions and 27 deletions

View File

@ -617,27 +617,27 @@ x11_output_set_icon(struct x11_backend *b,
{
uint32_t *icon;
int32_t width, height;
pixman_image_t *image;
struct weston_image *image;
image = load_image(filename);
image = weston_image_load(filename, WESTON_IMAGE_LOAD_IMAGE);
if (!image)
return;
width = pixman_image_get_width(image);
height = pixman_image_get_height(image);
width = pixman_image_get_width(image->pixman_image);
height = pixman_image_get_height(image->pixman_image);
icon = malloc(width * height * 4 + 8);
if (!icon) {
pixman_image_unref(image);
weston_image_destroy(image);
return;
}
icon[0] = width;
icon[1] = height;
memcpy(icon + 2, pixman_image_get_data(image), width * height * 4);
memcpy(icon + 2, pixman_image_get_data(image->pixman_image), width * height * 4);
xcb_change_property(b->conn, XCB_PROP_MODE_REPLACE, output->window,
b->atom.net_wm_icon, b->atom.cardinal, 32,
width * height + 2, icon);
free(icon);
pixman_image_unref(image);
weston_image_destroy(image);
}
static void

View File

@ -641,20 +641,3 @@ weston_image_destroy(struct weston_image *image)
free(image);
}
pixman_image_t *
load_image(const char *filename)
{
struct weston_image *image;
pixman_image_t *pixman_image;
image = weston_image_load(filename, WESTON_IMAGE_LOAD_IMAGE);
if (!image)
return NULL;
pixman_image = image->pixman_image;
free(image);
return pixman_image;
}

View File

@ -50,7 +50,4 @@ weston_image_load(const char *filename, uint32_t image_load_flags);
void
weston_image_destroy(struct weston_image *image);
pixman_image_t *
load_image(const char *filename);
#endif