Skip to content

Commit

Permalink
Piano: Ensure WaveWidget paints in-bounds
Browse files Browse the repository at this point in the history
Letting GUI::Frame::paint_event() cover up your mistakes is tacky :P
  • Loading branch information
willmcpherson2 authored and awesomekling committed Feb 10, 2020
1 parent 60fdc6c commit 2a66878
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Applications/Piano/WaveWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ int WaveWidget::sample_to_y(int sample) const
{
constexpr double sample_max = std::numeric_limits<i16>::max();
double percentage = sample / sample_max;
double portion_of_height = percentage * frame_inner_rect().height();
int y = (frame_inner_rect().height() / 2) + portion_of_height;
double portion_of_half_height = percentage * ((frame_inner_rect().height() - 1) / 2.0);
double y = (frame_inner_rect().height() / 2.0) + portion_of_half_height;
return y;
}

Expand Down

0 comments on commit 2a66878

Please sign in to comment.