mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-22 17:31:58 -05:00
LibGfx: Fix crash when calling draw_triangle_wave() offscreen
I think this regressed in #5018. It easily triggered when scrolling a page that uses `text-decoration-style: wavy`.
This commit is contained in:
parent
bfdaa4ea24
commit
14e0830bd6
2 changed files with 10 additions and 0 deletions
|
@ -53,3 +53,11 @@ TEST_CASE(draw_rect_rough_bounds)
|
|||
painter.draw_rect(Gfx::IntRect(0, 0, 1, 1), Color::Black, true);
|
||||
painter.draw_rect(Gfx::IntRect(9, 9, 1, 1), Color::Black, true);
|
||||
}
|
||||
|
||||
TEST_CASE(draw_triangle_wave)
|
||||
{
|
||||
auto bitmap = MUST(Gfx::Bitmap::create(Gfx::BitmapFormat::BGRx8888, { 10, 10 }));
|
||||
Gfx::Painter painter(*bitmap);
|
||||
for (int y = -3; y < bitmap->height() + 3; ++y)
|
||||
painter.draw_triangle_wave({ 0, y }, { bitmap->width(), y }, Gfx::Color::Red, 3, 2);
|
||||
}
|
||||
|
|
|
@ -1912,6 +1912,8 @@ void Painter::draw_physical_pixel(IntPoint physical_position, Color color, int t
|
|||
|
||||
IntRect rect { physical_position, { thickness, thickness } };
|
||||
rect.intersect(clip_rect() * scale());
|
||||
if (rect.is_empty())
|
||||
return;
|
||||
fill_physical_rect(rect, color);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue