LibWeb: Change ASSERTs into VERIFYs when comparing bitmap alpha types

For non-debug builds, this is still very useful to check and doesn't
significantly impact any hot paths.
This commit is contained in:
Jelle Raaijmakers 2025-03-10 13:02:55 +01:00
parent 46f94a40a8
commit 9e3391b850

View file

@ -456,8 +456,8 @@ WebIDL::ExceptionOr<GC::Ptr<ImageData>> CanvasRenderingContext2D::get_image_data
// NOTE: Internally we must use premultiplied alpha, but ImageData should hold unpremultiplied alpha. This conversion
// might result in a loss of precision, but is according to spec.
// See: https://html.spec.whatwg.org/multipage/canvas.html#premultiplied-alpha-and-the-2d-rendering-context
ASSERT(snapshot->alpha_type() == Gfx::AlphaType::Premultiplied);
ASSERT(image_data->bitmap().alpha_type() == Gfx::AlphaType::Unpremultiplied);
VERIFY(snapshot->alpha_type() == Gfx::AlphaType::Premultiplied);
VERIFY(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, {}, 1, Gfx::CompositingAndBlendingOperator::SourceOver);