From 395a126110ad2c5e38f5cca367292c0ddb0ef920 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 22 Feb 2026 12:45:07 +0100 Subject: [PATCH] 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 d9e04ec9e8d which replaced draw_painting_surface with a per-call snapshot to remove the DrawPaintingSurface dependency, but didn't use the existing bitmap cache. --- Libraries/LibWeb/SVG/SVGDecodedImageData.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Libraries/LibWeb/SVG/SVGDecodedImageData.cpp b/Libraries/LibWeb/SVG/SVGDecodedImageData.cpp index df8e01449b..5e8c7c045c 100644 --- a/Libraries/LibWeb/SVG/SVGDecodedImageData.cpp +++ b/Libraries/LibWeb/SVG/SVGDecodedImageData.cpp @@ -219,12 +219,11 @@ RefPtr 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); } }