From c71b9fe6f8e0f604e720420ae712799e406d59fc Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Mon, 27 May 2024 20:21:14 -0400 Subject: [PATCH] LibGfx/WebPWriter: Add a comment explaining a file offset --- Userland/Libraries/LibGfx/ImageFormats/WebPWriter.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Userland/Libraries/LibGfx/ImageFormats/WebPWriter.cpp b/Userland/Libraries/LibGfx/ImageFormats/WebPWriter.cpp index 0c81ecdd435..5d01b459197 100644 --- a/Userland/Libraries/LibGfx/ImageFormats/WebPWriter.cpp +++ b/Userland/Libraries/LibGfx/ImageFormats/WebPWriter.cpp @@ -352,6 +352,12 @@ ErrorOr WebPAnimationWriter::set_alpha_bit_in_header() m_vp8x_flags |= 0x10; auto current_offset = TRY(m_stream.tell()); + // 4 bytes for "RIFF", + // 4 bytes RIFF chunk size (i.e. file size - 8), + // 4 bytes for "WEBP", + // 4 bytes for "VP8X", + // 4 bytes for VP8X chunk size, + // followed by VP8X flags in the first byte of the VP8X chunk data. TRY(m_stream.seek(20, SeekMode::SetPosition)); TRY(m_stream.write_value(m_vp8x_flags)); TRY(m_stream.seek(current_offset, SeekMode::SetPosition));