summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNico Weber <thakis@chromium.org>2023-05-07 11:03:55 -0400
committerAndreas Kling <kling@serenityos.org>2023-05-08 12:52:05 +0200
commit2f1f62cb3b1f62cf108dd3b4bce33cd8349adfcd (patch)
tree380b73f01a8894cc60d6a3d6ba88cdc484f36afe
parent3f4de06fc2f0fbb52e0198bf786b1b0d5d3bd774 (diff)
downloadserenity-2f1f62cb3b1f62cf108dd3b4bce33cd8349adfcd.zip
LibGfx/WebP: Stop passing context to decode_webp_chunk_VP8L_header()
It was used only for context.error(), and the calling code needs to be changed to deal normal Errors anyways, since CanonicalCode can produce them.
-rw-r--r--Userland/Libraries/LibGfx/ImageFormats/WebPLoader.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/Userland/Libraries/LibGfx/ImageFormats/WebPLoader.cpp b/Userland/Libraries/LibGfx/ImageFormats/WebPLoader.cpp
index 6eb06b71cd..03915e072e 100644
--- a/Userland/Libraries/LibGfx/ImageFormats/WebPLoader.cpp
+++ b/Userland/Libraries/LibGfx/ImageFormats/WebPLoader.cpp
@@ -317,20 +317,20 @@ static ErrorOr<NonnullRefPtr<Bitmap>> decode_webp_chunk_VP8(WebPLoadingContext&
// https://developers.google.com/speed/webp/docs/riff_container#simple_file_format_lossless
// https://developers.google.com/speed/webp/docs/webp_lossless_bitstream_specification#7_overall_structure_of_the_format
-static ErrorOr<VP8LHeader> decode_webp_chunk_VP8L_header(WebPLoadingContext& context, Chunk const& vp8l_chunk)
+static ErrorOr<VP8LHeader> decode_webp_chunk_VP8L_header(Chunk const& vp8l_chunk)
{
VERIFY(vp8l_chunk.type == FourCC("VP8L"));
// https://developers.google.com/speed/webp/docs/webp_lossless_bitstream_specification#3_riff_header
if (vp8l_chunk.data.size() < 5)
- return context.error("WebPImageDecoderPlugin: VP8L chunk too small");
+ return Error::from_string_literal("WebPImageDecoderPlugin: VP8L chunk too small");
FixedMemoryStream memory_stream { vp8l_chunk.data.trim(5) };
LittleEndianInputBitStream bit_stream { MaybeOwned<Stream>(memory_stream) };
u8 signature = TRY(bit_stream.read_bits(8));
if (signature != 0x2f)
- return context.error("WebPImageDecoderPlugin: VP8L chunk invalid signature");
+ return Error::from_string_literal("WebPImageDecoderPlugin: VP8L chunk invalid signature");
// 14 bits width-1, 14 bits height-1, 1 bit alpha hint, 3 bit version_number.
u16 width = TRY(bit_stream.read_bits(14)) + 1;
@@ -344,7 +344,7 @@ static ErrorOr<VP8LHeader> decode_webp_chunk_VP8L_header(WebPLoadingContext& con
// "The version_number is a 3 bit code that must be set to 0. Any other value should be treated as an error. [AMENDED]"
if (version_number != 0)
- return context.error("WebPImageDecoderPlugin: VP8L chunk invalid version_number");
+ return Error::from_string_literal("WebPImageDecoderPlugin: VP8L chunk invalid version_number");
return VP8LHeader { width, height, is_alpha_used };
}
@@ -1237,7 +1237,7 @@ static ErrorOr<NonnullRefPtr<Bitmap>> decode_webp_chunk_VP8L(WebPLoadingContext&
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(context, vp8l_chunk));
+ auto vp8l_header = TRY(decode_webp_chunk_VP8L_header(vp8l_chunk));
ReadonlyBytes lossless_data = vp8l_chunk.data.slice(5);
return decode_webp_chunk_VP8L_contents(context, vp8l_header, lossless_data);
}
@@ -1573,7 +1573,7 @@ static ErrorOr<void> decode_webp_first_chunk(WebPLoadingContext& context)
return {};
}
if (context.first_chunk->type == FourCC("VP8L")) {
- context.vp8l_header = TRY(decode_webp_chunk_VP8L_header(context, context.first_chunk.value()));
+ context.vp8l_header = TRY(decode_webp_chunk_VP8L_header(context.first_chunk.value()));
context.size = IntSize { context.vp8l_header.width, context.vp8l_header.height };
context.state = WebPLoadingContext::State::FirstChunkDecoded;
return {};