]> err.no Git - mapper/commitdiff
Code formating.
authorKaj-Michael Lang <milang@onion.tal.org>
Thu, 28 Jun 2007 12:42:35 +0000 (15:42 +0300)
committerKaj-Michael Lang <milang@onion.tal.org>
Thu, 28 Jun 2007 12:42:35 +0000 (15:42 +0300)
If new zoom is the same as before, do nothing.

src/map.c

index 7e4d3b70d253e464cc925cf87e4e4ae8a5c30643..2a180dfc5960805b781b1ad44ae1dde38d0c7f8e 100644 (file)
--- a/src/map.c
+++ b/src/map.c
@@ -54,6 +54,8 @@ static gint _map_mode=0;
 guint _num_downloads=0;
 guint _curr_download=0;
 
+static GHashTable *map_tile_hash = NULL;
+
 void map_render_paths();
 void map_force_redraw();
 gboolean curl_download_timeout();
@@ -570,14 +572,15 @@ map_render_tile(guint tilex, guint tiley, guint destx, guint desty,
                gboolean fast_fail)
 {
        GdkPixbuf *pixbuf = NULL;
+       gchar buffer[BUFFER_SIZE];
+       GError *error = NULL;
+       gint zoff;
+
+       vprintf("%s(%u, %u, %u, %u)\n", __PRETTY_FUNCTION__,
+               tilex, tiley, destx, desty);
 
        if (tilex < _world_size_tiles && tiley < _world_size_tiles) {
                /* The tile is possible. */
-               gchar buffer[BUFFER_SIZE];
-               GError *error = NULL;
-               gint zoff;
-               vprintf("%s(%u, %u, %u, %u)\n", __PRETTY_FUNCTION__,
-                       tilex, tiley, destx, desty);
 
                for (zoff = (_curr_repo->double_size ? 1 : 0);
                     !pixbuf && (_zoom + zoff) <= MAX_ZOOM
@@ -587,14 +590,13 @@ map_render_tile(guint tilex, guint tiley, guint destx, guint desty,
                                 (tilex >> zoff), (tiley >> zoff));
                        pixbuf = gdk_pixbuf_new_from_file(buffer, &error);
                        if (error || !pixbuf) {
-                               g_unlink(buffer);       /* Delete so we try again some other day. */
+                               /* Delete so we try again some other day. */
+                               g_unlink(buffer);       
                                pixbuf = NULL;
                                error = NULL;
 
                                /* Download, if we should. */
-                               if (_auto_download
-                                   && _curr_repo->type != REPOTYPE_NONE
-                                   &&
+                               if (_auto_download && _curr_repo->type != REPOTYPE_NONE &&
                                    !((_zoom + zoff -
                                       (_curr_repo->double_size ? 1 : 0))
                                      % _curr_repo->dl_zoom_steps)) {
@@ -610,10 +612,8 @@ map_render_tile(guint tilex, guint tiley, guint destx, guint desty,
                                }
                        } else {
                                /* Check if we need to trim. */
-                               if (gdk_pixbuf_get_width(pixbuf) !=
-                                   TILE_SIZE_PIXELS
-                                   || gdk_pixbuf_get_height(pixbuf) !=
-                                   TILE_SIZE_PIXELS)
+                               if (gdk_pixbuf_get_width(pixbuf) != TILE_SIZE_PIXELS
+                                   || gdk_pixbuf_get_height(pixbuf) != TILE_SIZE_PIXELS)
                                        pixbuf = pixbuf_trim(pixbuf);
                                /* Check if we need to blit. */
                                if (zoff)
@@ -774,6 +774,9 @@ void map_set_zoom(guint new_zoom)
         * condition also checks for new_zoom >= MIN_ZOOM. */
        if (new_zoom > (MAX_ZOOM - 1))
                return;
+       if (new_zoom == _zoom)
+               return;
+
        _zoom = new_zoom / _curr_repo->view_zoom_steps
            * _curr_repo->view_zoom_steps;
        _world_size_tiles = unit2tile(WORLD_SIZE_UNITS);