Commit Graph

1203 Commits

Author SHA1 Message Date
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
Kim Woelders 30b4cbb009 Only have one CLIP macro
CLIP_RECT_TO_RECT was effectively identical.
CLIP_TO would clamp w and h to 0, but w/h are always checked anyway.
2022-03-07 08:20:31 +01:00
Kim Woelders ef2177df8e grad.c: Refactor __imlib_DrawGradient() and __imlib_DrawHsvaGradient() 2022-03-07 08:20:31 +01:00
Kim Woelders 4529fcf678 Remove some unnecessary headers 2022-03-07 08:02:04 +01:00
Kim Woelders 97b3aa9b9b Introduce types.h
Avoiding more conveluted header file inclusion order issues.
2022-03-07 08:01:37 +01:00
Kim Woelders 2dd4c665d0 Move x_VAL() macros to common.h 2022-03-07 08:01:37 +01:00
Kim Woelders 46dc96436a Remove system includes from common.h
Avoiding obscure include order problems.
2022-03-07 08:01:19 +01:00
Kim Woelders 2ec3e5062f debug.c/h: Move __EXPORT__ to .c file 2022-03-07 08:01:06 +01:00
Kim Woelders 8fd9c4ea89 common.h: Drop round() macro
Use the function defined in math.h.
The macro could conflict with stuff in math.h (depending on header file
order).
2022-03-06 20:43:20 +01:00
Kim Woelders c7bd5641e3 Move some loader related function prototypes to loaders.h 2022-03-06 18:42:28 +01:00
Kim Woelders 3459740001 Loader includes tweaks 2022-03-06 18:42:28 +01:00
Kim Woelders 9d5e8dffe1 x11_...: Introduce palette type enum
... avoiding magic numbers.

Also eliminate unnecessary global _pal_type variables.
2022-03-06 18:04:21 +01:00
Kim Woelders 238bfdfa21 x11_color.c: Make most __imlib_AllocColors*() functions static 2022-03-06 18:04:17 +01:00
Kim Woelders 3debc9d46d x11_rgba.c: Add some missing static qualifiers 2022-03-06 18:03:58 +01:00
Kim Woelders f0acaee282 Merge x11_draw.c/h into x11_pixmap.c/h
Closely related, might as well combine.
2022-03-06 18:03:01 +01:00
Kim Woelders ac1d4b0520 Deal consistently with including Imlib2.h
- Always include config.h before Imlib2.h
  Needed for X_DISPLAY_MISSING.
- Always include config.h and Imlib2.h first
  Should make it more likely to spot stuff missing but required
  in Imlib2.h, like stddef.h.
  gtest.h apparently must be included before X headers though.
- Make sure we use the Imlib2.h here and not the one in /usr/include

Also ensure that the tests build when building without X.
2022-03-03 07:35:39 +01:00
Tobias Stoeckmann b70777f38a imlib2: allow compilation without x headers
Although configure can be called to ignore x headers, eventually the
compilation of api_obsolete.c fails because the configuration results
in config.h are not evaluated.

For successful compilation with `./configure --without-x` and adding
config.h I also needed stddef.h, which is added as well.
2022-03-03 07:21:04 +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 b8e8fd5f20 Remove some unused image flags and deprecate functions referencing them
imlib_image_set_irrelevant_border() and imlib_image_set_irrelevant_alpha()
have never done anything useful.
2022-02-26 09:14:17 +01:00
Kim Woelders fb4fb24e44 Refactor image flags stuff
For improved grepability.
2022-02-26 09:09:25 +01:00
Kim Woelders ea19ed87c8 XPM loader: Reduce signature window size some more
Now back (approximately) to the size before the mmap refactoring in
88231b52, included in release 1.7.5.
2022-02-24 19:37:51 +01:00
NRK ac59f89870 XPM Loader: limit signature check to first 4KiB
this prevents the loader from spending unreasonable amount of time going
through the entire file in case someone opens a directory which might
contain large videos or files.
2022-02-24 19:37:51 +01:00
Matthias Grosser 37e8c95788 imlib2: saving progressive JPEG 2022-02-18 13:25:48 +01:00
Kim Woelders 346449a6b2 PNM, XPM loaders: Fix trouble with non-ascii characters
The loaders would quit if e.g. a comment contains a non-ascii character
(byte with MSB set).
2022-02-12 17:25:23 +01:00
Kim Woelders abc16b8c2c Add imlib_version() 2022-02-06 13:07:47 +01:00
Kim Woelders b27b625f25 HEIF loader: Header cleanups
sys/stat.h is unused.
stdio.h is more or less per convention included via loader_common.h ->
common.h.
2022-02-04 14:08:11 +01:00
Kim Woelders 2b6a2d7640 TGA loader: Make function order same as in other loaders 2022-02-04 14:02:47 +01:00
Kim Woelders 6d4c4de75a Fix gcc12 warning in __imlib_stripwhitespace()
Warning seems to be incorrect though..

