From 095217b26f43b711c8ebc281110553ec788f7ebe Mon Sep 17 00:00:00 2001 From: Bert Date: Thu, 17 Feb 2011 15:58:11 +0100 Subject: Linked thumbnails to files --- thumbs.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'thumbs.c') diff --git a/thumbs.c b/thumbs.c index bac00d9..e66dd1c 100644 --- a/thumbs.c +++ b/thumbs.c @@ -25,6 +25,7 @@ #include "thumbs.h" #include "util.h" +extern Imlib_Image *im_broken; const int thumb_dim = THUMB_SIZE + 10; void tns_init(tns_t *tns, int cnt) { @@ -57,19 +58,20 @@ void tns_load(tns_t *tns, win_t *win, const char *filename) { if (!tns || !win || !filename) return; - if (!(im = imlib_load_image(filename))) - return; - - imlib_context_set_image(im); + if ((im = imlib_load_image(filename))) + imlib_context_set_image(im); + else + imlib_context_set_image(im_broken); w = imlib_image_get_width(); h = imlib_image_get_height(); zw = (float) THUMB_SIZE / (float) w; zh = (float) THUMB_SIZE / (float) h; z = MIN(zw, zh); + if (!im && z > 1.0) + z = 1.0; t = &tns->thumbs[tns->cnt++]; - t->filename = filename; t->w = z * w; t->h = z * h; -- cgit v1.2.3-54-g00ecf