]> err.no Git - mapper/commitdiff
Remove some debug output.
authorKaj-Michael Lang <milang@angel.tal.org>
Wed, 27 Jun 2007 13:28:32 +0000 (16:28 +0300)
committerKaj-Michael Lang <milang@angel.tal.org>
Wed, 27 Jun 2007 13:28:32 +0000 (16:28 +0300)
Make code easier to read.

src/map.c

index 7e4d3b70d253e464cc925cf87e4e4ae8a5c30643..2cbb27522ca02b92f4d169c84a8c4b7a339ad07b 100644 (file)
--- a/src/map.c
+++ b/src/map.c
@@ -298,8 +298,7 @@ map_pixbuf_scale_inplace(GdkPixbuf * pixbuf, guint ratio_p2,
        guint n_channels = gdk_pixbuf_get_n_channels(pixbuf);
        guchar *pixels = gdk_pixbuf_get_pixels(pixbuf);
 
-       vprintf("%s(%d, %d, %d)\n", __PRETTY_FUNCTION__, ratio_p2, src_x,
-               src_y);
+       vprintf("%s(%d, %d, %d)\n", __PRETTY_FUNCTION__, ratio_p2, src_x, src_y);
 
        /* Sweep through the entire dest area, copying as necessary, but
         * DO NOT OVERWRITE THE SOURCE AREA.  We'll copy it afterward. */
@@ -307,21 +306,28 @@ map_pixbuf_scale_inplace(GdkPixbuf * pixbuf, guint ratio_p2,
                guint src_dim = dest_dim >> ratio_p2;
                guint src_endx = src_x - dest_x + src_dim;
                gint x, y;
+
                for (y = dest_dim - 1; y >= 0; y--) {
                        guint src_offset_y, dest_offset_y;
+
                        src_offset_y = (src_y + (y >> ratio_p2)) * rowstride;
                        dest_offset_y = (dest_y + y) * rowstride;
                        x = dest_dim - 1;
+
                        if ((unsigned)(dest_y + y - src_y) < src_dim
                            && (unsigned)(dest_x + x - src_x) < src_dim)
                                x -= src_dim;
+
                        for (; x >= 0; x--) {
                                guint src_offset, dest_offset, i;
+
                                src_offset = src_offset_y + (src_x + (x >> ratio_p2)) * n_channels;
                                dest_offset = dest_offset_y + (dest_x + x) * n_channels;
+
                                pixels[dest_offset] = pixels[src_offset];
                                for (i = n_channels - 1; i; i--)
                                        pixels[dest_offset + i] = pixels[src_offset + i];
+
                                if ((unsigned)(dest_y + y - src_y) < src_dim && x == src_endx)
                                        x -= src_dim;
                        }
@@ -576,6 +582,7 @@ map_render_tile(guint tilex, guint tiley, guint destx, guint desty,
                gchar buffer[BUFFER_SIZE];
                GError *error = NULL;
                gint zoff;
+
                vprintf("%s(%u, %u, %u, %u)\n", __PRETTY_FUNCTION__,
                        tilex, tiley, destx, desty);
 
@@ -592,53 +599,36 @@ map_render_tile(guint tilex, guint tiley, guint destx, guint desty,
                                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)) {
                                        if (!fast_fail)
-                                               map_initiate_download(tilex >>
-                                                                     zoff,
-                                                                     tiley >>
-                                                                     zoff,
-                                                                     _zoom +
-                                                                     zoff,
+                                               map_initiate_download(tilex >> zoff,
+                                                                     tiley >> zoff,
+                                                                     _zoom + zoff,
                                                                      -INITIAL_DOWNLOAD_RETRIES);
                                        fast_fail = TRUE;
                                }
                        } 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)
+                               if (zoff) {
                                        map_pixbuf_scale_inplace(pixbuf, zoff,
-                                                                (tilex -
-                                                                 ((tilex >>
-                                                                   zoff) <<
-                                                                  zoff)) <<
-                                                                (TILE_SIZE_P2 -
-                                                                 zoff),
-                                                                (tiley -
-                                                                 ((tiley >>
-                                                                   zoff) <<
-                                                                  zoff)) <<
-                                                                (TILE_SIZE_P2 -
-                                                                 zoff));
+                                                                (tilex - ((tilex >> zoff) << zoff)) << (TILE_SIZE_P2 - zoff),
+                                                                (tiley - ((tiley >> zoff) << zoff)) << (TILE_SIZE_P2 - zoff));
+                                       g_printf("I: %s (%d)\n", buffer, zoff);
+                               }
                        }
                }
        }
        if (pixbuf) {
                gdk_draw_pixbuf(_map_pixmap,
                                _gc[COLORABLE_MARK],
-                               pixbuf,
-                               0, 0,
-                               destx, desty,
+                               pixbuf, 0, 0, destx, desty,
                                TILE_SIZE_PIXELS, TILE_SIZE_PIXELS,
                                GDK_RGB_DITHER_NONE, 0, 0);
                g_object_unref(pixbuf);
@@ -1316,8 +1306,6 @@ static gfloat z=6.0;
 static gint last=6;
 gint iz;
 
-g_print("AutoZoom\n");
-
 if (_zoom_timeout_sid==0)
        return FALSE;
 
@@ -1337,15 +1325,13 @@ void
 map_set_autozoom(gboolean az)
 {
 if (az==TRUE) {
-       g_print("Enabled autozoom\n");
-       _zoom_timeout_sid=g_timeout_add(5000, (GSourceFunc) map_autozoomer, NULL);
+       _zoom_timeout_sid=g_timeout_add(_gps.speed<5 ? 2000 : 5000, (GSourceFunc) map_autozoomer, NULL);
        return;
 } else {
        if (_zoom_timeout_sid) {
                g_source_remove(_zoom_timeout_sid);
                _zoom_timeout_sid=0;
        }
-       g_print("Disabled autozoom\n");
        return;
 }