In function ‘__imlib_stripwhitespace’,
    inlined from ‘__imlib_script_parse’ at ../../../../src/lib/script.c:256:21:
../../../../src/lib/script.c:53:4: error: pointer may be used after ‘free’ [-Werror=use-after-free]
   53 |    strcpy(str, tmpstr);
      |    ^~~~~~~~~~~~~~~~~~~
../../../../src/lib/script.c:54:4: note: call to ‘free’ here
   54 |    free(tmpstr);
      |    ^~~~~~~~~~~~
2022-01-29 19:59:47 +01:00
Kim Woelders 749c6ab254 Fix gcc12 warning in __imlib_ConsumeImage()
Although the warning is technically correct it is not a problem as the
address is just used to match if an ImlibImagePixmap references it.

../../../../src/lib/image.c: In function ‘__imlib_ConsumeImage’:
../../../../src/lib/image.c:111:4: error: pointer ‘im’ used after ‘free’ [-Werror=use-after-free]
  111 |    __imlib_PixmapUnrefImage(im);
      |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../../src/lib/image.c:108:4: note: call to ‘free’ here
  108 |    free(im);
      |    ^~~~~~~~
2022-01-29 19:59:47 +01:00
Kim Woelders 4384b8ee43 Add some missing const qualifiers 2022-01-29 19:59:47 +01:00
Kim Woelders 9f58303ac4 Refactoring around font glyph lookup
Avoiding some code duplication.
2022-01-29 19:59:47 +01:00
Kim Woelders c74cb9f1a9 Mark obsolete TTF encoding functions as deprecated
and move them to separate file.

Haven't done anything useful for ~20 years.
2022-01-28 08:29:55 +01:00
Kim Woelders 3157181bc3 HEIF loader: Avoid memory leak when module is loaded more than once
Memory leak can be reproduced by running valgrind on test_load (which
calls imlib_flush_loaders()).
2022-01-28 08:29:55 +01:00
Kim Woelders 91a2ab9b14 SVG loader: Fix memory leak on error 2022-01-28 08:29:55 +01:00
Kim Woelders f9aca8ff43 autofoo: Sort loaders 2022-01-26 22:54:04 +01:00
Kim Woelders 5d6ed3db15 loaders.c: Add heif to known loaders 2022-01-26 20:28:06 +01:00
Kim Woelders 1c7446ee9d HEIF loader: A couple of cleanups and fixes
- No need to check fileno
  Should be valid on entry
- No need for stat()
  File size is passed via im
- Call __imlib_FreeData() on error like the other loaders do
2022-01-26 20:27:18 +01:00
Rishvic Pushpakaran b9668a0851 imlib2: added loader for HEIF files (uses libheif), implemented just `load2` for now
Summary: Implemented a loader for HEIF images. Uses libheif, and implemented the `load2` function as of now

Reviewers: raster

Subscribers: Colocasian, eworm, kwo

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D12267
2022-01-26 20:26:06 +01:00
Kim Woelders 5261da4a6e Move some code as suggested in source 2022-01-26 20:23:46 +01:00
Kim Woelders 60fb882dad Drop/adjust a few comments 2022-01-26 20:23:36 +01:00
Kim Woelders 31982cbe63 imlib2_view: Avoid clang error
imlib2_view.c:206:33: error: initializer element is not a compile-time constant
   static rect_t       r_prev = r_zero;
                                ^~~~~~
