From a7e30bb081ab0a27147f97b8851d7bb76c39c51b Mon Sep 17 00:00:00 2001 From: Bert Date: Wed, 19 Jan 2011 14:07:45 +0100 Subject: Option handling, merged app.c & events.c into main.c --- image.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'image.c') diff --git a/image.c b/image.c index 235b2d4..65f79de 100644 --- a/image.c +++ b/image.c @@ -19,6 +19,8 @@ #include #include +#include + #include "sxiv.h" #include "image.h" @@ -32,7 +34,12 @@ void imlib_init(win_t *win) { imlib_context_set_drawable(win->xwin); } -void img_load(img_t *img, char *filename) { +void imlib_destroy() { + if (imlib_context_get_image()) + imlib_free_image(); +} + +void img_load(img_t *img, const char *filename) { if (!img || !filename) return; @@ -53,7 +60,7 @@ void img_render(img_t *img, win_t *win) { unsigned int sx, sy, sw, sh; unsigned int dx, dy, dw, dh; - if (!img || !win) + if (!img || !win || !imlib_context_get_image()) return; /* set zoom level to fit image into window */ -- cgit v1.2.3