diff --git a/Userland/Libraries/LibGfx/JPEGLoader.cpp b/Userland/Libraries/LibGfx/JPEGLoader.cpp index c6557d0cd6..5fab0ca8ba 100644 --- a/Userland/Libraries/LibGfx/JPEGLoader.cpp +++ b/Userland/Libraries/LibGfx/JPEGLoader.cpp @@ -363,6 +363,31 @@ static ErrorOr build_macroblocks(JPEGLoadingContext& context, Vector decode_huffman_stream(JPEGLoadingContext& context, Vector& macroblocks) { if constexpr (JPEG_DEBUG) { @@ -385,9 +410,7 @@ static ErrorOr decode_huffman_stream(JPEGLoadingContext& context, Vector 0) { if (i != 0 && i % (context.dc_restart_interval * context.vsample_factor * context.hsample_factor) == 0) { - context.previous_dc_values[0] = 0; - context.previous_dc_values[1] = 0; - context.previous_dc_values[2] = 0; + reset_decoder(context); // Restart markers are stored in byte boundaries. Advance the huffman stream cursor to // the 0th bit of the next byte.