Commit Graph

1692 Commits

Author SHA1 Message Date
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
NRK 280573e6e2 imlib_load_image_frame_mem(): set nocache 2022-10-01 17:10:00 +02:00
Kim Woelders c69325d68c image: Fix potential use of uninitialized time stamps 2022-10-01 17:09:06 +02:00
Kim Woelders b15467a493 imlib2_load: Add option to enable image caching 2022-10-01 17:07:34 +02:00
Kim Woelders ed89effcf3 api: error_return adjustments
- Drop imlib_load_image_fde()
- Remove error_return from imlib_load_image_mem()

It is becoming somewhat messy having functions with and without error
returns, so drop error returns in API functions added since v1.9.1.
Use imlib_get_error() to get the error instead.
2022-09-30 06:08:29 +02:00
Kim Woelders 43c54e1345 Introduce imlib_get_error()
Some of the image loading functions have a version with an error_return,
and some not.
With imlib_get_error() it is now possible to fetch the load error for
any image loading function call.
2022-09-30 06:04:27 +02:00
Kim Woelders 51906190a1 image: Don't munmap external memory
When loading image from memory (imlib_load_image[_frame]_mem()) the
memory was unintentionally munmapped after loading.

This would cause trouble if loading multiple times from the same mmap'ed
memory, but not from malloced memory as the munmap would then just fail
silently.

old/legacy-imlib2#1
2022-09-29 13:48:46 +02:00
Kim Woelders 6151f9be2e image: Hide internal ImlibImageFileInfo struct 2022-09-29 12:41:13 +02:00
Kim Woelders 9f9779e698 test: Re-generate test images with recent tool/library versions
Converters and library versions used:
 convert                ImageMagick-6.9.12.64
 cjxl                   libjxl-0.7.0
 heif-enc               libheif-1.13.0
 opj2_compress          openjpeg2-2.5.0
 pnmtopnm,pamtoxvmini   netpbm-10.99.00
2022-09-28 18:19:07 +02:00
Kim Woelders 87bcf92524 Includes tweaks
- Drop unneeded errno.h includes.
- Include stdarg.h only where needed.
2022-09-28 18:19:07 +02:00
Kim Woelders 0c687ee837 Unify basic X11 functionality in test programs 2022-09-02 12:45:13 +02:00
Kim Woelders d30460b39b image: Fix memory leak when cloning images
Was introduced in recent infrastructure changes.
2022-08-27 18:34:15 +02:00
Kim Woelders ecf119af57 J2K loader: Drop showing deprecated item in debug message 2022-08-27 17:51:07 +02:00
Kim Woelders d03876e35e Enable disabling text functions
To optionally reduce footprint.
2022-08-26 06:33:32 +02:00
Kim Woelders 431f45fe04 api: Move text functions to separate file 2022-08-26 06:33:32 +02:00
Kim Woelders 96e95920dc Enable disabling filter functions
To optionally reduce footprint.
2022-08-26 06:33:32 +02:00
Kim Woelders 2ba6ec494f api: Move filter functions to separate file 2022-08-26 06:33:32 +02:00
Kim Woelders 1fd61bb25d api: Move X11 related functions to separate file 2022-08-26 06:33:32 +02:00
Kim Woelders 95bf3c774d Hide imlib_get/set_color_usage() if no X11
Pointless without.
2022-08-26 06:33:32 +02:00
Kim Woelders c198678bf0 api: Remove cast previously dropped everywhere else 2022-08-06 19:29:40 +02:00
NRK cd4f0c0419 Introduce imlib_load_image_frame_mem 2022-08-06 19:29:40 +02:00
Kim Woelders 06eb5ab315 imlib2_load: Add option to use imlib_load_image_mem() 2022-07-10 12:51:17 +02:00
Kim Woelders af587674a4 Introduce imlib_load_image_mem()
For loading images from memory.
2022-07-10 12:51:15 +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 3f1f87b1fb loading: Don't look for cached image when not caching 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 a0e661740d imlib2_load: Tweak load mode handling 2022-07-07 12:59:40 +02:00
Kim Woelders cea1207efe Introduce imlib_load_image_fde()
Same as imlib_load_image_fd() but with error return.
2022-07-07 12:59:40 +02:00
Kim Woelders 8dc921286c v1.9.1 2022-07-06 17:48:35 +02:00
Kim Woelders 3f1fe6222e imlib2_conv: Enable passing attached data to saver
Mostly for testing savers.
2022-07-01 19:56:37 +02:00
Kim Woelders 0a77e35f9c imlib2_conv: Drop obsolete .db stuff, simplify 2022-07-01 19:41:07 +02:00
Kim Woelders ec1ecaaaa6 imlib2_conv: Cosmetic changes
Making imlib2_conv more like other imlib2_... test programs.
2022-07-01 19:41:07 +02:00
Kim Woelders eefb189b3a imlib2_load: Remove unused macro 2022-07-01 17:14:43 +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 52511a15cc modules: Fix signdness warning 2022-06-30 08:17:44 +02:00
NRK 581de800b4 modules: check for filepath truncation
also check for (unlikely) snprintf error.
2022-06-29 18:42:26 +02:00
Kim Woelders 90824fc2fd test: Add test_misc 2022-06-24 21:33:23 +02:00
Kim Woelders c035f8d19a modules: Enable setting multiple loader/filter paths
IMLIB2_LOADER_PATH and IMLIB2_FILTER_PATH may now contain multiple colon
separated paths.
2022-06-23 07:40:18 +02:00
Kim Woelders d0372038fd modules: Cosmetics, mostly 2022-06-23 07:36:33 +02:00
Kim Woelders 416f847dc3 Introduce strsplit() 2022-06-23 07:36:23 +02:00
Kim Woelders 7ec44e68cb modules: Eliminate __imlib_TrimLoaderList()
Instead, don't put in the list what we would take out later.
2022-06-22 21:03:11 +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 3b241cff10 x11_color: Simplify and fix error paths
Freeing color on failure in __imlib_AllocColors1() was missing.

Success is 0 but using it as such here is confusing since return value 0
means failure.
2022-05-10 14:58:31 +02:00
NRK 1b8cf498e5 check for alloc failures some more 2022-05-09 15:15:10 +02:00
NRK 675b69414a check for some alloc failures 2022-05-09 14:28:14 +02:00
Kim Woelders 693d6c63ca v1.9.0 2022-04-21 10:11:38 +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