From a40388517ae405243c55a285bc31750d100b3552 Mon Sep 17 00:00:00 2001 From: vikingis Date: Sun, 4 Sep 2005 23:24:56 +0000 Subject: [PATCH] Fix mapcache stuff git-svn-id: https://viking.svn.sourceforge.net/svnroot/viking/trunk@7 02d69b8e-d120-0410-893f-fe71a3b6e39e --- ChangeLog | 3 +++ TODO | 3 --- src/mapcache.c | 4 +++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 55459a8..c3dbd06 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2005-09-04 +Map cache fix: if only one map can fit / one map is bigger than cache size, then that's OK. + 2005-08-18 Map cache size based on memory usage, not number of images. Some flaws to be worked out still in this. diff --git a/TODO b/TODO index 144a2e9..4fdc451 100644 --- a/TODO +++ b/TODO @@ -1,8 +1,5 @@ FIXES: -Mapcache: checks if only a few images in cache (list_shift) -what happens if image is bigger than cache size! fix this... - del from cache when updating image check out bgitemcount stuff in background.c diff --git a/src/mapcache.c b/src/mapcache.c index 5ae0fc8..02074e3 100644 --- a/src/mapcache.c +++ b/src/mapcache.c @@ -101,7 +101,9 @@ void a_mapcache_add ( GdkPixbuf *pixbuf, gint x, gint y, gint z, guint8 type, gu queue_size -= 100; queue_count --; g_hash_table_remove ( cache, oldkey ); - while ( queue_size > VIK_CONFIG_MAPCACHE_SIZE ) { + + while ( queue_size > VIK_CONFIG_MAPCACHE_SIZE && + (queue_tail->next != queue_tail) ) { /* make sure there's more than one thing to delete */ oldkey = list_shift (); oldbuf = g_hash_table_lookup ( cache, oldkey ); queue_size -= gdk_pixbuf_get_rowstride(oldbuf) * gdk_pixbuf_get_height(oldbuf); -- 2.11.4.GIT