summaryrefslogtreecommitdiffstats
path: root/image.c
diff options
context:
space:
mode:
Diffstat (limited to 'image.c')
-rw-r--r--image.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/image.c b/image.c
index 953b1c2..7b0df5d 100644
--- a/image.c
+++ b/image.c
@@ -39,22 +39,26 @@ void imlib_destroy() {
imlib_free_image();
}
-void img_load(img_t *img, const char *filename) {
+int img_load(img_t *img, const char *filename) {
Imlib_Image *im;
if (!img || !filename)
- return;
+ return -1;
if (imlib_context_get_image())
imlib_free_image();
- if (!(im = imlib_load_image(filename)))
- DIE("could not open image: %s", filename);
+ if (!(im = imlib_load_image(filename))) {
+ WARN("could not open image: %s", filename);
+ return -1;
+ }
imlib_context_set_image(im);
img->w = imlib_image_get_width();
img->h = imlib_image_get_height();
+
+ return 0;
}
void img_display(img_t *img, win_t *win) {