LibWeb/Canvas: Don't apply alpha to the image data

This fixes a bug that caused the `globalAlpha` to incorrectly be
applied when retrieving the image data bitmap.
This commit is contained in:
Glenn Skrzypczak 2025-02-23 20:27:57 +01:00 committed by Tim Ledbetter
parent 64a234c0df
commit 2ac16320c9
Notes: github-actions[bot] 2025-02-24 13:56:58 +00:00

View file

@ -431,7 +431,7 @@ WebIDL::ExceptionOr<GC::Ptr<ImageData>> CanvasRenderingContext2D::get_image_data
ASSERT(image_data->bitmap().alpha_type() == Gfx::AlphaType::Unpremultiplied);
auto painter = Gfx::Painter::create(image_data->bitmap());
painter->draw_bitmap(image_data->bitmap().rect().to_type<float>(), *snapshot, source_rect_intersected, Gfx::ScalingMode::NearestNeighbor, {}, drawing_state().global_alpha, Gfx::CompositingAndBlendingOperator::SourceOver);
painter->draw_bitmap(image_data->bitmap().rect().to_type<float>(), *snapshot, source_rect_intersected, Gfx::ScalingMode::NearestNeighbor, {}, 1, Gfx::CompositingAndBlendingOperator::SourceOver);
// 7. Set the pixels values of imageData for areas of the source rectangle that are outside of the output bitmap to transparent black.
// NOTE: No-op, already done during creation.