From 8b9f0b685140759341f6380addabb55fa5911822 Mon Sep 17 00:00:00 2001 From: Brenden Matthews Date: Sun, 14 Jun 2009 16:12:12 -0600 Subject: [PATCH] Fixup some imlib2 flush interval stuff. --- src/imlib2.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/imlib2.c b/src/imlib2.c index f31dd576..52740429 100644 --- a/src/imlib2.c +++ b/src/imlib2.c @@ -64,7 +64,11 @@ void cimlib_set_cache_size(long size) void cimlib_set_cache_flush_interval(long interval) { - cimlib_cache_flush_interval = interval; + if (interval >= 0) { + cimlib_cache_flush_interval = interval; + } else { + ERR("Imlib2: flush interval should be >= 0"); + } } void cimlib_cleanup(void) @@ -131,6 +135,10 @@ void cimlib_add_image(const char *args) cur->no_cache = 0; } } + if (cur->flush_interval < 0) { + ERR("Imlib2: flush interval should be >= 0"); + cur->flush_interval = 0; + } if (image_list_end) { image_list_end->next = cur; @@ -160,7 +168,7 @@ static void cimlib_draw_image(struct image_list_s *cur, int *clip_x, int *clip_y imlib_blend_image_onto_image(image, 1, 0, 0, w, h, cur->x, cur->y, cur->w, cur->h); imlib_context_set_image(image); - if (cur->no_cache || (now % cur->flush_interval == 0)) { + if (cur->no_cache || (cur->flush_interval && now % cur->flush_interval == 0)) { imlib_free_image_and_decache(); } else { imlib_free_image();