Commit Graph

1247 Commits

Author SHA1 Message Date
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
Kim Woelders 6ea4cf7e66 XPM loader: Add missing pixels (malformed xpm)
If there are not enough pixels in the image data just fill in the first
color.

This way we will proceed without uninitialized pixel data avoiding
valgrind complaints.
2018-07-21 15:25:44 +02:00
Kim Woelders 49a67a8f9c XPM loader: Simplify pixel value handling 2018-07-21 15:25:44 +02:00
Kim Woelders f09c02d193 XPM loader: Fix several colormap issues 2018-07-21 15:25:44 +02:00
Kim Woelders 88c23a8e93 XPM loader: Cosmetics (reduce indent level) 2018-07-21 15:25:44 +02:00
Kim Woelders 4e6d8e8938 Revert "XPM loader: Fix potentially uninitialized pixel data"
This introduced other issues, proper fix coming up..

This reverts commit cbc09c0345.
2018-07-21 15:24:11 +02:00
Kim Woelders 621d498450 XPM loader: Fixup after "Refactor exit cleanup handling"
Don't crash on non-existing file.
2018-07-21 09:00:45 +02:00
Kim Woelders cbc09c0345 XPM loader: Fix potentially uninitialized pixel data
Pixels with color "none" were composed using uninitialised GB values.

Although the pixels were "correct", as RGB are don't-care when A is 0,
let's not put random data in images and avoid valgrind complaints.

Thanks to Sebastien Ballet for test case.
2018-07-20 06:08:56 +02:00
Kim Woelders a2be3c001d XPM loader: Refactor exit cleanup handling 2018-07-20 06:02:42 +02:00
Kim Woelders ae9635b5d7 Fix memory leak in imlib_list_fonts()
Spotted by Sebastien Ballet.
2018-07-18 16:53:54 +02:00
Kim Woelders 5b17b85280 Spec file simlifications and cleanups 2018-07-17 19:31:04 +02:00
Kim Woelders 244cb1ce27 Add new ICO loader 2018-07-17 19:31:04 +02:00
Kim Woelders 89432fff5e Use common PIXEL_ARGB() macro to compose pixels 2018-07-17 19:31:04 +02:00
Kim Woelders 7206a84311 Move SWAP.. macro definitions to common.h 2018-07-17 19:31:04 +02:00
Kim Woelders b2e06bc6bd Remove obsolete dmalloc stuff
Also add some space in macros
2018-07-17 19:31:04 +02:00
Kim Woelders 0f3ebf198a Sort loaders in Makefile.am
Just for tidiness..
2018-07-17 19:31:04 +02:00
Kim Woelders 8fcdc4965d Centralize handling of im->format
Instead of assigning it (in different ways) in each loader, do it
centrally in __imlib_LoadImageWrapper().

And a couple of cleanups in code related to im->format.
2018-07-17 19:31:04 +02:00
Kim Woelders 868a40579a Cleanups in load() functions
When entering load we can assume that im != NULL and im->data == NULL.
2018-07-17 19:31:04 +02:00
Kim Woelders cf2b8e7c3d Add imlib2_test_load program
Just loads/unloads images given on command line.

Useful for loader testing.
2018-07-17 19:31:04 +02:00
Kim Woelders cc7c413655 Trivial cleanups in imlib2_... test programs 2018-07-17 19:31:00 +02:00