1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 00:47:45 +00:00

LibGfx/JPEGWriter: Add a named constant in add_scan_header()

No behavior change.
This commit is contained in:
Nico Weber 2024-01-31 20:32:11 -05:00 committed by Andreas Kling
parent 4a8e7f44dc
commit 38526414b0

View file

@ -486,14 +486,16 @@ ErrorOr<void> add_scan_header(Stream& stream)
// B.2.3 - Scan header syntax // B.2.3 - Scan header syntax
TRY(stream.write_value<BigEndian<Marker>>(JPEG_SOS)); TRY(stream.write_value<BigEndian<Marker>>(JPEG_SOS));
u16 const Ns = 3;
// Ls - 6 + 2 × Ns // Ls - 6 + 2 × Ns
TRY(stream.write_value<BigEndian<u16>>(6 + 2 * 3)); TRY(stream.write_value<BigEndian<u16>>(6 + 2 * Ns));
// Ns // Ns
TRY(stream.write_value<u8>(3)); TRY(stream.write_value<u8>(Ns));
// Encode 3 components // Encode Ns components
for (u8 i {}; i < 3; ++i) { for (u8 i {}; i < Ns; ++i) {
// Csj // Csj
TRY(stream.write_value<u8>(i + 1)); TRY(stream.write_value<u8>(i + 1));