summaryrefslogtreecommitdiff
path: root/Applications/SoundPlayer/SampleWidget.cpp
diff options
context:
space:
mode:
authorMax Thrun <bear24rw@gmail.com>2019-09-11 00:02:10 -0700
committerAndreas Kling <awesomekling@gmail.com>2019-09-11 10:20:08 +0200
commitae060d74500877b1d1432f438de0103d435d3b95 (patch)
tree0a625201b7fdd6cc0e0e031036b6d7fabce27677 /Applications/SoundPlayer/SampleWidget.cpp
parentb9be6b7bb4866cf73d48f64a6a0b80164a22a550 (diff)
downloadserenity-ae060d74500877b1d1432f438de0103d435d3b95.zip
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.
Diffstat (limited to 'Applications/SoundPlayer/SampleWidget.cpp')
-rw-r--r--Applications/SoundPlayer/SampleWidget.cpp2
1 files changed, 1 insertions, 1 deletions
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);
}
}