Commit graph

10 commits

Author SHA1 Message Date
Nico Weber
83ab9f7c2d LibGfx/PNM: Remove unnecessary line
This is already done at the caller decode() in
PortableImageLoaderCommon.h, as pointed out by @LucasChollet at
https://github.com/SerenityOS/serenity/pull/22935#discussion_r1467158789

No behavior change.
2024-01-26 14:53:33 +01:00
Lucas CHOLLET
f3ff9c26bc LibGfx/PortableFormat: Simplify the State enum
This enum used to store very precise state about the decoding process,
let's simplify that by only including two steps: HeaderDecoder and
BitmapDecoded.
2023-07-11 14:16:33 +01:00
Lucas CHOLLET
d00a563462 LibGfx/PortableFormat: Write directly to the bitmap
No need to copy the data first to a Vector and then to the Bitmap. We
can skip this unnecessary step.
2023-06-22 21:32:45 +02:00
Lucas CHOLLET
fcaa535dec LibGfx/PortableFormat: Use static_cast instead of C-style casts 2023-03-24 10:56:58 +01:00
Lucas CHOLLET
7ec310384a LibGfx/PortableFormat: Propagate errors from read_image_data() 2023-03-24 10:56:58 +01:00
Lucas CHOLLET
7cafd7d177 LibGfx/PortableFormat: Port to Stream
Each one of `[PBM, PGM, PPM]Loader` used yet another stream-like relic.
This patch ports all of them to `AK::Stream`.
2023-03-24 10:56:58 +01:00
Lucas CHOLLET
b9574c180e LibGfx/PortableFormat: Use finite loops in read_image_data
The `read_image_data` function of each one of[PBM, PGM, PPM]Loader use
the same structure to read an image. This patch harmonizes the three
functions and use finite loops instead of reading until EOF. It allows
to quit early on bloated file, but it's mainly done for refactoring
purpose.
2023-03-24 10:56:58 +01:00
Lucas CHOLLET
bab2113ec1 LibGfx/PortableFormat: Make read_whitespace return an ErrorOr 2023-03-24 10:56:58 +01:00
Lucas CHOLLET
9052a6febf LibGfx/PortableFormat: Simplify read_number signature
The function signature goes from:
`bool read_number(Streamer& streamer, TValue* value)`
to
`ErrorOr<u16> read_number(Streamer& streamer)`

It allows us to, on one hand use `ErrorOr` for error propagation,
removing an out parameter in the meantime, and on the other hand remove
the useless template.
2023-03-24 10:56:58 +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/PPMLoader.cpp (Browse further)