mirror of
https://gitlab.freedesktop.org/wayland/weston.git
synced 2025-12-20 03:30:19 +01:00
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:
parent
e015081f5d
commit
cf59ed0ebe
3 changed files with 7 additions and 27 deletions
|
|
@ -617,27 +617,27 @@ x11_output_set_icon(struct x11_backend *b,
|
||||||
{
|
{
|
||||||
uint32_t *icon;
|
uint32_t *icon;
|
||||||
int32_t width, height;
|
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)
|
if (!image)
|
||||||
return;
|
return;
|
||||||
width = pixman_image_get_width(image);
|
width = pixman_image_get_width(image->pixman_image);
|
||||||
height = pixman_image_get_height(image);
|
height = pixman_image_get_height(image->pixman_image);
|
||||||
icon = malloc(width * height * 4 + 8);
|
icon = malloc(width * height * 4 + 8);
|
||||||
if (!icon) {
|
if (!icon) {
|
||||||
pixman_image_unref(image);
|
weston_image_destroy(image);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
icon[0] = width;
|
icon[0] = width;
|
||||||
icon[1] = height;
|
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,
|
xcb_change_property(b->conn, XCB_PROP_MODE_REPLACE, output->window,
|
||||||
b->atom.net_wm_icon, b->atom.cardinal, 32,
|
b->atom.net_wm_icon, b->atom.cardinal, 32,
|
||||||
width * height + 2, icon);
|
width * height + 2, icon);
|
||||||
free(icon);
|
free(icon);
|
||||||
pixman_image_unref(image);
|
weston_image_destroy(image);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
||||||
|
|
@ -641,20 +641,3 @@ weston_image_destroy(struct weston_image *image)
|
||||||
|
|
||||||
free(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;
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,4 @@ weston_image_load(const char *filename, uint32_t image_load_flags);
|
||||||
void
|
void
|
||||||
weston_image_destroy(struct weston_image *image);
|
weston_image_destroy(struct weston_image *image);
|
||||||
|
|
||||||
pixman_image_t *
|
|
||||||
load_image(const char *filename);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue