]> err.no Git - mapper/commitdiff
Don't clear tile image cache on zoom. Add helper to set map tile cache size.
authorKaj-Michael Lang <milang@tal.org>
Fri, 25 Apr 2008 10:12:15 +0000 (13:12 +0300)
committerKaj-Michael Lang <milang@tal.org>
Fri, 25 Apr 2008 10:12:15 +0000 (13:12 +0300)
src/map.c

index f05c18871c1d258c8fb426b8106551e44297ca0e..4363fb73a0ecf88236e9cc04a810bfc5b4155510 100644 (file)
--- 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;