2022-01-21 16:32:27 +01:00
Kim Woelders 838c391093 image.c: Avoid potential compile error
gcc 11.2.1 with -pedantic:
image.c: In function ‘__imlib_LoadImage’:
image.c:567:9: error: a label can only be part of a statement and a declaration is not a statement [-Werror=pedantic]
  567 |         ImlibLoader ** loaders = __imlib_GetLoaderList();

clang 13.0.0:
image.c:567:9: error: expected expression
        ImlibLoader ** loaders = __imlib_GetLoaderList();
        ^

Also remove pointless self-assignment.
2022-01-21 16:32:19 +01:00
Kim Woelders 510938f097 PNM loader: Fix "XV thumbnail" (P7 332) loading
Not sure this has ever worked.
2022-01-19 19:10:23 +01:00
Kim Woelders f4e8e1414b PNM loader: Fix P1 when spaces are omitted 2022-01-18 20:44:26 +01:00
Kim Woelders cd6c00b1ce Avoid redundant operations when non-existing file has no "key" 2022-01-17 13:08:58 +01:00
Kim Woelders 9afad50f97 Simplify __imlib_FileKey()
And avoid malloc when not needed.
2022-01-17 13:06:22 +01:00
Kim Woelders 8891246610 PNG loader: Add multiframe support 2022-01-16 20:53:58 +01:00
Kim Woelders 5dfccd5713 PNG loader: Rewrite to use callback API
Preparing for multiframe support.
2022-01-16 20:53:58 +01:00
Kim Woelders 83f55515fb PNG loader: Disable Imlib2-Comment stuff
Not useful, AFAICT.
2022-01-16 20:53:58 +01:00
Kim Woelders 1f883a721a Add dispose-to-previous frame handling
Dispose to previous appears to be used often by apng's.
2022-01-16 20:53:58 +01:00
Kim Woelders b26150d9f4 imlib2_load: Add no-data option
Also start using stdbool for boolean stuff.
2022-01-16 20:53:31 +01:00
Kim Woelders ffbd8bbca0 SVG loader: Avoid problems when loading the module more than once
It appears that the svg loader fails when dlopen'ed a second time,
presumably due to some issue in librsvg2:

thread '<unnamed>' panicked at 'Type RsvgHandle has already been registered', /builddir/build/BUILD/librsvg-2.52.4/vendor/glib/src/subclass/types.rs:751:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
fatal runtime error: failed to initiate panic, error 5

A second load of a loader will only happen if an application calls
imlib_flush_loaders(), which I don't see why regular applications would
need to do.
However, calling imlib_flush_loaders() shouldn't cause applications to
potentially fail (abort) anyway.

The failure can be avoided by dlopen'ing with RTLD_NODELETE, but that
would apply to all loaders, which doesn't seem right.
With the solution here the svg.so module is marked to be un-unloadable
which seems to solve the problem and doesn't affect other modules.
2022-01-08 16:08:38 +01:00
Kim Woelders a542fb6724 Add svg loader 2022-01-08 16:08:37 +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 564334d708 LZMA loader: Fix potential warning 2022-01-04 09:36:03 +01:00
Sören Tempel 7d60151ba9 ICO loader: Fix compilation on big endian architectures
Commit ff79901a07 refactors the
ico_read_idir function and removed the local nr variable. Unfortunately,
this variable is still used within an `#ifdef WORDS_BIGENDIAN` block on
big endian architectures as a for loop index variable. As such, the code
does presently not compile since the aforementioned commit. This patch
fixes this issue by re-introducing the variable conditionally on big
endian architectures.

Note: It would likely be cleaner to declare the nr variable as part of
the loop declaration, however, this C99 feature does not seem to be used
anywhere in the code base, hence I refrained from using it here.
2022-01-03 17:29:06 +01:00
Kim Woelders 31d6d8532c imlib2_load: Verbosity twaeks 2022-01-02 12:59:24 +01:00
Kim Woelders 8f65acf7c2 imlib2_view: Verbosity twaeks 2022-01-02 12:51:24 +01:00
Kim Woelders 86e3b4fada imlib2_grab: Print error message if saving fails 2021-12-30 06:56:35 +01:00
Kim Woelders 503e8527c3 Add lzma loader 2021-12-28 16:08:06 +01:00
Kim Woelders c880edac55 BZ2, ZLIB loaders: Move duplicated code to separate file
Also change decompressors to use mmap'ed data.
2021-12-28 16:08:06 +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 f3db9c99b6 imlib2_view: Rework display of animated images 2021-12-28 16:07:19 +01:00
Kim Woelders 350101ff62 GIF loader: Always set BLEND flag
... always?
2021-12-28 16:06:38 +01:00
Kim Woelders 34b54a8fc2 ICO loader: Mostly cosmetic changes (inline ico_read())
Avoids unnecessary memory allocation, simplifies error handling.
2021-12-26 12:22:20 +01:00
Kim Woelders 8bc72491e8 ICO loader: Minor optimization
Or maybe not. A decent compiler would probably do this anyway.
2021-12-26 12:22:20 +01:00
Kim Woelders 71a905d700 imlib2_view: Fix(?) animated image frame dispose handling
Still need to deal with the blend flag.
2021-12-26 11:00:14 +01:00
Kim Woelders 2bbd3dc7f9 Updates for animated image handling 2021-12-26 11:00:14 +01:00
Kim Woelders 31d5eb6dbf autofoo/loader cosmetics
Consistently place loaders in same order.
2021-12-23 17:51:24 +01:00
Kim Woelders 40b6498281 Drop some intermediate type definitions
Not helpful, IMO.
2021-12-21 06:05:32 +01:00
Kim Woelders b28d9110e4 updates: Reduce memory usage
Apparently, sizeof(struct _tile) was 4 (gcc 11.2.1) ?!?
Weird - I think that once upon a time it was 1.
Anyway, avoid having ill defined struct size.

Also, simplify logic a bit (no need to deal with .usage as bit flags.
2021-12-21 06:05:32 +01:00
Kim Woelders f9e0e92189 Loader loading: Avoid access to uninitialized load() item 2021-12-21 06:05:18 +01:00
Kim Woelders f1bef7ae01 debug: Avoid use of uninitialized data 2021-12-21 06:05:18 +01:00
Kim Woelders 82bbd0a278 Indent 2021-12-21 06:05:18 +01:00
Kim Woelders 6ce28a9380 ICO loader: Debug tweaks 2021-12-19 14:58:43 +01:00
Kim Woelders 179d3b7e05 GIF loader: Multiframe support 2021-12-19 14:58:43 +01:00
Kim Woelders bdfcc554ed GIF loader: Some refactoring, add debug 2021-12-19 14:58:43 +01:00
Kim Woelders 7a0022684d ICO loader: Multiframe support 2021-12-19 14:58:43 +01:00
Kim Woelders b2ac97d93a WEBP loader: Multiframe support 2021-12-19 14:58:43 +01:00
Kim Woelders 549ff77b85 debug: Add DL macro for additional loader debug 2021-12-19 14:58:43 +01:00
Kim Woelders f09d3d022a imlib2_view: Add support for multiframe images 2021-12-19 14:58:43 +01:00
Kim Woelders fdd6419fe4 imlib2_load: Add support for multiframe images 2021-12-19 14:58:43 +01:00
Kim Woelders d105b29017 Enable caching for multiframe images 2021-12-19 14:58:43 +01:00
Kim Woelders 1a57db7dcb Add support for multiframe (animated) images 2021-12-19 14:58:43 +01:00
Kim Woelders d792aaa130 imlib2_view: Fix caching option
As imlib2_view did rendering via the (loader) progress callback, cached
images wouldn't be rendered.
Now, when caching is enabled, we don't use progress callbacks but render
explicitly after the image is loaded.
2021-12-19 09:32:53 +01:00
Kim Woelders 343b2041cf debug: Add some image caching debug 2021-12-19 09:32:34 +01:00
Kim Woelders b5e2bd146d imlib2_view: Tweaks around timeout 2021-12-19 09:32:34 +01:00
Kim Woelders d8e2f7a32d imlib2_view: Remove some pointless function calls 2021-12-19 09:32:13 +01:00
Kim Woelders d5c23565bd imlib2_view: Refactor pixmap rendering 2021-12-18 23:05:36 +01:00
Kim Woelders eb7eee0dfc imlib2_view: Move window background image init to separate function 2021-12-18 23:05:36 +01:00
Kim Woelders f2d98a2c15 imlib2_view: Add 'r' command to refresh 2021-12-18 23:05:29 +01:00
Kim Woelders 45575222f5 imlib2_view: Cosmetics (if -> switch) 2021-12-18 23:03:28 +01:00
Kim Woelders 104f330c9f Trivial cleanups 2021-12-18 06:07:08 +01:00
Kim Woelders 52b0752af4 Pass parameters to __imlib_LoadImage() by struct
Makes it much easier to change stuff.
2021-12-18 06:07:08 +01:00
Kim Woelders 8470ecec66 Use __func__ instead of open coded function names
We are already requiring C99, at least since the recent initial context
changes.
2021-12-18 06:07:08 +01:00
Kim Woelders 89def8bab3 Drop context check/init in API functions
Obsolete as we now have an initial static one.
2021-12-10 19:29:46 +01:00
Kim Woelders 8370777a31 Make initial context static
Avoids having to check on every API function call.
2021-12-08 19:12:29 +01:00
Kim Woelders 01d76b56a0 Drop context image save/restore around __imlib_Load/SaveImage() calls
Should not be necessary.
2021-12-06 14:30:30 +01:00
Kim Woelders 1216f11686 Update doc for imlib_load_image_fd() 2021-12-06 07:08:06 +01:00
Kim Woelders 273a7aaac3 Refactor condition for using assembly functions
Makes it easier to override the decision for testing.

Setting IMLIB2_ASM_OFF will now disable use of assembly functions.
2021-12-04 15:14:50 +01:00
Kim Woelders b1208a1333 Refactoring around mmx and scaling function calls
Move call to __imlib_Scale_mmx_AARGBA() into __imlib_ScaleAARGBA() and
__imlib_ScaleAARGB().

Similar to mmx/rotation handling.
2021-12-04 06:55:21 +01:00
Kim Woelders 1411f6ac69 Refactoring around mmx and rotate function calls
Move call to __imlib_mmx_RotateAA() into __imlib_RotateAA().

Avoids some code duplication.
2021-12-04 06:55:21 +01:00
Kim Woelders f935f31bad Simplify build wrt. asm files 2021-12-04 06:55:21 +01:00
Kim Woelders 8f28d7d706 blend.c: Tweaks, cleanups 2021-12-04 06:55:11 +01:00
Kim Woelders 152366c87e Avoid "exceeds maximum object size" warning
..for 32 bit arch too.
2021-12-02 18:10:18 +01:00
Kim Woelders 84343e5a61 Avoid signedness warning 2021-12-02 18:10:18 +01:00
Kim Woelders 5627edbb76 Speedup in imlib_create_scaled_image_from_drawable()
Avoid intermediate pixmap copy when scaling 1:1 with no offset.
2021-11-29 17:37:20 +01:00
Kim Woelders b2d7af466e x11_grab.c: Introduce function to get shape mask
Avoiding some code duplication.
2021-11-29 17:37:20 +01:00
Kim Woelders 314fb50e92 x11_grab.c: Cosmetics 2021-11-29 17:37:20 +01:00
Kim Woelders 5ab0fa77f1 imlib2_view: Enable grabbing/viewing drawables 2021-11-29 17:37:20 +01:00
Kim Woelders 1471e92f62 Only set MAINTAINERCLEANFILES in top-level Makefile.am
Less likely to forget one (currently in test/).
2021-11-29 17:37:20 +01:00
NRK 524d439adf WEBP loader: fix key selecting last frame
as far as i can tell, iter is being used uninitialized here leading to
reading garbage values resulting in the last frame always being selected
when key is present.
2021-11-29 17:37:20 +01:00
Kim Woelders 6e27c1e2c3 Fix y-upscaling in imlib_create_scaled_image_from_drawable() 2021-11-25 15:45:56 +01:00
Kim Woelders add72b4023 x11_grab.c: Rename source/destination variables for clarity 2021-11-25 09:17:50 +01:00