From ae060d74500877b1d1432f438de0103d435d3b95 Mon Sep 17 00:00:00 2001 From: Max Thrun Date: Wed, 11 Sep 2019 00:02:10 -0700 Subject: [PATCH] SoundPlayer: Scale y coordinate to prevent drawing outside clip rect Previously if sample.left amplitude was more than 0.5 we would draw outside the painters clip rect. --- Applications/SoundPlayer/SampleWidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Applications/SoundPlayer/SampleWidget.cpp b/Applications/SoundPlayer/SampleWidget.cpp index f171cdeb24..1fa86e6a5c 100644 --- a/Applications/SoundPlayer/SampleWidget.cpp +++ b/Applications/SoundPlayer/SampleWidget.cpp @@ -31,7 +31,7 @@ void SampleWidget::paint_event(GPaintEvent& event) for (int x = 0; x < samples_to_draw; ++x) { // FIXME: This might look nicer if drawn as lines. auto& sample = m_buffer->samples()[x]; - Point p = { x, frame_inner_rect().center().y() + (int)(sample.left * frame_inner_rect().height()) }; + Point p = { x, frame_inner_rect().center().y() + (int)(sample.left * frame_inner_rect().height() / 2) }; painter.set_pixel(p, Color::Green); } }