- int y_max = canvas->get_h();
- int max_y = center_pixel + scale_y / 2 - 1;
- if( y_max > max_y ) y_max = max_y;
+ int y_max = center_pixel + scale_y / 2 - 1;
+
+ double project_zoom = mwindow->edl->local_session->zoom_sample;
+ FloatAutos *speed_autos = !edit->track->has_speed() ? 0 :
+ (FloatAutos *)edit->track->automation->autos[AUTOMATION_SPEED];
+ int64_t edit_position = (x + pixmap_x - edit_x) * project_zoom;
+ int64_t start_position = edit->startsource;
+ start_position += !speed_autos ? edit_position :
+ speed_autos->automation_integral(edit->startproject, edit_position, PLAY_FORWARD);
+ int64_t end_position = edit->startsource;
+ edit_position = (x + w + pixmap_x - edit_x) * project_zoom;
+ end_position += !speed_autos ? edit_position :
+ speed_autos->automation_integral(edit->startproject, edit_position, PLAY_FORWARD);
+
+ double session_sample_rate = mwindow->edl->session->sample_rate;
+ double asset_over_session = (double)indexable->get_sample_rate() / session_sample_rate;
+ start_position *= asset_over_session;
+ end_position *= asset_over_session;
+ int sample_size = end_position - start_position;
+ if( sample_size < 0 ) sample_size = 0;
+ int source_samples = sample_size + 1;
+