[libchamplain] Remove all invalid tiles within view_load_visible_tiles()



commit 9824d36b20d1d7e67c48906761395e8a77ee0a5f
Author: JiÅ?í Techet <techet gmail com>
Date:   Wed Mar 17 23:27:58 2010 +0100

    Remove all invalid tiles within view_load_visible_tiles()
    
    Now view_load_visible_tiles() is the only function that creates or
    destroys tiles, which eliminates all special cases where we might
    forget to destroy tiles.
    
    Signed-off-by: JiÅ?í Techet <techet gmail com>

 champlain/champlain-view.c |   10 +++-------
 1 files changed, 3 insertions(+), 7 deletions(-)
---
diff --git a/champlain/champlain-view.c b/champlain/champlain-view.c
index cd8cf90..fe7e5a7 100644
--- a/champlain/champlain-view.c
+++ b/champlain/champlain-view.c
@@ -1967,8 +1967,6 @@ champlain_view_set_zoom_level (ChamplainView *view,
 
   priv->zoom_level = zoom_level;
 
-  clutter_group_remove_all (CLUTTER_GROUP (priv->map_layer));
-
   DEBUG ("Zooming to %d", zoom_level);
 
   resize_viewport (view);
@@ -2244,9 +2242,11 @@ view_load_visible_tiles (ChamplainView *view)
 
       gint tile_x = champlain_tile_get_x (tile);
       gint tile_y = champlain_tile_get_y (tile);
+      guint zoom_level = champlain_tile_get_zoom_level (tile);
 
       if (tile_x < x_first || tile_x >= x_end ||
-          tile_y < y_first || tile_y >= y_end)
+          tile_y < y_first || tile_y >= y_end ||
+          zoom_level != priv->zoom_level)
         clutter_container_remove_actor (CLUTTER_CONTAINER (priv->map_layer), CLUTTER_ACTOR (tile));
       else
         tile_map[(tile_y - y_first) * x_count + (tile_x - x_first)] = TRUE;
@@ -2410,8 +2410,6 @@ champlain_view_set_map_source (ChamplainView *view,
       g_object_notify (G_OBJECT (view), "zoom-level");
     }
 
-  clutter_group_remove_all (CLUTTER_GROUP (priv->map_layer));
-
   update_license (view);
   champlain_view_center_on (view, priv->latitude, priv->longitude);
 
@@ -2793,8 +2791,6 @@ view_set_zoom_level_at (ChamplainView *view,
 
   priv->zoom_level = zoom_level;
 
-  clutter_group_remove_all (CLUTTER_GROUP (priv->map_layer));
-
   /* Get the new x,y in the new zoom level */
   x2 = champlain_map_source_get_x (priv->map_source, priv->zoom_level, lon);
   y2 = champlain_map_source_get_y (priv->map_source, priv->zoom_level, lat);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]