summaryrefslogtreecommitdiffstats
path: root/thumbs.c
diff options
context:
space:
mode:
authorBert <ber.t@gmx.com>2011-08-19 13:26:58 +0200
committerBert <ber.t@gmx.com>2011-08-19 13:26:58 +0200
commit1d7849efc1fe85d20b8aa4916e75cb3eb658dba9 (patch)
treeb15a22701f325bb069c45fa67e732ae946e44413 /thumbs.c
parent421f01202238ad56c5b2edc2e1b26194482b614f (diff)
downloadnsxiv-1d7849efc1fe85d20b8aa4916e75cb3eb658dba9.tar.zst
Added force parameter to tns_load() to disregard cache
Diffstat (limited to 'thumbs.c')
-rw-r--r--thumbs.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/thumbs.c b/thumbs.c
index 97bb2b2..425970d 100644
--- a/thumbs.c
+++ b/thumbs.c
@@ -212,9 +212,11 @@ void tns_free(tns_t *tns) {
}
}
-int tns_load(tns_t *tns, int n, const fileinfo_t *file, unsigned char silent) {
+int tns_load(tns_t *tns, int n, const fileinfo_t *file,
+ Bool force, Bool silent)
+{
int w, h;
- int use_cache, cached = 0;
+ int use_cache, cache_hit = 0;
float z, zw, zh;
thumb_t *t;
Imlib_Image *im;
@@ -234,11 +236,11 @@ int tns_load(tns_t *tns, int n, const fileinfo_t *file, unsigned char silent) {
}
if ((use_cache = tns_cache_enabled())) {
- if ((im = tns_cache_load(file->path)))
- cached = 1;
+ if (!force && (im = tns_cache_load(file->path)))
+ cache_hit = 1;
}
- if (!cached &&
+ if (!cache_hit &&
(access(file->path, R_OK) || !(im = imlib_load_image(file->path))))
{
if (!silent)
@@ -262,7 +264,7 @@ int tns_load(tns_t *tns, int n, const fileinfo_t *file, unsigned char silent) {
imlib_free_image_and_decache();
- if (use_cache && !cached)
+ if (use_cache && !cache_hit)
tns_cache_write(t, False);
tns->dirty = 1;