mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 11:49:44 +00:00
LibJS+LibWeb: Make Uint8ClampedArray use TypedArray
Instead of being its own separate unrelated class. This automatically makes typed array properties available to it, as well as making it available to the runtime.
This commit is contained in:
parent
ba5da79617
commit
6af596d9e8
Notes:
sideshowbarker
2024-07-18 17:22:37 +09:00
Author: https://github.com/alimpfard
Commit: 6af596d9e8
Pull-request: https://github.com/SerenityOS/serenity/pull/7395
Reviewed-by: https://github.com/linusg
7 changed files with 36 additions and 129 deletions
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibJS/Runtime/Uint8ClampedArray.h>
|
||||
#include <LibJS/Runtime/TypedArray.h>
|
||||
#include <LibWeb/HTML/ImageData.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
@ -26,7 +26,7 @@ RefPtr<ImageData> ImageData::create_with_size(JS::GlobalObject& global_object, i
|
|||
|
||||
auto data_handle = JS::make_handle(data);
|
||||
|
||||
auto bitmap = Gfx::Bitmap::create_wrapper(Gfx::BitmapFormat::RGBA8888, Gfx::IntSize(width, height), 1, width * sizeof(u32), (u32*)data->data());
|
||||
auto bitmap = Gfx::Bitmap::create_wrapper(Gfx::BitmapFormat::RGBA8888, Gfx::IntSize(width, height), 1, width * sizeof(u32), data->data().data());
|
||||
if (!bitmap)
|
||||
return nullptr;
|
||||
return adopt_ref(*new ImageData(bitmap.release_nonnull(), move(data_handle)));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue