LibWeb: Ensure putImageData() is unaffected by drawing state

This commit is contained in:
Tim Ledbetter 2025-10-20 14:34:30 +01:00 committed by Jelle Raaijmakers
commit d3ca038b2c
Notes: github-actions[bot] 2025-10-21 07:53:34 +00:00
3 changed files with 50 additions and 1 deletions

View file

@ -600,14 +600,18 @@ WebIDL::ExceptionOr<void> CanvasRenderingContext2D::put_pixels_from_an_image_dat
// imageData data structure's bitmap, converted from imageData's colorSpace to the color space of bitmap using
// 'relative-colorimetric' rendering intent.
auto dst_rect = Gfx::FloatRect { dx + dirty_x, dy + dirty_y, dirty_width, dirty_height };
painter.save();
painter.set_transform({});
painter.draw_bitmap(
dst_rect,
Gfx::ImmutableBitmap::create(image_data.bitmap(), Gfx::AlphaType::Unpremultiplied),
Gfx::IntRect { dirty_x, dirty_y, dirty_width, dirty_height },
Gfx::ScalingMode::NearestNeighbor,
drawing_state().filter,
{},
1.0f,
Gfx::CompositingAndBlendingOperator::SourceOver);
painter.restore();
did_draw(dst_rect);
return {};