aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorN-R-K <79544946+N-R-K@users.noreply.github.com>2022-04-12 17:05:59 +0000
committerGitHub <noreply@github.com>2022-04-12 17:05:59 +0000
commitf05165a77a538b42ffd2d473eded25188cb56ea0 (patch)
tree36dd8319774e1b004952d8a59b1c4d739acd50ff
parentec5a51d79874d7ef2f54a22b83c3543f086c37da (diff)
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.
-rw-r--r--image.c10
1 files 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;