From 6713ed483b32e6550128546c36ac82d570c74d98 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Mon, 15 Jan 2024 15:19:00 -0500 Subject: [PATCH] LibGfx/PNG: Spec comment for PNGImageDecoderPlugin::unfilter_scanline() Every time I read this, I'm like "wait, this does the wrong thing for images with bpp != 8". It doesn't, though. --- Userland/Libraries/LibGfx/ImageFormats/PNGLoader.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Userland/Libraries/LibGfx/ImageFormats/PNGLoader.cpp b/Userland/Libraries/LibGfx/ImageFormats/PNGLoader.cpp index 653dfe7c7e..cb40ceaba8 100644 --- a/Userland/Libraries/LibGfx/ImageFormats/PNGLoader.cpp +++ b/Userland/Libraries/LibGfx/ImageFormats/PNGLoader.cpp @@ -291,6 +291,8 @@ static_assert(AssertSize()); void PNGImageDecoderPlugin::unfilter_scanline(PNG::FilterType filter, Bytes scanline_data, ReadonlyBytes previous_scanlines_data, u8 bytes_per_complete_pixel) { + // https://www.w3.org/TR/png-3/#9Filter-types + // "Filters are applied to bytes, not to pixels, regardless of the bit depth or colour type of the image." switch (filter) { case PNG::FilterType::None: break;