mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-08 07:45:00 +01:00
prevent unnecessary calls to MidiViewBackground::maybe_extent_note_range()
When building a MidiView from a Model, we call ::add_note() for every note, and there is no reason to be adjusting the note range each and every time, since it potentially a slightly expensive operation.
This commit is contained in:
parent
695ca40b23
commit
1c09bb88be
2 changed files with 12 additions and 1 deletions
|
|
@ -143,6 +143,7 @@ MidiView::MidiView (std::shared_ptr<MidiTrack> mt,
|
||||||
, split_tuple (0)
|
, split_tuple (0)
|
||||||
, note_splitting (false)
|
, note_splitting (false)
|
||||||
, _extensible (false)
|
, _extensible (false)
|
||||||
|
, _redisplaying (false)
|
||||||
{
|
{
|
||||||
init (mt);
|
init (mt);
|
||||||
}
|
}
|
||||||
|
|
@ -181,6 +182,7 @@ MidiView::MidiView (MidiView const & other)
|
||||||
, split_tuple (0)
|
, split_tuple (0)
|
||||||
, note_splitting (false)
|
, note_splitting (false)
|
||||||
, _extensible (false)
|
, _extensible (false)
|
||||||
|
, _redisplaying (false)
|
||||||
{
|
{
|
||||||
init (other._midi_track);
|
init (other._midi_track);
|
||||||
}
|
}
|
||||||
|
|
@ -1140,6 +1142,11 @@ MidiView::redisplay (bool view_only)
|
||||||
|
|
||||||
region_resized (what_changed);
|
region_resized (what_changed);
|
||||||
} else {
|
} else {
|
||||||
|
/* Block calls to update note range at all as we add notes in
|
||||||
|
::model_changed()
|
||||||
|
*/
|
||||||
|
|
||||||
|
PBD::Unwinder<bool> uw (_redisplaying, true);
|
||||||
model_changed ();
|
model_changed ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2038,7 +2045,10 @@ MidiView::add_note (const std::shared_ptr<NoteType> note, bool visible)
|
||||||
{
|
{
|
||||||
NoteBase* event = 0;
|
NoteBase* event = 0;
|
||||||
|
|
||||||
|
if (!_redisplaying) {
|
||||||
|
/* We will catch up on note range somewhere later in ::redisplay() */
|
||||||
_midi_context.maybe_extend_note_range (note->note());
|
_midi_context.maybe_extend_note_range (note->note());
|
||||||
|
}
|
||||||
|
|
||||||
if (_midi_context.note_mode() == Sustained) {
|
if (_midi_context.note_mode() == Sustained) {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -656,6 +656,7 @@ class MidiView : public virtual sigc::trackable, public LineMerger
|
||||||
uint32_t split_tuple;
|
uint32_t split_tuple;
|
||||||
bool note_splitting;
|
bool note_splitting;
|
||||||
bool _extensible; /* if true, we can add data beyond the current region/source end */
|
bool _extensible; /* if true, we can add data beyond the current region/source end */
|
||||||
|
bool _redisplaying; /* if true, in the middle of a call to ::redisplay() */
|
||||||
|
|
||||||
bool extensible() const { return _extensible; }
|
bool extensible() const { return _extensible; }
|
||||||
void set_extensible (bool yn) { _extensible = yn; }
|
void set_extensible (bool yn) { _extensible = yn; }
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue