Commit Graph

1768 Commits

Author SHA1 Message Date
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
Kim Woelders 9f58303ac4 Refactoring around font glyph lookup
Avoiding some code duplication.
2022-01-29 19:59:47 +01:00
Kim Woelders 68171bdf7c test: Add basic heif loader check 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 dde8b3fcd1 test: Add some more PNM type loading tests
Also avoid that .gz file contents depend on contained file's time stamp.
2022-01-19 19:38:32 +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 10f692c946 test: Add makefile to generate test images 2022-01-18 20:42:13 +01:00
Kim Woelders da2ce0d94b test: Move generated image files out of source dir
Simplifies cleaning up.
2022-01-18 20:40:59 +01:00
Kim Woelders 0d6211c501 Drop change log from before first version tag 2022-01-18 20:31:27 +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 64c031acab test: Check __imlib_FileKey() 2022-01-17 13:06:16 +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