- if ( vtl->ct_sync_done && vtl->current_track && vtl->current_track->trackpoints ) {
- GList *iter = vtl->current_track->trackpoints;
- new_track_move_passalong_t *passalong;
+ if ( vtl->draw_sync_done && vtl->current_track && vtl->current_track->trackpoints ) {
+ GList *iter = g_list_last ( vtl->current_track->trackpoints );
+
+ static GdkPixmap *pixmap = NULL;
+ int w1, h1, w2, h2;
+ // Need to check in case window has been resized
+ w1 = vik_viewport_get_width(vvp);
+ h1 = vik_viewport_get_height(vvp);
+ if (!pixmap) {
+ pixmap = gdk_pixmap_new ( GTK_WIDGET(vvp)->window, w1, h1, -1 );
+ }
+ gdk_drawable_get_size (pixmap, &w2, &h2);
+ if (w1 != w2 || h1 != h2) {
+ g_object_unref ( G_OBJECT ( pixmap ) );
+ pixmap = gdk_pixmap_new ( GTK_WIDGET(vvp)->window, w1, h1, -1 );
+ }
+
+ // Reset to background
+ gdk_draw_drawable (pixmap,
+ vtl->current_track_newpoint_gc,
+ vik_viewport_get_pixmap(vvp),
+ 0, 0, 0, 0, -1, -1);
+
+ draw_sync_t *passalong;