LibWeb: Use cached bitmap in SVGDecodedImageData::paint()

Use the existing bitmap() method which caches the ImmutableBitmap,
instead of creating a fresh snapshot from the painting surface on
every paint call.

This was regressed by d9e04ec9e8 which replaced draw_painting_surface
with a per-call snapshot to remove the DrawPaintingSurface dependency,
but didn't use the existing bitmap cache.
This commit is contained in:
Andreas Kling 2026-02-22 12:45:07 +01:00 committed by Alexander Kalenik
parent 80b80b28ef
commit 395a126110

View file

@ -219,12 +219,11 @@ RefPtr<Gfx::PaintingSurface> SVGDecodedImageData::surface(size_t, Gfx::IntSize s
void SVGDecodedImageData::paint(DisplayListRecordingContext& context, size_t, Gfx::IntRect dst_rect, Gfx::IntRect, Gfx::ScalingMode scaling_mode) const
{
auto surface = this->surface(0, dst_rect.size());
if (!surface)
auto immutable_bitmap = bitmap(0, dst_rect.size());
if (!immutable_bitmap)
return;
auto snapshot = Gfx::ImmutableBitmap::create_snapshot_from_painting_surface(*surface);
context.display_list_recorder().draw_scaled_immutable_bitmap(dst_rect, dst_rect, *snapshot, scaling_mode);
context.display_list_recorder().draw_scaled_immutable_bitmap(dst_rect, dst_rect, *immutable_bitmap, scaling_mode);
}
}