aboutsummaryrefslogtreecommitdiff
path: root/image.c
Commit message (Collapse)AuthorAgeFilesLines
* allow configuring imlib2's cache size (#171)N-R-K2021-11-261-0/+1
| | | | | | | | by default imlib2 uses a 4mb cache, which is quite small. this allows users who have more memory to spare to set a bigger cache size and avoid reloading an already viewed image if it fits into the cache. Co-authored-by: Berke Kocaoğlu <berke.kocaoglu@metu.edu.tr>
* mark functions and vars as static (#146)N-R-K2021-11-201-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | the goal here to mark functions and variables not used outside the translation unit as static. main reason for this is cleanliness. however as a side-effect this can help compilers optimize better as it now has guarantee that a certain function won't be called outside of that translation unit. one other side-effect of this is that accessing these vars/function from config.h is now different. if one wants to access a static var/func from different translation unit in config.h, he would have to create a wrapper function under the right ifdef. for static functions one would also need to forward declare it. here's a dummy example of accessing the function `run_key_handler` from config.h under _MAPPINGS_CONFIG ``` static void run_key_handler(const char *, unsigned); bool send_with_ctrl(arg_t key) { run_key_handler(XKeysymToString(key), ControlMask); return false; } ```
* code-style: general cleanups (#137)N-R-K2021-10-291-9/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * tns_clean_cache: remove unused function arg * remove malloc casting * improve consistency use sizeof(T) at the end * avoid comparing integers of different signedness * use Window type for embed and parent * remove unnecessary comparisons * remove cpp style comments * improve consistency: remove comma from the end of enumerator list * Removed useless _IMAGE_CONFIG defines * consistency: use the same order as snprintf * Resolve c89 warnings Co-authored-by: uidops <uidops@protonmail.com> Co-authored-by: Arthur Williams <taaparthur@gmail.com>
* remove unnecessary animated webp related checkN-R-K2021-10-281-6/+0
| | | | | | | | this code snippet was introduced in https://github.com/nsxiv/nsxiv/pull/20/commits/2703809a23bdf3fe426466c7a10f41d747913128 but does not seem to be needed. from what i can tell this is some sort of hack that might've been needed back when we didn't bypass imlib2 when loading webp.
* update copyright notice (#139)eylles2021-10-281-1/+2
|
* fix: memory leak in img_load_webp (#135)N-R-K2021-10-261-4/+10
| | | | | | if `multi.cap` is >0 that means `multi.frames` has already been malloc-ed. by unconditionally malloc-ing again, we're losing all the old memory. this makes it so we're only malloc-ing (or realloc-ing) when needed.
* Revert "Fix in tabbed with alpha patch (#3)" (#121)N-R-K2021-10-161-2/+1
| | | | | | | | | This reverts commit c7ca547b55e98914264351502e581fe6ae17ae15. cd710f5 fixed the issue with embedding into a parent that has alpha and partially reverted c7ca547 this commit fully reverts c7ca547 , as these changes aren't needed for embedding into an alpha-parent.
* Fix behaviour when TrueColor / 24 bit depth is not available (#114)miseran2021-10-111-2/+2
| | | | | | | | | | | | | * Fix regression introduced in c7ca547 which made nsxiv not start in non-TrueColor X server. * Introduce a new fix for embedding into tabbed-alpha. * Fixes a visual glitch from original sxiv when drawing transparent images in 8 bit depth. In 8 bit PseudoColor, `.pixel` is just an index into the 256 defined colors and thus trying to extract rgb bits from it would result in visual glitch. The values `.color.red` on the other hand and so on are always integers between 0 and 0xFFFF representing the color as expected. * Use XColor for win_bg/fg and mrk_fg Co-authored-by: NRK <nrk@disroot.org>
* code-style: fix consistency issues all over the codebase (#94)Berke Kocaoğlu2021-10-111-1/+2
| | | | | | | | | | | | | | | * remove duplicate comment * remove empty tabs and blank lines * move macros and globals ontop * comment to seprate function implementation * fix alignment * switch to *argv[] similar to other suckless code * kill all empty last lines * append comment to endif * reuse existing ARRLEN macro * comment fall through * use while (true) everywhere Co-authored-by: NRK <nrk@disroot.org>
* Make statusbar optional (#95)Arthur Williams2021-10-101-1/+1
| | | | | | | | libXft and libfontconfig are now optional dependencies which can be disabled via `HAVE_LIBFONTS=0`. Disabling them means disabling the statusbar. This also does not search for freetype2 header if disabled. Co-authored-by: NRK <nrk@disroot.org>
* Use zoom steps instead of hard-coding levels (#92)Lu Xu2021-09-251-47/+11
| | | | | Co-authored-by: NRK <nrk@disroot.org> Co-authored-by: Berke Kocaoğlu <berke.kocaoglu@metu.edu.tr>
* Add animated webp support (#20)Sam Whitehead2021-09-241-1/+151
| | | | | | Co-authored-by: NRK <nrk@disroot.org> Co-authored-by: Stein Gunnar Bakkeby <bakkeby@gmail.com> Co-authored-by: Berke Kocaoğlu <berke.kocaoglu@metu.edu.tr>
* Rename, Update Docs and Prepare for Release (#9)Berke Kocaoğlu2021-09-161-5/+5
| | | | | | | Co-authored-by: Guilherme Rugai Freire <41879254+GRFreire@users.noreply.github.com> Co-authored-by: N-R-K <79544946+N-R-K@users.noreply.github.com> Co-authored-by: NRK <nrk@disroot.org> Co-authored-by: Arthur Williams <taaparthur@gmail.com> Co-authored-by: eylles <ed.ylles1997@gmail.com>
* Rework the build system (#19)TAAPArthur2021-09-161-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Added simple configure script Added simple script to autodetect if optional dependencies are installed and enable/disable them as needed. Note this solution uses the compiler directly instead of an external program like pkgconfig so it doesn't require any extra dependencies. It is intended to work with any arbitrary compiler; it has been tested with tcc and gcc. There are some "breaking" changes hidden here - HAVE_GIFLIB was renamed to HAVE_LIBGIF to match HAVE_LIBEXIF - Simply typing `make` will no longer try to build with optional dependencies * use implicit RM variable * General clean-up in configure - Use printf instead of echo - Format style * honor env PREFIX, use LDLIBS * Revert "General clean-up in configure" This reverts commit 8683c179dbf273a330f9a224a4d481a7bea42c5f. * honor env LDFLAGS if set * Don't set OPTIONAL_LIBS in configure * make OBJ all caps * follow suckless style build system - remove configure script. - HAVE_LIBGIF and HAVE_LIBEXIF defaults back to 1 - unload several varibales onto config.mk - make version all-caps - add -O2 optimization - use CPPFLAGS for includes and defines * Revert "follow suckless style build system" This reverts commit 8bf75b1f68d72df349edba8d998d4659dd956dd8. * Generate config.mk from make * Inlined configure in Makefile * update docs * cleanups - changes to config.mk should trigger a rebuild - remove potentially confusing variables form Makefile * Use install instead of mkdir/cp/chmod when sensible * fixup! Inlined configure in Makefile * Don't generate config.mk on rm -f *.o sxiv * update docs and cleanups - make config.mk silent - mention editing config.mk in README * fallback to 0 if user edits config.mk in unexpected way * add comment on config.mk * remove invalid comment configure script is removed * slight restructure - make version all caps - restructure variables that users may want to edit to top - use CPPFLAGS for defines - add some comments - remove needless echos since we have verbose output now * add echos back Co-authored-by: NRK <nrk@disroot.org> Co-authored-by: Berke Kocaoğlu <berke.kocaoglu@metu.edu.tr>
* fix: out-of-bounds access when bg not in color mapwhowillbellthecat2021-09-161-0/+4
|
* change gamma on -GNRK2021-09-161-1/+1
| | | | Closes: https://github.com/nsxiv/nsxiv/issues/30
* Custom bar colors (#10)Guilherme Freire2021-09-161-1/+1
| | | | | | | | | * set bar and text colors independently * change xresources to Program.class.resource * rename color variables to win/bar_bg/fg * change default bar colors to match window colors
* Fix in tabbed with alpha patch (#3)Berke Kocaoğlu2021-09-161-1/+2
| | | | | * Fix in tabbed with alpha patch Co-authored-by: Jared Forrest <jared_forrest@mailbox.org>
* Implement fill scale modeBerke Kocaoğlu2021-09-161-0/+3
|
* Use normal win colors in fullscreen modeBert Münnich2019-07-161-1/+1
| | | | Fixes issues #361 and #367
* Align compile-time color options with X resource colorsBert Münnich2019-01-231-1/+1
| | | | Two colors are more than enough!
* Do not limit fit-to-win to smallest zoom levelBert Münnich2018-01-221-7/+4
| | | | Related to issue #303
* Make zoomdiff compare impact on image dimensionsBert Münnich2018-01-221-6/+6
| | | | | | Before that zoomdiff was a merely heuristic. Related to issue #303
* Use float for ox/oy compare valuesBert Münnich2018-01-221-4/+4
| | | | Fixes issue #302
* Reject text files resembling TGA imagesBert Münnich2017-11-231-9/+23
| | | | | | | | | | | | | | | | | | | Fixes issue #295 The imlib2 TGA loader returns an imlib image handle without any actual data when given a text file like this: T Content-Type: application/javascript Content-Length: 3836 Last-Modified: Wed, 23 Sep 2015 12:25:47 GMT Etag: "56029a4b-efc" Expires: Sat, 20 Aug 2016 15:14:33 GMT Cache-Control: max-age=604800, public Accept-Ranges: bytes Fortunately, `imlib_image_get_data()` returns NULL in this case, so that we can use it as an additional check when opening files.
* One header file for type definitions and function declarationsBert Münnich2017-10-161-7/+4
|
* Zoom into mouse cursor positionBert Münnich2017-10-161-2/+9
|
* Mouse drag translates pointer position to image areaBert Münnich2017-10-041-3/+8
| | | | This makes mouse panning more direct and faster.
* Make pan fraction configurablejcalve2017-09-061-3/+3
|
* Merge djhejna/floatdelayBert Münnich2016-12-011-1/+1
|\
| * Support for DELAY as a floating point number including less than 1Don Hejna2016-11-271-2/+2
| | | | | | | | | | second while maintaining backward compatibiitiy with integer arguments.
* | Add -A option to force framerate on animated imagesdwminer2016-11-271-0/+2
|/
* Only open regular files; fixes issue #252Bert Münnich2016-10-201-1/+4
|
* Use Xft for font loading and text drawingBert Münnich2016-08-061-1/+1
|
* Fix 32-bit unsigned integer shiftBert Münnich2015-12-261-1/+1
|
* Revised error handlingBert Münnich2015-10-281-5/+6
| | | | | | | - Functions warn() and die() replaced by GNU-like error(3) function - Register cleanup() with atexit(3) - Functions called by cleanup() are marked with CLEANUP and are not allowed to call exit(3)
* Prefix safe allocation functions with 'e' instead of 's_'Bert Münnich2015-10-281-6/+6
|
* Removed feature test macro definitions from source filesBert Münnich2015-10-281-3/+2
|
* Removed overcautious parameter checksBert Münnich2015-10-281-52/+3
|
* Round integer cast of image offset during rendering; fixes issue #197Bert Münnich2015-02-061-2/+2
|
* Apply gamma value on thumbnails too; fixes issue #193Bert Münnich2015-01-051-30/+11
|
* Use bit-field for boolean flags in fileinfo structBert Münnich2015-01-041-2/+2
|
* Do not print could-not-open-warnings for files found by directory traversalBert Münnich2014-10-241-2/+3
|
* Simplified img_frame_animateBert Münnich2014-09-011-10/+5
|
* Overhauled window drawing, yet again; fixes issue #155Bert Münnich2014-07-281-1/+1
| | | | | | | | - Buffer for window content is bigger than the window, minimizes artifacts when window is resized - Back to using XSetWindowBackgroundPixmap() instead of XCopyArea(), no need to handle exposure events; X server can show gray background directly after resize event before sxiv redraws the window contents
* Revised handling of GIF animationsBert Münnich2014-07-251-30/+13
| | | | | | - New option `-a`: Play animations at startup - Ctrl-Space toggles animation for all GIF files - Infinite loop for all animations
* Added support for multiple commands per key/button mapping; elegant fix for ↵Bert Münnich2014-07-231-14/+8
| | | | issue #150
* Use thumbnails in EXIF tags; requirement for libexif is backBert Münnich2014-06-091-16/+32
|
* Fix build with giflib >= 5.1.0.Bartłomiej Piotrowski2014-05-271-0/+4
|
* Use a checkerboard background for alpha layer; fixes issue #138Bert Münnich2014-04-061-9/+21
|