From 85c1973f30051f13024f1c521f267890e7bc2447 Mon Sep 17 00:00:00 2001 From: Veratil Date: Sat, 16 Jan 2021 17:57:53 -0600 Subject: [PATCH] Fix drawNoteRect misalignments --- src/gui/editors/PianoRoll.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/gui/editors/PianoRoll.cpp b/src/gui/editors/PianoRoll.cpp index eace4a464..cbab0fce6 100644 --- a/src/gui/editors/PianoRoll.cpp +++ b/src/gui/editors/PianoRoll.cpp @@ -3377,7 +3377,6 @@ void PianoRoll::paintEvent(QPaintEvent * pe ) { len_ticks = 4; } - const int key = note->key() - m_startKey + 1; int pos_ticks = note->pos(); @@ -3396,7 +3395,7 @@ void PianoRoll::paintEvent(QPaintEvent * pe ) // we've done and checked all, let's draw the note drawNoteRect( - p, x + m_whiteKeyWidth, y_base - key * m_keyLineHeight, note_width, + p, x + m_whiteKeyWidth, (topKey - note->key()) * m_keyLineHeight + keyAreaTop() - 1, note_width, note, m_ghostNoteColor, m_ghostNoteTextColor, m_selectedNoteColor, m_ghostNoteOpacity, m_ghostNoteBorders, drawNoteNames); } @@ -3434,10 +3433,9 @@ void PianoRoll::paintEvent(QPaintEvent * pe ) // is the note in visible area? if (note->key() > bottomKey && note->key() <= topKey) { - // we've done and checked all, let's draw the note drawNoteRect( - p, x + m_whiteKeyWidth, y_base - key * m_keyLineHeight, note_width, + p, x + m_whiteKeyWidth, (topKey - note->key()) * m_keyLineHeight + keyAreaTop() - 1, note_width, note, m_noteColor, m_noteTextColor, m_selectedNoteColor, m_noteOpacity, m_noteBorders, drawNoteNames); } @@ -3540,7 +3538,6 @@ void PianoRoll::paintEvent(QPaintEvent * pe ) continue; } - const int key = note->key() - m_startKey + 1; int pos_ticks = note->pos(); @@ -3559,7 +3556,7 @@ void PianoRoll::paintEvent(QPaintEvent * pe ) // we've done and checked all, let's draw the note drawNoteRect( - p, x + m_whiteKeyWidth, y_base - key * m_keyLineHeight, note_width, + p, x + m_whiteKeyWidth, (topKey - note->key()) * m_keyLineHeight + keyAreaTop() - 1, note_width, note, m_stepRecorder.curStepNoteColor(), m_noteTextColor, m_selectedNoteColor, m_noteOpacity, m_noteBorders, drawNoteNames); }