Commit Graph

413 Commits

Author SHA1 Message Date
Kim Woelders d27354926a Loaders: Avoid cast-align warnings with -Wcast-align=strict 2023-01-29 10:25:08 +01:00
Kim Woelders 495fb5e6f8 Loaders: Debug macro cleanups 2023-01-28 16:25:15 +01:00
Kim Woelders 8c6c40097e x11_rgba: Avoid cast-align warnings with -Wcast-align=strict
Just silencing the warnings, assuming things are properly aligned.
2023-01-28 16:16:17 +01:00
Kim Woelders 09bb1a1c4c x11_grab: Avoid cast-align warnings with -Wcast-align=strict
Just silencing the warnings, assuming things are properly aligned.
2023-01-28 16:16:17 +01:00
Kim Woelders a910b58242 x11_rgba: Add missing const
Also add missing header.
2023-01-28 16:16:17 +01:00
Kim Woelders 930243411e api: Remember error on deferred image data loads
Now it can be fetched with imlib_get_error().
2023-01-14 10:47:12 +01:00
Kim Woelders a856571312 Drop some redundant calls to __imlib_LoadImageData() 2023-01-14 10:47:12 +01:00
Kim Woelders 5d1083858c image: Let __imlib_CreateImage() allocate pixel data buffer
..and check dimensions.

Does simplify things nicely.
2023-01-14 08:59:32 +01:00
Kim Woelders 5d16eb8bb8 api: Tweak/correct error handling in drawable grabbing functions
imlib_create_scaled_image_from_drawable() now returns NULL if the
drawable could not be grabbed, just as imlib_create_image_from_drawable()
has always done.
2023-01-14 08:59:32 +01:00
Kim Woelders dafd7eb33d api: Change some parameter names
- Shorten some names - mostly to avoid some line wrapping
  source_...      -> src_...
  destination_... -> dst_...

- Change some parameter names for consistency/clarity
  Change (x, y, width, height) to (src_x, src_y, src_width, src_height)
  or (dst_x, dst_y, dst_width, dst_height) a couple of places.
2023-01-14 08:59:17 +01:00
Kim Woelders a4e240bc96 api: Fix code duplication around some __imlib_BlendImageToImage() calls 2023-01-13 16:19:02 +01:00
Kim Woelders 207cffb207 Avoid some more undefined behaviors with shifts 2023-01-13 10:55:47 +01:00
Kim Woelders 19028a4ca3 image: Cosmetics (slightly more consisent naming) 2022-12-08 19:03:41 +01:00
Kim Woelders 68a5af8cb2 Add new ani loader 2022-12-08 17:46:09 +01:00
Kim Woelders 108af6d186 image: Introduce __imlib_LoadEmbeddedMem() 2022-12-07 20:03:18 +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 2d2f8899ec multiframe: Remove frame offset from updates
The frame offsets were recently removed from the loader update callbacks
and added in the infrastructure before calling the user update function.
Now drop the frame offsets so that the update coordinates are relative
to the frame, not the canvas.
Should make things simpler in the end.
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 6e2267e740 multiframe: Support loop count 2022-10-10 17:23:43 +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 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 87bcf92524 Includes tweaks
- Drop unneeded errno.h includes.
- Include stdarg.h only where needed.
2022-09-28 18:19:07 +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 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 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 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 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 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