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
Notes: sideshowbarker 2024-07-18 21:18:31 +09:00

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