From 000d9da73cf0ebd6ed3e78eef32ce96bc2888633 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Thu, 16 Nov 2023 20:07:27 -0500 Subject: [PATCH] LibGfx: Allow passing FilterType::None to unfilter_scanline() Makes calling this in LibPDF less awkward, and there's no reason not to allow this. --- Userland/Libraries/LibGfx/ImageFormats/PNGLoader.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Userland/Libraries/LibGfx/ImageFormats/PNGLoader.cpp b/Userland/Libraries/LibGfx/ImageFormats/PNGLoader.cpp index 27b6915745..653dfe7c7e 100644 --- a/Userland/Libraries/LibGfx/ImageFormats/PNGLoader.cpp +++ b/Userland/Libraries/LibGfx/ImageFormats/PNGLoader.cpp @@ -291,9 +291,9 @@ static_assert(AssertSize()); void PNGImageDecoderPlugin::unfilter_scanline(PNG::FilterType filter, Bytes scanline_data, ReadonlyBytes previous_scanlines_data, u8 bytes_per_complete_pixel) { - VERIFY(filter != PNG::FilterType::None); - switch (filter) { + case PNG::FilterType::None: + break; case PNG::FilterType::Sub: // This loop starts at bytes_per_complete_pixel because all bytes before that are // guaranteed to have no valid byte at index (i - bytes_per_complete pixel). @@ -327,8 +327,6 @@ void PNGImageDecoderPlugin::unfilter_scanline(PNG::FilterType filter, Bytes scan scanline_data[i] += PNG::paeth_predictor(left, above, upper_left); } break; - default: - VERIFY_NOT_REACHED(); } }