Commit Graph

1466 Commits

Author SHA1 Message Date
Kim Woelders f9c10c19e3 imlib2_load: Optionally write to stderr instead of stdout
Sometimes useful when testing with valgrind.
2019-12-03 17:26:24 +01:00
Kim Woelders 8584b3f88a Rename imlib2_test_load to imlib2_load
imlib2_test_load was a bit long..
2019-12-03 17:26:24 +01:00
Kim Woelders 2d9511d59d Quit on 'q' or 'esc' key press in all imlib2_... test utilities
The ...free... stuff at quit seems to be needed to silence valgrind when
exiting by return from main and not by exit().
2019-12-03 17:26:24 +01:00
Kim Woelders 8bd07dbcea gz, bz2 loaders: Fix recent breakage when file name has more than two dots 2019-11-26 06:20:46 +01:00
Kim Woelders 1a0c29c873 gz loader: Use FILE, not fd
Making it more similar to the bz2 loader.
2019-11-26 06:18:48 +01:00
Kim Woelders 11ced03ba4 1.6.0. 2019-11-24 07:08:19 +01:00
Kim Woelders f20038b2e7 gz, bz2 loaders: Simplify, eliminate unnecessary strdups, cosmetics
In particular, don't free the original im->real_file.
2019-11-23 07:01:37 +01:00
Kim Woelders 9b0ab12697 XPM loader: Correct signature check (avoid accessing unset data) 2019-11-22 19:08:39 +01:00
Kim Woelders 947b602cca ICO loader: Fix memory leak in error path 2019-11-17 14:52:09 +01:00
Kim Woelders baaddf9366 imlib2_view: Fix next/prev selection if last/first image is bad 2019-11-17 06:13:14 +01:00
Kim Woelders 1a6a6b6433 Remove __imlib_AllocateData() w,h args
im->w and im->h must always be set before __imlib_AllocateData() is
called due to non-immediate loading (__imlib_AllocateData() only
comes in play when the pixel data must be loaded).
2019-11-16 21:18:12 +01:00
Kim Woelders 2339dcb1cf ICO loader: Fix non-immediate loading 2019-11-16 21:09:19 +01:00
Kim Woelders 9bae2c9f02 TGA loader: Tweak error handling 2019-11-16 21:09:16 +01:00
Kim Woelders a2cb8276e5 TGA loader: Add simple 16 bpp handling
Probably not entirely correct (N alpha bits?).
2019-11-16 12:18:33 +01:00
Kim Woelders 0d0a701a96 TGA loader: Support horiontal flip 2019-11-16 12:18:33 +01:00
Kim Woelders 9cdd1bc007 TGA loader: More mostly cosmetic changes 2019-11-16 12:18:33 +01:00
Kim Woelders f01353d155 TGA loader - Mostly cosmetic refactoring 2019-11-16 12:18:33 +01:00
Kim Woelders 83243f08fa imlib2_view: Add verbose option, quit on Escape too 2019-11-16 12:17:27 +01:00
Kim Woelders d6c13ec444 imlib2_test_load: Check progress conditionally 2019-11-16 12:17:27 +01:00
Kim Woelders 6eb958fb1b imlib2_test_load: Fixup recent breakage for real 2019-11-15 17:11:12 +01:00
Olof-Joachim Frahm (欧雅福) fb0cce4caf tga loader: implement handling of palette
Summary:
implemented 8 bit color mapped images with 24/32bpp palette.

