1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 05:08:13 +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:
Ali Mohammad Pur 2021-05-22 23:33:26 +04:30 committed by Ali Mohammad Pur
parent ba5da79617
commit 6af596d9e8
7 changed files with 36 additions and 129 deletions

View file

@ -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)));