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();
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
(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)) {
}
} 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)
* 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);