From f05165a77a538b42ffd2d473eded25188cb56ea0 Mon Sep 17 00:00:00 2001 From: N-R-K <79544946+N-R-K@users.noreply.github.com> Date: Tue, 12 Apr 2022 17:05:59 +0000 Subject: don't quit if imlib_create_image() fails (#248) ...simply print an error msg and try (slower) fallback. also adds a useful comment explaining why we're doing manual blending. --- image.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/image.c b/image.c index 1c57d27..ba5b1fe 100644 --- a/image.c +++ b/image.c @@ -604,9 +604,14 @@ void img_render(img_t *img) imlib_context_set_anti_alias(img->aa); imlib_context_set_drawable(win->buf.pm); + /* manual blending, for performance reasons. + * see https://phab.enlightenment.org/T8969#156167 for more details. + */ if (imlib_image_has_alpha()) { - if ((bg = imlib_create_image(dw, dh)) == NULL) - error(EXIT_FAILURE, ENOMEM, NULL); + if ((bg = imlib_create_image(dw, dh)) == NULL) { + error(0, ENOMEM, "Failed to create image"); + goto fallback; + } imlib_context_set_image(bg); imlib_image_set_has_alpha(0); @@ -636,6 +641,7 @@ void img_render(img_t *img) imlib_free_image(); imlib_context_set_color_modifier(img->cmod); } else { +fallback: imlib_render_image_part_on_drawable_at_size(sx, sy, sw, sh, dx, dy, dw, dh); } img->dirty = false; -- cgit v1.2.3