summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNico Weber <thakis@chromium.org>2023-05-07 11:20:00 -0400
committerAndreas Kling <kling@serenityos.org>2023-05-08 12:52:05 +0200
commit5252f1cd60f406bc78a1d2c6dc899226e1166646 (patch)
tree9e53e6688e1d1a9252b96ed08b59908245faab1d
parent135b029250eeee414a9d237f0d7d4170d0fc1397 (diff)
downloadserenity-5252f1cd60f406bc78a1d2c6dc899226e1166646.zip
LibGfx/WebP: Stop storing vp8_header and vp8l_header in context
They're not needed on the context.
-rw-r--r--Userland/Libraries/LibGfx/ImageFormats/WebPLoader.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/Userland/Libraries/LibGfx/ImageFormats/WebPLoader.cpp b/Userland/Libraries/LibGfx/ImageFormats/WebPLoader.cpp
index 371317e03e..7d7ca4a01d 100644
--- a/Userland/Libraries/LibGfx/ImageFormats/WebPLoader.cpp
+++ b/Userland/Libraries/LibGfx/ImageFormats/WebPLoader.cpp
@@ -143,11 +143,9 @@ struct WebPLoadingContext {
// Either 'VP8 ' (simple lossy file), 'VP8L' (simple lossless file), or 'VP8X' (extended file).
Optional<Chunk> first_chunk;
- union {
- VP8Header vp8_header;
- VP8LHeader vp8l_header;
- VP8XHeader vp8x_header;
- };
+
+ // Only valid if first_chunk->type == 'VP8X'.
+ VP8XHeader vp8x_header;
// If first_chunk is not a VP8X chunk, then only image_data.image_data_chunk is set and all the other Chunks are not set.
ImageData image_data;
@@ -1567,14 +1565,14 @@ static ErrorOr<void> decode_webp_first_chunk(WebPLoadingContext& context)
TRY(read_webp_first_chunk(context));
if (context.first_chunk->type == FourCC("VP8 ")) {
- context.vp8_header = TRY(decode_webp_chunk_VP8_header(context, context.first_chunk.value()));
- context.size = IntSize { context.vp8_header.width, context.vp8_header.height };
+ auto vp8_header = TRY(decode_webp_chunk_VP8_header(context, context.first_chunk.value()));
+ context.size = IntSize { vp8_header.width, vp8_header.height };
context.state = WebPLoadingContext::State::FirstChunkDecoded;
return {};
}
if (context.first_chunk->type == FourCC("VP8L")) {
- context.vp8l_header = TRY(decode_webp_chunk_VP8L_header(context.first_chunk.value()));
- context.size = IntSize { context.vp8l_header.width, context.vp8l_header.height };
+ auto vp8l_header = TRY(decode_webp_chunk_VP8L_header(context.first_chunk.value()));
+ context.size = IntSize { vp8l_header.width, vp8l_header.height };
context.state = WebPLoadingContext::State::FirstChunkDecoded;
return {};
}