Skip to content

Commit

Permalink
LibWeb/Canvas: Don't apply alpha to the image data
Browse files Browse the repository at this point in the history
This fixes a bug that caused the `globalAlpha` to incorrectly be
applied when retrieving the image data bitmap.
  • Loading branch information
skyz1 committed Feb 23, 2025
1 parent 597f09e commit 6a129c2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 6a129c2

Please sign in to comment.