nsxivf05165a
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.
+8 −2
1 file changed
- M image.c +8 −2
| @@ -604,9 +604,14 @@ void img_render(img_t *img) | |||
| 604 | 604 | imlib_context_set_anti_alias(img->aa); | |
| 605 | 605 | imlib_context_set_drawable(win->buf.pm); | |
| 606 | 606 | ||
| 607 | + | /* manual blending, for performance reasons. | |
| 608 | + | * see https://phab.enlightenment.org/T8969#156167 for more details. | |
| 609 | + | */ | |
| 607 | 610 | if (imlib_image_has_alpha()) { | |
| 608 | − | if ((bg = imlib_create_image(dw, dh)) == NULL) | |
| 609 | − | error(EXIT_FAILURE, ENOMEM, NULL); | |
| 611 | + | if ((bg = imlib_create_image(dw, dh)) == NULL) { | |
| 612 | + | error(0, ENOMEM, "Failed to create image"); | |
| 613 | + | goto fallback; | |
| 614 | + | } | |
| 610 | 615 | imlib_context_set_image(bg); | |
| 611 | 616 | imlib_image_set_has_alpha(0); | |
| 612 | 617 | ||
| @@ -636,6 +641,7 @@ void img_render(img_t *img) | |||
| 636 | 641 | imlib_free_image(); | |
| 637 | 642 | imlib_context_set_color_modifier(img->cmod); | |
| 638 | 643 | } else { | |
| 644 | + | fallback: | |
| 639 | 645 | imlib_render_image_part_on_drawable_at_size(sx, sy, sw, sh, dx, dy, dw, dh); | |
| 640 | 646 | } | |
| 641 | 647 | img->dirty = false; | |