summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNico Weber <thakis@chromium.org>2023-05-07 21:18:30 -0400
committerAndreas Kling <kling@serenityos.org>2023-05-09 06:35:56 +0200
commite13c319972b0deaa615b751ec64a895bbd13561f (patch)
tree1be5485382bd3de81bf43614b84abd886fd3d5f1
parent1ec5c8395c2cd6ee88eae5abf0035df6caee9328 (diff)
downloadserenity-e13c319972b0deaa615b751ec64a895bbd13561f.zip
LibGfx/WebP: Remove pointless decode_webp_chunk_VP8L() function
The one caller checked the chunk type, so the VERIFY() for that did nothing. The VERIFY() for vp8l data only being in files that start with VP8L or VP8X chunks wasn't completely useless, but also not very useful. Remove the now-unused context parameter of decode_webp_image_data().
-rw-r--r--Userland/Libraries/LibGfx/ImageFormats/WebPLoader.cpp17
1 files changed, 5 insertions, 12 deletions
diff --git a/Userland/Libraries/LibGfx/ImageFormats/WebPLoader.cpp b/Userland/Libraries/LibGfx/ImageFormats/WebPLoader.cpp
index 431873af20..9e01397601 100644
--- a/Userland/Libraries/LibGfx/ImageFormats/WebPLoader.cpp
+++ b/Userland/Libraries/LibGfx/ImageFormats/WebPLoader.cpp
@@ -299,14 +299,6 @@ static ErrorOr<NonnullRefPtr<Bitmap>> decode_webp_chunk_VP8(Chunk const& vp8_chu
#endif
}
-static ErrorOr<NonnullRefPtr<Bitmap>> decode_webp_chunk_VP8L(WebPLoadingContext const& context, Chunk const& vp8l_chunk)
-{
- VERIFY(context.first_chunk->type == FourCC("VP8L") || context.first_chunk->type == FourCC("VP8X"));
- VERIFY(vp8l_chunk.type == FourCC("VP8L"));
- auto vp8l_header = TRY(decode_webp_chunk_VP8L_header(vp8l_chunk.data));
- return decode_webp_chunk_VP8L_contents(vp8l_header);
-}
-
// https://developers.google.com/speed/webp/docs/riff_container#alpha
static ErrorOr<void> decode_webp_chunk_ALPH(Chunk const& alph_chunk, Bitmap& bitmap)
{
@@ -640,11 +632,12 @@ static ErrorOr<ImageData> decode_webp_animation_frame_image_data(ANMFChunk const
return decode_webp_set_image_data(move(alpha), move(image_data));
}
-static ErrorOr<NonnullRefPtr<Bitmap>> decode_webp_image_data(WebPLoadingContext const& context, ImageData const& image_data)
+static ErrorOr<NonnullRefPtr<Bitmap>> decode_webp_image_data(ImageData const& image_data)
{
if (image_data.image_data_chunk.type == FourCC("VP8L")) {
VERIFY(!image_data.alpha_chunk.has_value());
- return decode_webp_chunk_VP8L(context, image_data.image_data_chunk);
+ auto vp8l_header = TRY(decode_webp_chunk_VP8L_header(image_data.image_data_chunk.data));
+ return decode_webp_chunk_VP8L_contents(vp8l_header);
}
VERIFY(image_data.image_data_chunk.type == FourCC("VP8 "));
@@ -693,7 +686,7 @@ static ErrorOr<ImageFrameDescriptor> decode_webp_animation_frame(WebPLoadingCont
}
auto frame_image_data = TRY(decode_webp_animation_frame_image_data(frame_description));
- auto frame_bitmap = TRY(decode_webp_image_data(context, frame_image_data));
+ auto frame_bitmap = TRY(decode_webp_image_data(frame_image_data));
if (static_cast<u32>(frame_bitmap->width()) != frame_description.frame_width || static_cast<u32>(frame_bitmap->height()) != frame_description.frame_height)
return Error::from_string_literal("WebPImageDecoderPlugin: decoded frame bitmap size doesn't match frame description size");
@@ -835,7 +828,7 @@ ErrorOr<ImageFrameDescriptor> WebPImageDecoderPlugin::frame(size_t index)
}
if (m_context->state < WebPLoadingContext::State::BitmapDecoded) {
- auto bitmap = TRY(decode_webp_image_data(*m_context, m_context->image_data.value()));
+ auto bitmap = TRY(decode_webp_image_data(m_context->image_data.value()));
// Check that size in VP8X chunk matches dimensions in VP8 or VP8L chunk if both are present.
if (m_context->first_chunk->type == FourCC("VP8X")) {