13
0

Use Note::set (Rect) for speed improvement when rendering notes.

This commit is contained in:
nick_m 2016-06-25 00:05:23 +10:00
parent 39692eed66
commit b732147676
2 changed files with 5 additions and 11 deletions

View File

@ -349,8 +349,7 @@ MidiGhostRegion::add_note (NoteBase* n)
ArdourCanvas::Rectangle* rect = NULL;
ArdourCanvas::Polygon* poly = NULL;
if ((rect = dynamic_cast<ArdourCanvas::Rectangle*>(event->item))) {
rect->set_y0 (y);
rect->set_y1 (y + h);
rect->set (ArdourCanvas::Rect (rect->x0(), y, rect->x1(), y + h));
} else if ((poly = dynamic_cast<ArdourCanvas::Polygon*>(event->item))) {
Duple position = poly->position();
position.y = y;
@ -389,10 +388,7 @@ MidiGhostRegion::update_note (NoteBase* parent)
ArdourCanvas::Polygon* poly = NULL;
if ((note = dynamic_cast<Note*>(parent))) {
if ((rect = dynamic_cast<ArdourCanvas::Rectangle*>(ev->item))) {
double const x1 = parent->x0 ();
double const x2 = parent->x1 ();
rect->set_x0 (x1);
rect->set_x1 (x2);
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))) {

View File

@ -1184,11 +1184,11 @@ MidiRegionView::redisplay_model()
_optimization_iterator = _events.begin();
bool empty_when_starting = _events.empty();
NoteBase* cne;
for (MidiModel::Notes::iterator n = notes.begin(); n != notes.end(); ++n) {
boost::shared_ptr<NoteType> note (*n);
NoteBase* cne;
bool visible;
if (note_in_region_range (note, visible)) {
@ -1732,10 +1732,8 @@ MidiRegionView::update_sustained (Note* ev, bool update_ghost_regions)
y1 = y0 + std::max(1., floor(midi_stream_view()->note_height()) - 1);
ev->set_x0 (x0);
ev->set_x1 (x1);
ev->set_y0 (y0);
ev->set_y1 (y1);
ArdourCanvas::Rect rect (x0, y0, x1, y1);
ev->set (rect);
if (!note->length()) {
if (_active_notes && note->note() < 128) {