From d30c21786617ed4e67fdd09b9a5f4bf5224f477b Mon Sep 17 00:00:00 2001 From: Jelle Raaijmakers Date: Mon, 10 Mar 2025 13:02:55 +0100 Subject: [PATCH] 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. --- Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp b/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp index 8d59386715e..a7694b7a304 100644 --- a/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp +++ b/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp @@ -456,8 +456,8 @@ WebIDL::ExceptionOr> 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(), *snapshot, source_rect_intersected, Gfx::ScalingMode::NearestNeighbor, {}, 1, Gfx::CompositingAndBlendingOperator::SourceOver);