Skip to content

Commit

Permalink
SoundPlayer: Scale y coordinate to prevent drawing outside clip rect
Browse files Browse the repository at this point in the history
Previously if sample.left amplitude was more than 0.5 we would draw
outside the painters clip rect.
  • Loading branch information
bear24rw authored and awesomekling committed Sep 11, 2019
1 parent b9be6b7 commit ae060d7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Applications/SoundPlayer/SampleWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down

0 comments on commit ae060d7

Please sign in to comment.