mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 04:38:11 +00:00
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.
This commit is contained in:
parent
b9be6b7bb4
commit
ae060d7450
1 changed files with 1 additions and 1 deletions
|
@ -31,7 +31,7 @@ void SampleWidget::paint_event(GPaintEvent& event)
|
||||||
for (int x = 0; x < samples_to_draw; ++x) {
|
for (int x = 0; x < samples_to_draw; ++x) {
|
||||||
// FIXME: This might look nicer if drawn as lines.
|
// FIXME: This might look nicer if drawn as lines.
|
||||||
auto& sample = m_buffer->samples()[x];
|
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);
|
painter.set_pixel(p, Color::Green);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue