[libchamplain] Check validity of the top left tile to be loaded



commit 9348681ee0e9fde605c5044ee7ef223de5b0e904
Author: JiÅ?í Techet <techet gmail com>
Date:   Sun May 16 14:57:08 2010 +0200

    Check validity of the top left tile to be loaded
    
    If it is outside the range, set it to the closest valid value. Prevents
    crash when map panned left on low zoom level.
    
    Signed-off-by: JiÅ?í Techet <techet gmail com>

 champlain/champlain-view.c |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)
---
diff --git a/champlain/champlain-view.c b/champlain/champlain-view.c
index 2084b91..2590e77 100644
--- a/champlain/champlain-view.c
+++ b/champlain/champlain-view.c
@@ -2410,15 +2410,16 @@ view_load_visible_tiles (ChamplainView *view)
   max_y_end = champlain_map_source_get_column_count (priv->map_source, priv->zoom_level);
 
   if (x_end > max_x_end)
-    {
-      x_end = max_x_end;
-      x_count = x_end - x_first;
-    }
+    x_end = max_x_end;
   if (y_end > max_y_end)
-    {
-      y_end = max_y_end;
-      y_count = y_end - y_first;
-    }
+    y_end = max_y_end;
+  if (x_first > max_x_end)
+    x_first = max_x_end;
+  if (y_first > max_y_end)
+    y_first = max_y_end;
+
+  x_count = x_end - x_first;
+  y_count = y_end - y_first;
 
   DEBUG ("Range %d, %d to %d, %d", x_first, y_first, x_end, y_end);
 



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