1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:17:44 +00:00

LibAccelGfx+LibWeb: Discard painting of commands outside of viewport

This commit is contained in:
Aliaksandr Kalenik 2023-11-26 16:29:40 +01:00 committed by Andreas Kling
parent c68a9b2cfe
commit 17fb82d49b
3 changed files with 9 additions and 3 deletions

View file

@ -550,11 +550,13 @@ void Painter::restore()
void Painter::set_clip_rect(Gfx::IntRect rect)
{
state().clip_rect = transform().map(rect);
GL::enable_scissor_test(transform().map(rect));
}
void Painter::clear_clip_rect()
{
state().clip_rect = { { 0, 0 }, m_target_canvas->size() };
GL::disable_scissor_test();
}
@ -569,6 +571,7 @@ void Painter::set_target_canvas(NonnullRefPtr<Canvas> canvas)
m_target_canvas = canvas;
canvas->bind();
GL::set_viewport({ 0, 0, canvas->size().width(), canvas->size().height() });
state().clip_rect = { { 0, 0 }, m_target_canvas->size() };
}
void Painter::flush(Gfx::Bitmap& bitmap)