summaryrefslogtreecommitdiffstats
path: root/image.c
diff options
context:
space:
mode:
authorBert <ber.t@gmx.com>2011-01-19 14:07:45 +0100
committerBert <ber.t@gmx.com>2011-01-19 14:07:45 +0100
commita7e30bb081ab0a27147f97b8851d7bb76c39c51b (patch)
treed56d33272e11a27e9a5523bcbb2556745b7c6e1a /image.c
parent79c7e6178e9b577158408157ec23a477556ecf16 (diff)
downloadnsxiv-a7e30bb081ab0a27147f97b8851d7bb76c39c51b.tar.zst
Option handling, merged app.c & events.c into main.c
Diffstat (limited to 'image.c')
-rw-r--r--image.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/image.c b/image.c
index 235b2d4..65f79de 100644
--- a/image.c
+++ b/image.c
@@ -19,6 +19,8 @@
#include <stdlib.h>
#include <stdio.h>
+#include <Imlib2.h>
+
#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 */