diff options
Diffstat (limited to 'Userland/Applications/Piano')
-rw-r--r-- | Userland/Applications/Piano/RollWidget.cpp | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/Userland/Applications/Piano/RollWidget.cpp b/Userland/Applications/Piano/RollWidget.cpp index d53e0ef64e..51bc56f27c 100644 --- a/Userland/Applications/Piano/RollWidget.cpp +++ b/Userland/Applications/Piano/RollWidget.cpp @@ -105,18 +105,6 @@ void RollWidget::paint_event(GUI::PaintEvent& event) background_painter.translate(-x_offset, -y_offset); background_painter.translate(horizontal_note_offset_remainder, note_offset_remainder); - for (int note = note_count - (note_offset + notes_to_paint); note <= (note_count - 1) - note_offset; ++note) { - int y = ((note_count - 1) - note) * note_height; - - Gfx::IntRect note_name_rect(3, y, 1, note_height); - const char* note_name = note_names[note % notes_per_octave]; - - background_painter.draw_text(note_name_rect, note_name, Gfx::TextAlignment::CenterLeft); - note_name_rect.translate_by(Gfx::FontDatabase::default_font().width(note_name) + 2, 0); - if (note % notes_per_octave == 0) - background_painter.draw_text(note_name_rect, String::formatted("{}", note / notes_per_octave + 1), Gfx::TextAlignment::CenterLeft); - } - m_prev_zoom_level = m_zoom_level; m_prev_scroll_x = horizontal_scrollbar().value(); m_prev_scroll_y = vertical_scrollbar().value(); @@ -165,6 +153,14 @@ void RollWidget::paint_event(GUI::PaintEvent& event) painter.fill_rect(rect, note_pressed_color); painter.draw_rect(rect, Color::Black); } + + Gfx::IntRect note_name_rect(3, y, 1, note_height); + const char* note_name = note_names[note % notes_per_octave]; + + painter.draw_text(note_name_rect, note_name, Gfx::TextAlignment::CenterLeft); + note_name_rect.translate_by(Gfx::FontDatabase::default_font().width(note_name) + 2, 0); + if (note % notes_per_octave == 0) + painter.draw_text(note_name_rect, String::formatted("{}", note / notes_per_octave + 1), Gfx::TextAlignment::CenterLeft); } int x = m_roll_width * (static_cast<double>(m_track_manager.time()) / roll_length); |