This is coming from an issue on [[ https://github.com/derf/feh/issues/491 | feh ]] to support indexed TGA images. Written by [[ https://github.com/rofl0r | rofl0r ]], I'm forwarding it because I already have the tools for submission set up.

N.b. I'm not terribly familiar with the particular code style, if there's anything to format differently I'm happy to update.

Test Plan:
- Compared [[ https://0x0.st/zgB4.tga | example file ]] with known good in GIMP, looks okay.
- Tested that said example file doesn't load without this patch (in feh, which uses Imlib2).

Reviewers: kwo

Differential Revision: https://phab.enlightenment.org/D10618
2019-11-15 17:03:05 +01:00
Kim Woelders bb42ef3f22 imlib2_view: Fix event processing bug 2019-11-10 15:11:56 +01:00
Kim Woelders 3748dd580f imlib2_view: Enable selecting next/prev using keys too 2019-11-10 15:11:56 +01:00
Kim Woelders 5d1e984e57 Simplify loader lookup functions 2019-11-10 15:11:56 +01:00
Kim Woelders 7a2769cad7 XPM loader: Accept signature not at the very start of the file 2019-11-10 15:11:56 +01:00
Kim Woelders 484bd5cc79 Eliminate READ_RGBA() 2019-11-09 12:07:15 +01:00
Kim Woelders 3e082b2310 Use macro for pixel color access in savers 2019-11-09 12:07:15 +01:00
Kim Woelders 755dc017f2 Use pixel instead of r,b,g,a in __imlib_render_str() 2019-11-09 12:07:04 +01:00
Kim Woelders e6269a9b9b Simplify pixel color handling in api.c 2019-11-09 11:32:17 +01:00
Kim Woelders 9f5af1341b Simplify autogen.sh 2019-11-09 07:03:03 +01:00
Kim Woelders 581e6baed8 Eliminate WRITE_RGBA()
Potentially causing way more memory access than needed.
2019-11-08 19:29:26 +01:00
Kim Woelders 7c426928e9 TGA loader: Refactor
Primarily make a single exit point.
2019-11-08 19:20:14 +01:00
Kim Woelders 2f228adbe1 Re-indent everything using indent-2.2.12 2019-11-08 18:57:36 +01:00
Kim Woelders d41d593e4b imlib2_test_load: Fixup after recent change 2019-11-08 18:57:36 +01:00
Kim Woelders 5e267577bd GZIP loader: Check filename before uncompress
Inspired by corresponding bz2 loader fix.

Also remove pointless call to stat().
2019-10-15 20:39:44 +02:00
Olof-Joachim Frahm (欧雅福) ff3164df37 Check filename before opening archive file.
Summary:
Decompressing should be the last step, otherwise files that can't even be loaded will take unnecessarily long only to be discarded immediately.

This is in reference to [this issue for feh](https://github.com/derf/feh/issues/477) complaining about long load times in case of accidentally trying to open a big .tar.bz2 archive.

Test Plan: Ran on sample from aforementioned ticket, observed immediate response and no further ill effects.

Reviewers: kwo

Differential Revision: https://phab.enlightenment.org/D10398
2019-10-15 20:39:44 +02:00
Kim Woelders ab918a65ac Miscellaneous imlib_test_load tweaks
- Error messages to stdout (not stderr).
- Check progress call.
- Break on error option.
2019-10-13 16:12:28 +02:00
Kim Woelders cb1b2482a3 BMP loader: Major makeover - numerous bug fixes and feature enhancements
The test images at https://entropymine.com/jason/bmpsuite were most
helpful.

Several features have NOT been implemented, including
- Non-square resolution
- "Bottom up" format
- PNG compression
- JPEG compression
- Huffman 1D (OS/2) compression
- 2 bpp (OS/2)
- BA file type (bitmap array - OS/2)
2019-10-13 16:11:13 +02:00
Kim Woelders 450463521f Rename/add byte swap macros 2019-10-11 15:28:53 +02:00
Kim Woelders 77cae4cc86 JPG loader: Refactor error handling
As part of this
- Avoid potential clobber issue in connection with setjmp/longjmp in
  load().
- Fix incorrect error handling in save().
2019-10-10 19:03:28 +02:00
Kim Woelders 675be6a527 ICO loader: Add binary flag to fopen()
As done in all other loaders.
2019-10-10 18:35:53 +02:00
Kim Woelders 7f24775df1 Fix ABI break
And indent.
2019-10-10 17:16:29 +02:00
Alexander Volkov 03665627db Allow to use custom memory management functions for loaded images
Summary:
... and add imlib_create_image_using_data_and_memory_function().

For example, it allows to load an image in one process and then
pass it through shared memory to another process without extra
memory copy.

Reviewers: kwo

Differential Revision: https://phab.enlightenment.org/D10222
2019-09-30 19:11:32 +02:00
Kim Woelders 9977ac2026 JPG loader: Fix memory leaks in error paths 2019-09-29 19:44:41 +02:00
Kim Woelders 701f87ffa6 WepP loader: Fix memory leak in error path 2019-09-29 18:40:03 +02:00
Kim Woelders 09d9a95054 Remove pointless im->data checks in loaders
im->data should always be NULL when entering the load() function.

We can therefore also remove free(im->data) calls before the buffer
is allocated.
2019-09-29 18:39:56 +02:00
Kim Woelders 3f4d80dc82 Add new WebP loader
Contributed by Jason Andresen <jandrese@vt.edu>.
2019-08-15 15:44:49 +02:00
Kim Woelders 203a99a51a JPG loader: Do proper CMYK conversion 2018-07-22 09:13:43 +02:00
Kim Woelders 1c095fd9be JPG loader: Refactor 2018-07-22 09:13:43 +02:00
Kim Woelders 5051ef9249 XPM loader: More simplifications
In particular, remove redundant and bogus loop conditions.
2018-07-21 15:26:34 +02:00