Commit Graph

16 Commits

Author SHA1 Message Date
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 3aeceb6a7b Loaders: Remove unnecessary calls to __imlib_FreeData()
__imlib_LoadImageWrapper() does it when required so no need for
doing it in every loader.
2022-03-31 21:49:56 +02:00
Kim Woelders 51f683c0c6 Loaders: Some trivial cosmetics 2022-03-31 20:47:36 +02:00
Kim Woelders 18d0befc57 Use stdint types instead of DATA32 etc.
This should make things slightly more consistent and unambiguous, and
the stdint types are already used here and there (in loaders).

I'm not aware of any systems where this change makes any difference.
If there are targets out there with 64 bit ints imlib2 might now work
there and on targets with 16 bit ints it most likely still doesn't.
2022-03-26 15:54:40 +01:00
Kim Woelders 3459740001 Loader includes tweaks 2022-03-06 18:42:28 +01:00
Kim Woelders 188cad2329 JPEG, XBM loaders: Drop pointless clearing of flag
im->flags F_HAS_ALPHA should always be clear at this point.
In any case it should not be the responsibility of the loader to clear it.
2022-02-27 08:32:47 +01:00
Kim Woelders fb4fb24e44 Refactor image flags stuff
For improved grepability.
2022-02-26 09:09:25 +01:00
Kim Woelders 04b8c35e17 XBM loader: Correct load2() result when no header is found
Also require that the header is found within the first 30 lines in the
file.
Otherwise we may waste some time parsing large C files.
2022-01-07 21:17:50 +01:00
Kim Woelders bf93574b8b Introduce more loader return codes
Used to avoid potentially wasting time trying to load corrupt images
by trying loaders which won't recognize the image anyway.
2021-12-28 16:08:06 +01:00
Kim Woelders 59561dcb1b Introduce ARRAY_SIZE() 2021-11-05 17:22:01 +01:00
Kim Woelders d812457afe XBM loader: Ignore comments and other stuff in header
Add naive signature check to avoid trivial cases where we might
otherwise scan through large non-xbm file.
2021-10-22 19:27:47 +02:00
Kim Woelders 868f2434f1 XBM loader: Use mmap() for loading 2021-10-22 19:27:47 +02:00
Kim Woelders 9caccf41f6 XBM loader: Cosmetics 2021-10-22 19:27:47 +02:00
Kim Woelders 3e1783b846 XBM loader: Fix potential buffer overrun 2021-10-22 19:27:47 +02:00
Kim Woelders e47e32a247 debug: Infrastructure
Add some debug infrastructure.
Disabled by default, enable with --enable-debug.
When enabled, the environment variable IMLIB2_DEBUG controls the amount
of debug output.
2021-10-22 19:24:15 +02:00
Kim Woelders b215368196 Add XBM loader 2020-12-18 07:18:29 +01:00