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. */
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;
}
gchar buffer[BUFFER_SIZE];
GError *error = NULL;
gint zoff;
+
vprintf("%s(%u, %u, %u, %u)\n", __PRETTY_FUNCTION__,
tilex, tiley, destx, 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);
static gint last=6;
gint iz;
-g_print("AutoZoom\n");
-
if (_zoom_timeout_sid==0)
return FALSE;
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;
}