1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 03:37:34 +00:00

LibAccelGfx+LibWeb: Add texture cache for immutable bitmaps

This change introduces a texture cache for immutable bitmaps in the
GPU painter. The cache is persisted across page repaints, so now, on
page scroll repaint, in many cases, we won't need to upload any new
textures. Also, if the same image is painted more than once on a page,
its texture will only be uploaded once.

Generally, the GPU painter works much faster with this change on all
pages that have images.
This commit is contained in:
Aliaksandr Kalenik 2023-11-24 15:00:49 +01:00 committed by Andreas Kling
parent f4a5c136c3
commit a1c8fb10fa
7 changed files with 65 additions and 1 deletions

View file

@ -67,7 +67,7 @@ CommandResult PaintingCommandExecutorGPU::draw_scaled_bitmap(Gfx::IntRect const&
CommandResult PaintingCommandExecutorGPU::draw_scaled_immutable_bitmap(Gfx::IntRect const& dst_rect, Gfx::ImmutableBitmap const& immutable_bitmap, Gfx::IntRect const& src_rect, Gfx::Painter::ScalingMode scaling_mode)
{
painter().draw_scaled_bitmap(dst_rect, immutable_bitmap.bitmap(), src_rect, to_accelgfx_scaling_mode(scaling_mode));
painter().draw_scaled_immutable_bitmap(dst_rect, immutable_bitmap, src_rect, to_accelgfx_scaling_mode(scaling_mode));
return CommandResult::Continue;
}
@ -316,4 +316,9 @@ void PaintingCommandExecutorGPU::prepare_glyph_texture(HashMap<Gfx::Font const*,
painter().prepare_glyph_texture(unique_glyphs);
}
void PaintingCommandExecutorGPU::update_immutable_bitmap_texture_cache(HashMap<u32, Gfx::ImmutableBitmap const*>& immutable_bitmaps)
{
painter().update_immutable_bitmap_texture_cache(immutable_bitmaps);
}
}