Commit Graph

1745 Commits

Author SHA1 Message Date
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
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 b123cb7674 configure.ac: Correct simplification changes some more 2022-01-07 21:11:26 +01:00
Kim Woelders c109324bbf configure.ac: Correct simplification changes 2022-01-04 09:36:03 +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 cbe7408bd8 test: Add a couple of ico depth test images 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 3a93e9a92a configure.ac: Simplify loader setup 2021-12-23 17:51:24 +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