Commit graph

7 commits

Author SHA1 Message Date
Lucas CHOLLET
4adef05e6d LibGfx/WebP: Decode the first chunk in create()
And remove `initialize()`.

This is done as a part of #19893.
2023-07-15 09:34:07 +02:00
Lucas CHOLLET
e5b70837de LibGfx: Remove ImageDecoder::set_[non]volatile()
These methods are unused so let's remove them.
2023-07-08 01:45:46 +01:00
MacDue
e7cddda7e1 LibGfx: Allow passing an ideal size to image decoders
The ideal size is the size the user will display the image. Raster
formats should ignore this parameter, but vector formats can use
it to generate a bitmap of the ideal size.
2023-07-03 23:54:51 +02:00
Ben Wiederhake
da394abe04 LibGfx+Fuzz: Convert ImageDecoder::initialize to ErrorOr
This prevents callers from accidentally discarding the result of
initialize(), which was the root cause of this OSS Fuzz bug:

https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=55896&q=label%3AProj-serenity&sort=summary
2023-05-12 09:40:24 +01:00
Nico Weber
ddc2cc886b LibGfx/WebP: Redo error handling
Most places used to call `context.error()` to report an error,
which would set the context's state to `Error` and then return an
`Error::from_string_literal()`.

This is somewhat elegant, but it doesn't work: Some functions this
code calls returns ErrorOr<>s that aren't created by `context.error()`,
and for these we wouldn't enter the error state.

Instead, manually check error-ness at the leaf entry functions of the
class:

1. Add a set_error() helper for functions returning bool
2. In the two functions returning ErrorOr<>, awkwardly check the error
   manually.  If this becomes a very common pattern, maybe we can add
   a `TRY_WITH_HANDLER(expr, error_lambda)` which would invoke a
   lambda on error. We could use that here to set the error code.

No real behavior change (except we enter the error state more often
when something goes wrong).
2023-05-09 06:35:56 +02:00
Tom
e7921cfe14 LibGfx: Add first_animated_frame_index method to ImageDecoder
Some image formats such as APNG may not use the first frame for
animations.
2023-05-05 15:20:44 +01:00
Lucas CHOLLET
496b7ffb2b LibGfx: Move all image loaders and writers to a subdirectory 2023-03-21 22:39:25 +01:00
Renamed from Userland/Libraries/LibGfx/WebPLoader.h (Browse further)