- 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;
+
+ int64_t start_source = (pixmap_x - edit_x + x) *
+ mwindow->edl->local_session->zoom_sample + edit->startsource;
+ int64_t start_speed = speed_autos->automation_integral(0, start_source, PLAY_FORWARD);
+ int64_t start_asset = start_speed * asset_over_session;
+ if( start_asset < 0 ) start_asset = 0;
+ int64_t end_source = (pixmap_x - edit_x + x + w) *
+ mwindow->edl->local_session->zoom_sample + edit->startsource;
+ int64_t end_speed = speed_autos->automation_integral(0, end_source, PLAY_FORWARD);
+ int64_t end_asset = end_speed * asset_over_session;
+ if( end_asset < 0 ) end_asset = 0;
+ int64_t total_source_samples = end_asset - start_asset;
+ if( total_source_samples < 0 ) total_source_samples = 0;
+