mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-05 06:32:30 +02:00
LibWeb: Ensure drawImage() always uses the first image frame
This commit is contained in:
committed by
Jelle Raaijmakers
parent
2c78fd5b89
commit
f1571c4217
Notes:
github-actions[bot]
2025-10-21 23:27:25 +00:00
Author: https://github.com/tcl3 Commit: https://github.com/LadybirdBrowser/ladybird/commit/f1571c42174 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6540 Reviewed-by: https://github.com/gmta ✅
@@ -136,10 +136,14 @@ WebIDL::ExceptionOr<void> CanvasRenderingContext2D::draw_image_internal(CanvasIm
|
||||
|
||||
auto bitmap = image.visit(
|
||||
[](GC::Root<HTMLImageElement> const& source) -> RefPtr<Gfx::ImmutableBitmap> {
|
||||
return source->immutable_bitmap();
|
||||
auto width = source->intrinsic_width().value_or({}).to_int();
|
||||
auto height = source->intrinsic_height().value_or({}).to_int();
|
||||
return source->default_image_bitmap_sized({ width, height });
|
||||
},
|
||||
[](GC::Root<SVG::SVGImageElement> const& source) -> RefPtr<Gfx::ImmutableBitmap> {
|
||||
return source->current_image_bitmap();
|
||||
auto width = source->intrinsic_width().value_or({}).to_int();
|
||||
auto height = source->intrinsic_height().value_or({}).to_int();
|
||||
return source->default_image_bitmap_sized({ width, height });
|
||||
},
|
||||
[](GC::Root<OffscreenCanvas> const& source) -> RefPtr<Gfx::ImmutableBitmap> { return Gfx::ImmutableBitmap::create(*source->bitmap()); },
|
||||
[](GC::Root<HTMLCanvasElement> const& source) -> RefPtr<Gfx::ImmutableBitmap> {
|
||||
|
||||
Reference in New Issue
Block a user