From 4031021298365b026a09d6029cc34f9af939e180 Mon Sep 17 00:00:00 2001 From: Kaj-Michael Lang Date: Fri, 25 Apr 2008 13:12:15 +0300 Subject: [PATCH] Don't clear tile image cache on zoom. Add helper to set map tile cache size. --- src/map.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/map.c b/src/map.c index f05c188..4363fb7 100644 --- a/src/map.c +++ b/src/map.c @@ -94,7 +94,7 @@ cairo_t *ct_pixmap; static GdkPixmap *map_pixmap; /* Tile cache, this might need some adjustment */ -#define MAP_CACHE_MAX (64) +#define MAP_CACHE_DEFAULT (64) static ImageCache *map_ic; /** The "base tile" is the upper-left tile in the pixmap. */ @@ -172,7 +172,7 @@ GtkWidget *map_widget; map_widget=gtk_drawing_area_new(); map_timer=g_timer_new(); -map_ic=image_cache_new(MAP_CACHE_MAX); +map_ic=image_cache_new(MAP_CACHE_DEFAULT); gtk_widget_set_extension_events(GTK_WIDGET(map_widget), GDK_EXTENSION_EVENTS_ALL); @@ -193,6 +193,12 @@ g_signal_connect(G_OBJECT(map_widget), "configure_event", G_CALLBACK(map_cb_conf return map_widget; } +void +map_set_cache_size(guint cache_size) +{ +image_cache_set_size(map_ic, cache_size); +} + static gboolean map_cb_after_realize(GtkWidget *map_widget, gpointer data) { @@ -1172,7 +1178,6 @@ gint nzoom; nzoom=_zoom+zdir; if ((nzoom >= 0) && (nzoom < map_max_zoom - 1)) { - image_cache_clear(map_ic); map_set_zoom(nzoom); } return nzoom; -- 2.39.5