mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-08 06:09:58 +00:00
LibWeb: Ensure drawImage() always uses the first image frame
This commit is contained in:
parent
2c78fd5b89
commit
f1571c4217
Notes:
github-actions[bot]
2025-10-21 23:27:25 +00:00
Author: https://github.com/tcl3
Commit: f1571c4217
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6540
Reviewed-by: https://github.com/gmta ✅
4 changed files with 44 additions and 2 deletions
|
|
@ -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> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue