mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-03 00:42:54 +00:00
LibWeb: Fix CRC2D.getImageData() when width != height
We were mistakenly using the width as both width and height when getting ImageData from a 2D canvas.
This commit is contained in:
parent
e487f70bbf
commit
134c4b6335
Notes:
sideshowbarker
2024-07-17 07:16:27 +09:00
Author: https://github.com/awesomekling
Commit: 134c4b6335
Pull-request: https://github.com/SerenityOS/serenity/pull/23969
Reviewed-by: https://github.com/kennethmyhra ✅
3 changed files with 14 additions and 1 deletions
|
@ -29,7 +29,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<ImageData>> ImageData::create(JS::Realm& re
|
|||
// 2. Initialize this given sw, sh, and settings set to settings.
|
||||
// 3. Initialize the image data of this to transparent black.
|
||||
auto data = TRY(JS::Uint8ClampedArray::create(realm, sw * sh * 4));
|
||||
auto bitmap = TRY_OR_THROW_OOM(vm, Gfx::Bitmap::create_wrapper(Gfx::BitmapFormat::RGBA8888, Gfx::IntSize(sw, sw), 1, sw * sizeof(u32), data->data().data()));
|
||||
auto bitmap = TRY_OR_THROW_OOM(vm, Gfx::Bitmap::create_wrapper(Gfx::BitmapFormat::RGBA8888, Gfx::IntSize(sw, sh), 1, sw * sizeof(u32), data->data().data()));
|
||||
|
||||
return realm.heap().allocate<ImageData>(realm, realm, bitmap, data);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue