1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 06:15:07 +00:00

LibWeb: Use Gfx::Bitmap::RGBA8888 for ImageData bitmaps

This makes the colors show up correctly when using putImageData() to
draw an ImageData onto a CanvasRenderingContext2D. :^)
This commit is contained in:
Andreas Kling 2021-03-16 12:10:31 +01:00
parent fe861512c8
commit c684af1f83

View file

@ -46,7 +46,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::BGRA8888, 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), (u32*)data->data());
if (!bitmap)
return nullptr;
return adopt(*new ImageData(bitmap.release_nonnull(), move(data_handle)));