mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-07 10:06:03 +00:00
Piano: Ensure WaveWidget paints in-bounds
Letting GUI::Frame::paint_event() cover up your mistakes is tacky :P
This commit is contained in:
parent
60fdc6c9ab
commit
2a66878148
Notes:
sideshowbarker
2024-07-19 09:28:57 +09:00
Author: https://github.com/willmcpherson2
Commit: 2a66878148
Pull-request: https://github.com/SerenityOS/serenity/pull/1204
Reviewed-by: https://github.com/awesomekling ✅
1 changed files with 2 additions and 2 deletions
|
@ -47,8 +47,8 @@ int WaveWidget::sample_to_y(int sample) const
|
||||||
{
|
{
|
||||||
constexpr double sample_max = std::numeric_limits<i16>::max();
|
constexpr double sample_max = std::numeric_limits<i16>::max();
|
||||||
double percentage = sample / sample_max;
|
double percentage = sample / sample_max;
|
||||||
double portion_of_height = percentage * frame_inner_rect().height();
|
double portion_of_half_height = percentage * ((frame_inner_rect().height() - 1) / 2.0);
|
||||||
int y = (frame_inner_rect().height() / 2) + portion_of_height;
|
double y = (frame_inner_rect().height() / 2.0) + portion_of_half_height;
|
||||||
return y;
|
return y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue