From 6a129c25353062da19833d6da26015f7e4b4678e Mon Sep 17 00:00:00 2001 From: Glenn Skrzypczak Date: Sun, 23 Feb 2025 20:27:57 +0100 Subject: [PATCH] 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. --- Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp b/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp index 97106370c3c3..e76cc69aeaff 100644 --- a/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp +++ b/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp @@ -431,7 +431,7 @@ WebIDL::ExceptionOr> 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(), *snapshot, source_rect_intersected, Gfx::ScalingMode::NearestNeighbor, {}, drawing_state().global_alpha, Gfx::CompositingAndBlendingOperator::SourceOver); + painter->draw_bitmap(image_data->bitmap().rect().to_type(), *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.