Commit Graph

366 Commits

Author SHA1 Message Date
Kim Woelders 5c226954c1 ANI, PNG, TGA loaders: Enable handling of unaligned data
Fixes warnings seen with -fsanitize=undefined when using
--enable-packed.
2023-01-29 10:25:08 +01:00
Kim Woelders d27354926a Loaders: Avoid cast-align warnings with -Wcast-align=strict 2023-01-29 10:25:08 +01:00
Kim Woelders 6337c54d30 ANI loader: Use struct to access chunk data 2023-01-28 16:25:15 +01:00
Kim Woelders 495fb5e6f8 Loaders: Debug macro cleanups 2023-01-28 16:25:15 +01:00
Kim Woelders 00dcf6851f PNM saver: Write images with alpha as P7 PAM RGB_ALPHA type
The previously used P8 type seems to be known only by imlib2.
2023-01-22 17:20:01 +01:00
Kim Woelders c8dcabc62a PNM loader: Speedups
Eliminate copy of data to intermediary buffer.
2023-01-22 09:20:07 +01:00
Kim Woelders 207cffb207 Avoid some more undefined behaviors with shifts 2023-01-13 10:55:47 +01:00
NRK e76d9bcf9f PNM loader: avoid some undefined behavior
`ptr` is a `uint8_t` pointer, which will get promoted to an `int` due to
integer promotion. and shifting a signed int by 24 places could cause
signed overflow which is undefined.

> If E1 has a signed type and nonnegative value, and E1 x 2^E2 is
> representable in the result type, then that is the resulting value;
> otherwise, the behavior is undefined.

ref: https://port70.net/~nsz/c/c99/n1256.html#6.5.7p4
2023-01-13 10:55:47 +01:00
q3cpma 27db42330e PNM loader: add read support for PAM 2023-01-12 22:14:03 +01:00
Kim Woelders 03e4460c17 ANI loader: Multiframe suport 2022-12-14 19:33:09 +01:00
Kim Woelders 7e7eae168a ANI loader: Disable progress in embed loader 2022-12-14 19:33:09 +01:00
Kim Woelders 68a5af8cb2 Add new ani loader 2022-12-08 17:46:09 +01:00
Kim Woelders b7d4cab412 image: Cosmetics
- Remove unused function argument in __imlib_ImageFileContextPush()
- Swap function arguments in __imlib_LoadEmbedded()
2022-12-07 20:03:18 +01:00
Kim Woelders a5daa9e33c PNG loader: Simplify update callback handling 2022-11-21 18:49:19 +01:00
Kim Woelders 5a1b88547a PNG loader: Quit after loading first frame
.. in the IDAT data case too.
2022-11-21 18:49:19 +01:00
Kim Woelders ee4b02016e PNG loader: Quit scan when target fdAT is seen 2022-11-21 18:49:19 +01:00
Kim Woelders b6bf5d0520 multiframe: Allocate frame info only when needed 2022-11-15 11:54:06 +01:00
Kim Woelders e353a684c2 multiframe: Move frame info to allocated record
Avoid the overhead in ImlibImage when not doing multiframe loads.
2022-11-15 11:54:06 +01:00
Kim Woelders b1bbe1d9e8 multiframe: Centralize handling of frame update offsets 2022-11-15 11:54:06 +01:00
Kim Woelders 6df68e3e2e multiframe: Tweaks around frame number handling 2022-11-15 11:54:06 +01:00
Kim Woelders 0071544859 PS loader: Cosmetics 2022-11-15 11:54:06 +01:00
Kim Woelders 9382d8f2e4 PNG loader: Cosmetics
In multiframe loaders, use "frame" for the requested frame, and "fcount"
for frame counter.
2022-11-15 11:53:52 +01:00
Kim Woelders 37332eb35e autofoo: Use AC_USE_SYSTEM_EXTENSIONS
Defining _GNU_SOURCE is then not needed.
2022-11-11 12:05:04 +01:00
Kim Woelders 9b198f0af9 ICO loader: Eliminate ico_load()
Not really helpful.
2022-10-31 07:21:00 +01:00
Kim Woelders 61f055c4e7 SVG loader: Don't reference multiframe stuff
No multiframe handling here.
2022-10-31 07:19:43 +01:00
Kim Woelders f762a49c49 PNG loader: Fix animated PNG loading some more 2022-10-12 19:30:44 +02:00
Kim Woelders 6e2267e740 multiframe: Support loop count 2022-10-10 17:23:43 +02:00
Kim Woelders 272c737cc3 PNG loader: Improved handling of animated PNGs
Correct handling of initial image (IDAT vs fcTL order).
2022-10-10 17:23:43 +02:00
Kim Woelders 75657f0362 PNG loader: Cosmetics 2022-10-10 15:55:11 +02:00
Kim Woelders 8cdb260368 PNG loader: Correct frame delay in zero denominator case 2022-10-10 15:55:11 +02:00
NRK e9c09deb08 TGA loader: fix indexing in tgaflip
`y` needs to be multiplied by the width, not the height.

