static osm_location map_loc = {NULL, NULL, NULL};
static GHashTable *map_tile_hash = NULL;
+typedef struct _map_tile_rdata map_tile_rdata;
+struct _map_tile_rdata {
+ guint tilex, tiley, zoom;
+ guint destx, desty;
+};
+
void map_render_paths();
void map_force_redraw();
gboolean curl_download_timeout();
snprintf(buffer, sizeof(buffer), "%s/%u/%u/%u.jpg",
_curr_repo->cache_dir, _zoom + zoff,
(tilex >> zoff), (tiley >> zoff));
+
pixbuf = gdk_pixbuf_new_from_file(buffer, &error);
if (error || !pixbuf) {
/* Delete so we try again some other day. */
g_object_unref(pixbuf);
} else {
gdk_draw_rectangle(_map_pixmap, _map_widget->style->black_gc,
- TRUE, destx, desty, TILE_SIZE_PIXELS,
- TILE_SIZE_PIXELS);
+ TRUE, destx, desty, TILE_SIZE_PIXELS, TILE_SIZE_PIXELS);
}
vprintf("%s(): return\n", __PRETTY_FUNCTION__);
}
+gboolean map_render_tile_idle(map_tile_rdata *mtr)
+{
+g_printf("IDLE RENDER\n");
+map_render_tile(mtr->tilex, mtr->tiley, mtr->destx, mtr->desty, FALSE);
+/*
+gtk_widget_queue_draw_area(_map_widget, mtr->destx, mtr->desty,
+ TILE_SIZE_PIXELS, TILE_SIZE_PIXELS);
+*/
+
+g_slice_free(map_tile_rdata, mtr);
+
+return FALSE;
+}
+
gboolean map_download_idle_refresh(ProgressUpdateInfo * pui)
{
vprintf("%s(%p, %s)\n", __PRETTY_FUNCTION__, pui, pui->src_str);
for (tiley = pui->tiley << zoom_diff,
tiley_end = tiley + (1 << zoom_diff);
tiley < tiley_end; tiley++) {
- if ((tilex - _base_tilex) < 4
- && (tiley - _base_tiley) < 3) {
+ if ((tilex - _base_tilex) < BUF_WIDTH_TILES && (tiley - _base_tiley) < BUF_HEIGHT_TILES) {
map_render_tile(tilex, tiley,
- ((tilex -
- _base_tilex)
- <<
- TILE_SIZE_P2),
- ((tiley -
- _base_tiley)
- <<
- TILE_SIZE_P2),
+ ((tilex - _base_tilex) << TILE_SIZE_P2),
+ ((tiley - _base_tiley) << TILE_SIZE_P2),
TRUE);
MACRO_MAP_RENDER_DATA();
gtk_widget_queue_draw_area
(_map_widget,
- ((tilex -
- _base_tilex) <<
- TILE_SIZE_P2) - _offsetx,
- ((tiley -
- _base_tiley) <<
- TILE_SIZE_P2) - _offsety,
- TILE_SIZE_PIXELS,
- TILE_SIZE_PIXELS);
+ ((tilex - _base_tilex) << TILE_SIZE_P2) - _offsetx,
+ ((tiley - _base_tiley) << TILE_SIZE_P2) - _offsety,
+ TILE_SIZE_PIXELS, TILE_SIZE_PIXELS);
}
}
}
gdk_draw_drawable(_map_pixmap,
_gc[COLORABLE_MARK],
_map_pixmap,
- old_x *
- TILE_SIZE_PIXELS,
- old_y *
- TILE_SIZE_PIXELS,
- new_x *
- TILE_SIZE_PIXELS,
- new_y *
- TILE_SIZE_PIXELS,
+ old_x * TILE_SIZE_PIXELS,
+ old_y * TILE_SIZE_PIXELS,
+ new_x * TILE_SIZE_PIXELS,
+ new_y * TILE_SIZE_PIXELS,
TILE_SIZE_PIXELS,
TILE_SIZE_PIXELS);
} else {
+#if 1
+ map_tile_rdata *mtr;
+
+ mtr=g_slice_new(map_tile_rdata);
+ mtr->tilex=new_base_tilex + new_x;
+ mtr->tiley=new_base_tiley + new_y;
+ mtr->destx=new_x * TILE_SIZE_PIXELS;
+ mtr->desty=new_y * TILE_SIZE_PIXELS;
+
+ gdk_draw_rectangle(_map_pixmap, _gc[COLORABLE_MARK_VELOCITY],
+ TRUE, mtr->destx, mtr->desty, TILE_SIZE_PIXELS, TILE_SIZE_PIXELS);
+
+ g_idle_add_full(G_PRIORITY_HIGH_IDLE,(GSourceFunc)map_render_tile_idle, mtr,NULL);
+#else
map_render_tile(new_base_tilex + new_x,
new_base_tiley + new_y,
- new_x *
- TILE_SIZE_PIXELS,
- new_y *
- TILE_SIZE_PIXELS,
+ new_x * TILE_SIZE_PIXELS,
+ new_y * TILE_SIZE_PIXELS,
FALSE);
+#endif
}
}
}