mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-20 08:18:55 +00:00
LibWeb: Add OffscreenCanvas to IDL types
Add OffscreenCanvas to TexImageSource and CanvasImageSource. Implement all the necessary features to make it work in all cases where these types are used.
This commit is contained in:
parent
2ad3ce5d37
commit
f1a096d6e4
Notes:
github-actions[bot]
2025-06-30 15:47:37 +00:00
Author: https://github.com/Totto16
Commit: f1a096d6e4
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3788
Reviewed-by: https://github.com/ADKaster ✅
Reviewed-by: https://github.com/tcl3
8 changed files with 35 additions and 9 deletions
|
@ -730,7 +730,7 @@ struct ConvertedTexture {
|
|||
int height { 0 };
|
||||
};
|
||||
|
||||
static Optional<ConvertedTexture> read_and_pixel_convert_texture_image_source(Variant<GC::Root<ImageBitmap>, GC::Root<ImageData>, GC::Root<HTMLImageElement>, GC::Root<HTMLCanvasElement>, GC::Root<HTMLVideoElement>> const& source, WebIDL::UnsignedLong format, WebIDL::UnsignedLong type, Optional<int> destination_width = OptionalNone {}, Optional<int> destination_height = OptionalNone {})
|
||||
static Optional<ConvertedTexture> read_and_pixel_convert_texture_image_source(TexImageSource const& source, WebIDL::UnsignedLong format, WebIDL::UnsignedLong type, Optional<int> destination_width = OptionalNone {}, Optional<int> destination_height = OptionalNone {})
|
||||
{
|
||||
// FIXME: If this function is called with an ImageData whose data attribute has been neutered,
|
||||
// an INVALID_VALUE error is generated.
|
||||
|
@ -753,6 +753,9 @@ static Optional<ConvertedTexture> read_and_pixel_convert_texture_image_source(Va
|
|||
surface->read_into_bitmap(*bitmap);
|
||||
return Gfx::ImmutableBitmap::create(*bitmap);
|
||||
},
|
||||
[](GC::Root<OffscreenCanvas> const& source) -> RefPtr<Gfx::ImmutableBitmap> {
|
||||
return Gfx::ImmutableBitmap::create(*source->bitmap());
|
||||
},
|
||||
[](GC::Root<HTMLVideoElement> const& source) -> RefPtr<Gfx::ImmutableBitmap> {
|
||||
return Gfx::ImmutableBitmap::create(*source->bitmap());
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue