- npoints = get_time_axis_view().editor().frame_to_pixel (crossfade->length());
- // npoints = std::min (gdk_screen_width(), npoints);
+ PublicEditor& editor = get_time_axis_view().editor ();
+
+ framepos_t const editor_left = editor.leftmost_position ();
+ framepos_t const editor_right = editor_left + editor.current_page_frames ();
+ framepos_t const xfade_left = crossfade->position ();
+ framepos_t const xfade_right = xfade_left + crossfade->length ();
+
+ /* Work out the range of our frames that are visible */
+ framepos_t const min_frames = std::max (editor_left, xfade_left);
+ framepos_t const max_frames = std::min (editor_right, xfade_right);