ref: https://codeberg.org/nsxiv/nsxiv/issues/378
2022-10-09 17:49:21 +02:00
Kim Woelders ecf119af57 J2K loader: Drop showing deprecated item in debug message 2022-08-27 17:51:07 +02:00
Kim Woelders 96e95920dc Enable disabling filter functions
To optionally reduce footprint.
2022-08-26 06:33:32 +02:00
Kim Woelders 753065d5a3 loading: Centralize mmap handling
Loader interface should be stable now.
2022-07-10 12:51:06 +02:00
Kim Woelders e55208f4d6 loading: Introduce __imlib_ImageFileContextPush/Pop()
Makes dealing with nested file contexts much easier.
2022-07-10 12:50:40 +02:00
Kim Woelders 5b357a815b loading: New loader infrastructure
Old loaders will no longer work.
Should be no big deal to migrate though.
2022-07-10 12:50:40 +02:00
Kim Woelders b39d33c800 image: Change has alpha flag to separate byte
It is the only flag that should be used by the loaders
2022-07-10 12:50:40 +02:00
Kim Woelders f44e52c62d Introduce Imlib2_Loader.h - all that is needed by loaders
Note! This changes breaks loader ABI due to reordering of elements in
ImlibImage.
Loader interface will be unstable until further notice.
2022-07-10 12:50:09 +02:00
Kim Woelders f756d91c31 TIFF loader: Change default save compression type
As of libtiff 4.4.0 saving an image with COMPRESSION_DEFLATE will
produce a warning:

 TIFFWriteDirectorySec: Warning, Creating TIFF with legacy Deflate codec identifier,
 COMPRESSION_ADOBE_DEFLATE is more widely supported.

So let's just use COMPRESSION_ADOBE_DEFLATE.
2022-06-30 09:38:02 +02:00
Kim Woelders 33ab86c10f JPEG loader: Use mmap'ed file access
Doesn't seem to affect speed much.
2022-05-10 16:08:44 +02:00
Kim Woelders 65cb3e33e3 SVG loader: Fix size when unit is percent some more
Non-debug case too..
2022-04-21 10:11:32 +02:00
Kim Woelders 2d31bab355 SVG loader: Fix size when unit is percent
Also consistently use lrint() instead of ceil() on FP values.
2022-04-18 20:14:09 +02:00
Kim Woelders e35b4dca6c SVG loader: Avoid some warnings in rsvg.h 2022-04-18 20:09:36 +02:00
Kim Woelders 31f0935707 JXL loader: Multiframe support
Does not work very well.
Looks like the time needed to render the N'th frame (from scratch) is
proportional to N, so reasonable performance would require the frames
to be generated sequentially while decoding the image.
2022-04-13 19:53:03 +02:00
Kim Woelders 59eae5643e Add PS/EPS loader using libspectre 2022-04-11 08:25:48 +02:00
Kim Woelders 9ebd8399d2 Add J2K (JPEG 2000) loader using openjpeg2 library 2022-04-10 12:45:23 +02:00
Kim Woelders 11806ddb74 SVG loader: Faster signature check
Faster (when failing) than letting librsvg2 do it.
2022-04-09 17:17:58 +02:00
Kim Woelders c40c222b9c Revert a couple of unintended changes 2022-04-07 12:37:36 +02:00
Kim Woelders 323a95cd4e Add jxl loader 2022-04-02 20:18:56 +02:00
Kim Woelders 63dccd46c5 TIFF loader: Use mmap'ed file access
Doesn't seem to affect speed much.
2022-04-02 02:20:30 +02:00