LibWeb: Copy bitmap onto the returned canvas when taking a screenshot

This commit is contained in:
Tim Ledbetter 2024-11-13 10:50:58 +00:00 committed by Andreas Kling
parent b08f12d3e6
commit d3c21e4038
Notes: github-actions[bot] 2024-11-13 13:39:33 +00:00

View file

@ -53,9 +53,9 @@ ErrorOr<JS::NonnullGCPtr<HTML::HTMLCanvasElement>, WebDriver::Error> draw_boundi
Gfx::IntRect paint_rect { rect.x(), rect.y(), paint_width, paint_height };
auto bitmap = MUST(Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, Gfx::AlphaType::Premultiplied, canvas.surface()->size()));
canvas.surface()->read_into_bitmap(*bitmap);
auto backing_store = Web::Painting::BitmapBackingStore(bitmap);
browsing_context.page().client().paint(paint_rect.to_type<Web::DevicePixels>(), backing_store);
canvas.surface()->write_from_bitmap(*bitmap);
// 7. Return success with canvas.
return canvas;