diff options
author | nick_m <mainsbridge@gmail.com> | 2016-10-16 03:11:05 +1100 |
---|---|---|
committer | nick_m <mainsbridge@gmail.com> | 2016-10-16 03:11:05 +1100 |
commit | 169296862737c16107e2d4855234946869c75739 (patch) | |
tree | 73b9b01756d2308de8926570a6f9531ec59416ff /gtk2_ardour/ghostregion.cc | |
parent | 3a0a628a75fdbc9da1c0ad2a21f46286a5184503 (diff) |
Slightly improve note update performance, fix note resizing for non-4.0 meter divisors.
Diffstat (limited to 'gtk2_ardour/ghostregion.cc')
-rw-r--r-- | gtk2_ardour/ghostregion.cc | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/gtk2_ardour/ghostregion.cc b/gtk2_ardour/ghostregion.cc index ef0e020dcf..1936609e8a 100644 --- a/gtk2_ardour/ghostregion.cc +++ b/gtk2_ardour/ghostregion.cc @@ -375,28 +375,35 @@ MidiGhostRegion::clear_events() * @param parent The CanvasNote from the parent MidiRegionView. */ void -MidiGhostRegion::update_note (NoteBase* parent) +MidiGhostRegion::update_note (Note* note) { - GhostEvent* ev = find_event (parent); + GhostEvent* ev = find_event (note); if (!ev) { return; } - Note* note = NULL; ArdourCanvas::Rectangle* rect = NULL; - Hit* hit = NULL; + if ((rect = dynamic_cast<ArdourCanvas::Rectangle*>(ev->item))) { + rect->set (ArdourCanvas::Rect (note->x0(), rect->y0(), note->x1(), rect->y1())); + } +} +/** Update the x positions of our representation of a parent's hit. + * @param hit The CanvasHit from the parent MidiRegionView. + */ +void +MidiGhostRegion::update_hit (Hit* hit) +{ + GhostEvent* ev = find_event (hit); + if (!ev) { + return; + } + ArdourCanvas::Polygon* poly = NULL; - if ((note = dynamic_cast<Note*>(parent))) { - if ((rect = dynamic_cast<ArdourCanvas::Rectangle*>(ev->item))) { - rect->set (ArdourCanvas::Rect (parent->x0(), rect->y0(), parent->x1(), rect->y1())); - } - } else if ((hit = dynamic_cast<Hit*>(parent))) { - if ((poly = dynamic_cast<ArdourCanvas::Polygon*>(ev->item))) { - ArdourCanvas::Duple ppos = hit->position(); - ArdourCanvas::Duple gpos = poly->position(); - gpos.x = ppos.x; - poly->set_position(gpos); - } + if ((poly = dynamic_cast<ArdourCanvas::Polygon*>(ev->item))) { + ArdourCanvas::Duple ppos = hit->position(); + ArdourCanvas::Duple gpos = poly->position(); + gpos.x = ppos.x; + poly->set_position(gpos); } } |