Commit Graph

1294 Commits

Author SHA1 Message Date
Kim Woelders 002df3c1fa image.c: Minor refactoring of pixmap cache cleaners 2019-12-28 12:06:22 +01:00
Kim Woelders a7be91805f image.c: Enable non-dirty pixmap cache cleaning
For whatever reason this does not seem to have ever been active.
Let's activate it now.
2019-12-28 12:06:22 +01:00
Kim Woelders 6acfd27058 image.c: Move loader functions to separate file 2019-12-28 12:06:22 +01:00
Kim Woelders 02e85ee069 image.c: Move image tag functions to separate file 2019-12-28 12:06:22 +01:00
Kim Woelders 0c7464f0db image.c/h: Cleanups
- Make a number of functions static
- Shuffle prototypes around for nicer grouping
- Remove unused __imlib_SetImageAlphaFlag()
- Remove __imlib_FlushCache() prototype (not implemented)
2019-12-28 12:06:22 +01:00
Kim Woelders 6a7eb67f46 Saver cleanups
- Do exit cleanups at exit.
- Use LOAD_FAIL/SUCCESS/BREAK for save() exit code.
- Cosmetics.
2019-12-23 12:55:46 +01:00
Kim Woelders bd3aa88242 Loader cleanups
- Do exit cleanups at exit.
- Merge data load conditions.
- Use LOAD_FAIL/SUCCESS/BREAK for load() exit code.
- Cosmetics.
2019-12-23 12:07:48 +01:00
Kim Woelders 540a98870b image.c: Use loader return value, not im->w to determine load success 2019-12-23 10:53:26 +01:00
Kim Woelders 670c8428a4 image.c: Introduce __imlib_ErrorFromErrno() 2019-12-23 10:53:26 +01:00
Kim Woelders c60ad00b1e image.c: Use real_file to get file time 2019-12-23 10:53:26 +01:00
Kim Woelders 0f4c0d9453 image.c: Don't strdup() real_name when not necessary in __imlib_LoadImage() 2019-12-23 10:53:26 +01:00
Kim Woelders 2c35a349ea image.c: Rework some obscure file name stuff in __imlib_SaveImage() 2019-12-23 10:53:26 +01:00
Kim Woelders c1b2686441 image.c: Remove some unnecessary clearing of calloc'ed structs 2019-12-23 10:53:26 +01:00
Kim Woelders 0c69bb64cc image.c: Add some space for readability 2019-12-23 10:53:26 +01:00
Kim Woelders cdf64148b0 Drop the __imlib_IsRealFile() file check in __imlib_File...() functions
There should be no reason to do this everywhere.
Only keep the one used when doing an image load.
2019-12-23 06:37:00 +01:00
Kim Woelders fa670dcbd7 Refactor many __imlib_File...() functions to use common __imlib_FileStat()
And drop unused __imlib_FilePermissions()
2019-12-23 06:37:00 +01:00
Kim Woelders 57b4b12c7e Simplify __imlib_FileExtension()
__imlib_FileExtension() has (presumably by mistake) never used the
"real" file name to determine the extension so let's just drop all the
strdup'ing and return a pointer into the file string.
2019-12-23 06:37:00 +01:00
Kim Woelders 7b3b5f7f0c imlib2_load: Add repeated load option 2019-12-23 06:37:00 +01:00
Kim Woelders 55da63d700 imlib2_load: Use getopt() 2019-12-23 06:37:00 +01:00
Kim Woelders c396b32739 imlib2_load: Properly check non-full loads (load data too) 2019-12-23 06:37:00 +01:00
Kim Woelders 8e376b549f XPM loader: Major speedup for cpp > 2 2019-12-23 06:37:00 +01:00
Kim Woelders 59027165b2 1.6.1 2019-12-13 19:08:18 +01:00
Luiz Carlos Ramos 641dd66349 BMP loader: Fix size calculation when saving files
The sizes stored both in BMP file and bitmap headers were not considering the
padding of each row, leading to smaller values when the width was not multiple
of 4.

Fixed by including the padding in the formula.
2019-12-08 14:39:09 +01:00
Kim Woelders 48ff9e10c1 LBM loader: Fix header-only loading 2019-12-03 20:03:21 +01:00
Kim Woelders 503bce9c64 XPM loader: Minor optimization for cpp > 2 2019-12-03 17:26:24 +01:00
Kim Woelders 269e0b8572 BMP loader: Remove some bogus conditions
And tweak (disabled) debug stuff.
2019-12-03 17:26:24 +01:00
Kim Woelders 3bd4e8032c Enable specifying loader/filter paths with environment variables
Useful for testing.
2019-12-03 17:26:24 +01:00
Kim Woelders fdbf1c49e3 imlib2_view: Add progress debug options 2019-12-03 17:26:24 +01:00
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