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
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
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
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
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
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
d98622ba67
debug: Export __imlib_time_us()
...
Forgotten.
2022-04-13 19:52:50 +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
b9496a326d
loaders: Fix typo, fix order
2022-04-08 13:49:33 +02:00
Kim Woelders
712d2b86a0
API doc updates
2022-04-07 17:40:25 +02:00
Kim Woelders
c40c222b9c
Revert a couple of unintended changes
2022-04-07 12:37:36 +02:00
Kim Woelders
1582453d76
API doc corrections and tweaks for doxygen
2022-04-07 11:33:05 +02:00
Kim Woelders
6c5620511c
Drop deprecation noise from using imlib_load/save_image_with_error_return()
2022-04-07 11:30:38 +02:00
Kim Woelders
a92585c569
Drop deprecation noise from using the old DATA types
2022-04-07 11:30:38 +02:00
Kim Woelders
c85d63d710
image: Fix undesired change of format
...
In a previous commit im->format was always set before calling a loader
in order to make it available e.g. from loader progress callbacks via
imlib_image_format().
However, setting the format with imlib_image_set_format() on a
non-immediately loaded image would be overridden when the image data
was subsequently loaded.
Also move the initial setting of im->format up front so it's also set
for legacy load()s.
2022-04-07 11:30:38 +02:00
Kim Woelders
d56be3b8df
loaders: Ensure that found loader is ok for load/save
...
Fixes a segv that could happen if trying to save an image with a not
previously loaded loader that has no saver.
Bug since v1.7.5.
2022-04-07 11:30:38 +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
Kim Woelders
2255a119d8
SVG loader: Requires librsvg-2.46
2022-04-02 02:20:30 +02:00
Kim Woelders
8ee9c0bade
debug: Enable using hex values in IMLIB2_DEBUG
2022-04-02 02:20:30 +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
ad5fac52e7
imlib2_view: Verbose and debug message tweaks
2022-03-29 13:20:33 +02:00
Kim Woelders
7bad340aca
image.c: Loading tweaks
...
- Set im->format before calling the loader
This means that imlib_image_format() now also works when called from
progress callback.
It causes a small overhead when loading fails but that path is slow
anyway.
- Drop obsolete im->w/h check on failure
2022-03-29 13:03:08 +02:00
Kim Woelders
771ff09c29
GIF loader: Use mmap'ed file access
...
Seems to be ~4% faster.
2022-03-29 06:54:55 +02:00
Kim Woelders
90fac1f53d
GZ loader: Fix uncompressor exit code
2022-03-29 06:54:55 +02:00
Kim Woelders
6dc9530ff8
image.c: Cosmetics (move function)
2022-03-29 06:54:55 +02:00
Kim Woelders
beedd6a5a3
image.c: Correct loader probe loop
...
If the "best loader" failed we might unnecessarily try some loaders when
dealing with corrupt images.
2022-03-29 06:54:55 +02:00
Kim Woelders
4892864735
imlib2_load: Show load time per load too
2022-03-29 06:54:55 +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
0fdae6aa73
Rename files with line etc. drawing functions
...
Just grouping stuff with similar functionality.
2022-03-26 15:54:40 +01:00
Kim Woelders
ff24cd39fc
imlib2_load: Tweak verbose output
2022-03-26 15:54:40 +01:00
Kim Woelders
bc9867379c
Deprecate imlib_load/save_image_with_error_return()
2022-03-21 10:11:02 +01:00
Kim Woelders
4bf622173c
Switch to imlib_load/save_image_with_errno_return()
2022-03-21 10:09:18 +01:00
Kim Woelders
4229e1d1b6
Add imlib_load/save_image_with_errno_return() and imlib_strerror()
2022-03-20 07:29:12 +01:00
Kim Woelders
093e4bf8ad
Error code rework: Use errnos/new imlib2 error codes internally
...
Working on deprerecating the Imlib_Load_Error codes in favor of regular
errnos (positive) + imlib2 ones (IMLIB_ERR_..., negative).
2022-03-20 07:21:05 +01:00
Kim Woelders
54f3e9e54d
Tweak __imlib_LoadImageData()
2022-03-19 17:26:03 +01:00
Kim Woelders
bf07b104f3
Image load: Change error code on zero file size
...
From IMLIB_LOAD_ERROR_UNKNOWN to IMLIB_LOAD_ERROR_IMAGE_READ.
Mostly to get the same error from loading a 0 byte file as any other too
short file.
2022-03-19 17:25:54 +01:00
Kim Woelders
7d53ba4e86
Refactor some image saving functions
...
Change internal interface to resemble the loader one
2022-03-19 17:05:05 +01:00
Kim Woelders
7a84d3472f
Refactor some image loading functions
2022-03-19 17:05:05 +01:00
Kim Woelders
af1018bd65
api.c: Cosmetics
...
- Change 'filename' to 'file' for consistency
- Drop some unnecessary casts
2022-03-19 16:11:05 +01:00
Kim Woelders
7b671819f6
WEBP saver: Fix return code on success
2022-03-18 20:54:50 +01:00
Kim Woelders
303ae94179
Move API documentation to header file
2022-03-18 06:02:02 +01:00
Kim Woelders
e47e1a6cf4
Remove some deprecation comments
...
The fallback font functions have been commented as deprecated for ~15
years now.
I cannot remember what the problem may or may not have been, so let's
just drop the comments.
Also, move the call to free a fallback font in imlib_free_font() to the
internals (avoiding to call deprecated functions if the font fallback
chain stuff should be deprecated for real some day).
2022-03-17 15:14:00 +01:00
Tobias Stoeckmann
5d9a589612
imlib2_load: fix typo
...
Fix typo in -n description.
2022-03-15 07:25:56 +01:00
Kim Woelders
32a1c3ae19
Merge __imlib_FindBestLoader...() functions
...
And move a few loader related function protoptypes again.
2022-03-12 14:48:32 +01:00
Kim Woelders
05f454a89d
Introduce __imlib_GetKey()
2022-03-12 13:26:08 +01:00
Kim Woelders
fa46dde05b
ID3 loader: Disable tags stuff
...
I don't understand the purpose, and it gets in the way of changes to come.
2022-03-12 13:02:18 +01:00
Kim Woelders
ddbb233591
ID3 loader: Drop inline and likely stuff
...
I think it's unlikely these contribute any measurable speedups.
2022-03-11 17:00:47 +01:00
Kim Woelders
e8e0130ce0
TIFF loader: Remove obsolete comment
2022-03-11 16:59:29 +01:00
Kim Woelders
d545dea9c6
x11_grab.c: Correct 16 and 15 bit depth grabbing
...
- Handling of odd sizes and offsets was broken
Might be a bit slower than before but should now be correct.
- Color mapping changed
Before we had
16 bit: RRRRRGGGGGGBBBBB -> aaaaaaaaRRRRR000GGGGGG00BBBBB000
15 bit: xRRRRRGGGGGBBBBB -> aaaaaaaaRRRRR000GGGGG000BBBBB000
Now we do
16 bit: RRRRRGGGGGGBBBBB -> aaaaaaaaRRRRRRRRGGGGGGGGBBBBBBBB
15 bit: xRRRRRGGGGGBBBBB -> aaaaaaaaRRRRRRRRGGGGGGGGBBBBBBBB
Probably somewhat slower than before because this mapping requires
multiply/divide instead of just shifts, but is more correct, IMO.
2022-03-07 21:46:56 +01:00
Youssef Rebahi-Gilbert
e415e0364c
fix: possible memleak in rgba save on big endian systems
2022-03-07 21:45:18 +01:00
Kim Woelders
c56b66f9c1
Mostly cosmetic tweaks around clipping checks
2022-03-07 08:20:34 +01:00