mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 14:54:56 +01:00
CueEditor: fix a corner case when displaying a ridiculously short region
If there are less samples to show than there are pixels to show it, samples per pixel would be zero. Limit it to spp = 1
This commit is contained in:
parent
8cb3f79e0f
commit
1e430325d0
1 changed files with 14 additions and 1 deletions
|
|
@ -2613,7 +2613,18 @@ EditingContext::reset_zoom (samplecnt_t spp)
|
|||
}
|
||||
|
||||
std::pair<timepos_t, timepos_t> ext = max_zoom_extent();
|
||||
samplecnt_t max_extents_pp = max_extents_scale() * ((ext.second.samples() - ext.first.samples()) / _track_canvas_width);
|
||||
samplecnt_t p = (ext.second.samples() - ext.first.samples()) / _track_canvas_width;
|
||||
|
||||
if (spp == 0) {
|
||||
/* less samples than pixels */
|
||||
spp = 1;
|
||||
}
|
||||
|
||||
if (p == 0) {
|
||||
/* Less samples to display than there are pixels, use spp = 1 */
|
||||
p = 1;
|
||||
}
|
||||
samplecnt_t max_extents_pp = max_extents_scale() * p;
|
||||
|
||||
if (spp > max_extents_pp) {
|
||||
spp = max_extents_pp;
|
||||
|
|
@ -2623,6 +2634,8 @@ EditingContext::reset_zoom (samplecnt_t spp)
|
|||
return;
|
||||
}
|
||||
|
||||
assert (spp != 0);
|
||||
|
||||
pending_visual_change.add (VisualChange::ZoomLevel);
|
||||
pending_visual_change.samples_per_pixel = spp;
|
||||
ensure_visual_change_idle_handler ();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue