Commit Graph

1595 Commits

Author SHA1 Message Date
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
Kim Woelders d93ab097bf v1.8.1 2022-03-15 13:30:03 +01:00
Kim Woelders 4a6e74616e test: Exclude from tarball 2022-03-15 13:28:28 +01:00
Kim Woelders 16cda0cc97 test: Properly include test.h in test SOURCES 2022-03-15 13:26:33 +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
Kim Woelders b0f3bfc907 test_grab: Enable testing depths other than 24 and 32
Also test with/without using a mask when grabbing (just a "full" one for
now to hit different grabber paths).
2022-03-07 21:46:56 +01:00
Kim Woelders f334da7959 test: Command line options tweak 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 b8213bfd2a v1.8.0 2022-02-06 14:27:39 +01:00
Kim Woelders 79a5086b58 test: Merge common stuff 2022-02-06 13:07:47 +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 ea7e1feb7e imlib2.spec.in: Introduce acflags for configuration of rpmbuilds 2022-01-29 19:59:47 +01:00