Diff of /trunk/src/map-tool.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 151 by harbaum, Fri Oct 30 20:09:13 2009 UTC revision 152 by harbaum, Mon Nov 2 10:53:01 2009 UTC
# Line 194  static void map_draw_gpx(appdata_t *appd Line 194  static void map_draw_gpx(appdata_t *appd
194  static void map_setup(map_context_t *context) {  static void map_setup(map_context_t *context) {
195    char *name = NULL;    char *name = NULL;
196    
197      int cache_num = gpx_total_caches_global(context->appdata->gpx);
198    
199      if(context->caches_displayed && (cache_num != context->cache_list_len)) {
200        g_free(context->caches_displayed);
201        context->caches_displayed = NULL;
202        context->cache_list_len = 0;
203      }
204    
205      /* allocate buffer */
206      if(cache_num) {
207        context->cache_list_len = cache_num;
208        context->caches_displayed = g_new0(cache_display_t, cache_num);
209        printf("allocated space to handle %d map icons\n", cache_num);
210      }
211    
212    if(!context->appdata->cur_gpx && !context->appdata->cur_cache) {    if(!context->appdata->cur_gpx && !context->appdata->cur_cache) {
213      if(context->state != MAP_ALL) {      if(context->state != MAP_ALL) {
214        printf("map_setup(ALL)\n");        printf("map_setup(ALL)\n");
# Line 432  cairo_draw_pixbuf(cairo_t *cr, GdkPixbuf Line 447  cairo_draw_pixbuf(cairo_t *cr, GdkPixbuf
447                                 gdk_pixbuf_get_height(buf));                                 gdk_pixbuf_get_height(buf));
448    
449    // Create the new Context for the ImageSurface    // Create the new Context for the ImageSurface
450      g_assert(image_surface);
451    cairo_t *context = cairo_create(image_surface);    cairo_t *context = cairo_create(image_surface);
452    
453    // Draw the image on the new Context    // Draw the image on the new Context
# Line 696  static void on_window_destroy(GtkWidget Line 712  static void on_window_destroy(GtkWidget
712    gtk_timeout_remove(context->handler_id);    gtk_timeout_remove(context->handler_id);
713    gps_unregister_callback(appdata, context->cb_id);    gps_unregister_callback(appdata, context->cb_id);
714    
715      if(context->caches_displayed) {
716        g_free(context->caches_displayed);
717        context->caches_displayed = NULL;
718      }
719    
720    g_free(context);    g_free(context);
721    appdata->map.context = NULL;    appdata->map.context = NULL;
722  }  }

Legend:
Removed from v.151  
changed lines
  Added in v.152