Nico Weber
000d9da73c
LibGfx: Allow passing FilterType::None to unfilter_scanline()
...
Makes calling this in LibPDF less awkward, and there's no reason
not to allow this.
2023-11-17 19:09:50 +01:00
Nico Weber
574357ef00
LibGfx: Use ceil_div() in png decoder
...
No behavior change, arguably easier to read.
2023-11-17 19:09:50 +01:00
Nico Weber
5a70813d11
LibGfx: Make unfilter_scanline() a static PNGImageDecoderPlugin method
...
That way, LibPDF will be able to call it.
No behavior change.
2023-11-17 19:09:50 +01:00
Nico Weber
588d6fab22
LibGfx+LibPDF: Create filter_type() for converting u8 to FilterType
...
...and use it in LibPDF.
No behavior change.
2023-11-17 19:09:50 +01:00
Nico Weber
6b2c60404d
LibGfx: Use PNG::paeth_predictor() in png decoding path
...
Increases code reuse between encoder and decoder a tiny bit.
No behavior change.
(We should use the vectorized version in the future! But first,
we should learn to do the prediction in-place.)
2023-11-17 19:09:50 +01:00
Tim Ledbetter
4cc2fc4afa
LibGfx/PNGLoader: Remove redundant IHDR bit depth validation
2023-10-08 10:46:00 +02:00
Tim Ledbetter
bc6ae54b59
LibGfx/PNGLoader: Don't allow multiple consecutive IHDR chunks
2023-10-08 10:46:00 +02:00
Tim Ledbetter
b64ed060d8
LibGfx/PNGLoader: Add validation for IHDR width, height and bit depth
2023-10-06 08:21:58 +02:00
MacDue
bbf66ea055
LibGfx: Remove maximum size limit for decoded images
...
It is unlikely this is needed anymore, and as pointed out things should
now safely return OOM if the bitmap is too large to allocate.
Also, no recently added decoders respected this limit anyway.
Fixes #20872
2023-09-03 14:36:54 +02:00
Tim Schumacher
8a853278d0
LibCompress: Port ZlibDecompressor
to AK::Stream
2023-08-23 12:03:37 +01:00
Lucas CHOLLET
5d94bb4fcc
LibGfx/PNG: Remove the useless HeaderDecoded
state
2023-07-17 06:49:03 +01:00
Lucas CHOLLET
a173275afa
LibGfx/PNG: Reject files that doesn't start with a IHDr chunk
2023-07-17 06:49:03 +01:00
Lucas CHOLLET
8d907b6535
LibGfx/PNG: Don't use a loop to read chunks in decode_png_ihdr()
...
This chunk is the first one, so we can remove that loop.
2023-07-17 06:49:03 +01:00
Lucas CHOLLET
ff6d82c3e7
LibGfx/PNG: Decode the header in create()
and remove initialize()
...
This is done as a part of #19893 . As `create()` is now the last user of
`decode_png_ihdr()`, we can easily make it return an `ErrorOr`.
2023-07-17 06:49:03 +01:00
Lucas CHOLLET
07f72b6d41
LibGfx/PNG: Don't try to guess if IHDR has been decoded
2023-07-17 06:49:03 +01:00
Lucas CHOLLET
07d3232f2d
LibGfx/PNG: Use PNG specific vocabulary over a generic name
2023-07-17 06:49:03 +01:00
Nico Weber
f7f9f1f47f
LibGfx/PNG: Make invalid sRGB chunk size non-fatal
...
https://www.haiku-os.org/images/bg-page.png has a size of 0 for
example.
Just ignoring the chunk instead of assuming that the image is sRGB
and has Perceptual rendering intent matches what libpng does
(cf `png_handle_sRGB()`), so let's do that too.
(All other chunk handlers are still strict about size.)
2023-07-11 15:07:42 +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
Lucas CHOLLET
36153136c4
LibGfx/PNG: Use ByteBuffer
instead of Vector<u8>
2023-06-12 06:41:16 +02:00
Lucas CHOLLET
15df0224e1
LibGfx/PNG: Remove an unused field in PNGLoadingContext
2023-06-12 06:41:16 +02:00
Lucas CHOLLET
07b6c2ebfc
LibGfx/PNG: Make chunk-related functions fallible
2023-06-12 06:41:16 +02:00
Lucas CHOLLET
96a1a8512f
LibGfx/PNG: Use a StringView
to compare the chunk type
2023-06-12 06:41:16 +02:00
Karol Kosek
970a3ef4d8
LibGfx: Fix partial loading of tall and interlaced PNG files
...
The function stopped copying data from a subimage when the _y_ value
exceeded the image _width_ value, resulting in an incomplete image.
2023-06-06 19:55: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
Tom
f0f82c6391
LibGfx/PNG: Add support for animated PNG images
2023-05-05 15:20:44 +01: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