summaryrefslogtreecommitdiffstats
path: root/image.c
diff options
context:
space:
mode:
authorBert <ber.t@gmx.com>2011-09-08 15:55:03 +0200
committerBert <ber.t@gmx.com>2011-09-08 15:58:30 +0200
commitfdbc5cf76b547e60395027e60011d9f301bbb776 (patch)
treefce5f56575f7d0eb7484d620158a4c6289acc8cd /image.c
parentbfab4dc328f580cc21c31ee3e4f53e1b8ca7c4ab (diff)
downloadnsxiv-fdbc5cf76b547e60395027e60011d9f301bbb776.tar.zst
Added EXIF_SUPPORT macro for optional dependency on libexif
Diffstat (limited to 'image.c')
-rw-r--r--image.c57
1 files changed, 32 insertions, 25 deletions
diff --git a/image.c b/image.c
index 486f78d..7774267 100644
--- a/image.c
+++ b/image.c
@@ -18,7 +18,10 @@
#include <string.h>
#include <unistd.h>
+
+#ifdef EXIF_SUPPORT
#include <libexif/exif-data.h>
+#endif
#ifdef GIF_SUPPORT
#include <stdlib.h>
@@ -38,6 +41,29 @@ enum { MIN_GIF_DELAY = 50 };
float zoom_min;
float zoom_max;
+void img_init(img_t *img, win_t *win) {
+ zoom_min = zoom_levels[0] / 100.0;
+ zoom_max = zoom_levels[ARRLEN(zoom_levels) - 1] / 100.0;
+
+ if (img) {
+ img->im = NULL;
+ img->multi.cap = img->multi.cnt = 0;
+ img->multi.animate = 0;
+ img->zoom = options->zoom;
+ img->zoom = MAX(img->zoom, zoom_min);
+ img->zoom = MIN(img->zoom, zoom_max);
+ img->aa = options->aa;
+ img->alpha = 1;
+ }
+
+ if (win) {
+ imlib_context_set_display(win->env.dpy);
+ imlib_context_set_visual(win->env.vis);
+ imlib_context_set_colormap(win->env.cmap);
+ }
+}
+
+#ifdef EXIF_SUPPORT
void exif_auto_orientate(const fileinfo_t *file) {
ExifData *ed;
ExifEntry *entry;
@@ -80,28 +106,7 @@ void exif_auto_orientate(const fileinfo_t *file) {
break;
}
}
-
-void img_init(img_t *img, win_t *win) {
- zoom_min = zoom_levels[0] / 100.0;
- zoom_max = zoom_levels[ARRLEN(zoom_levels) - 1] / 100.0;
-
- if (img) {
- img->im = NULL;
- img->multi.cap = img->multi.cnt = 0;
- img->multi.animate = 0;
- img->zoom = options->zoom;
- img->zoom = MAX(img->zoom, zoom_min);
- img->zoom = MIN(img->zoom, zoom_max);
- img->aa = options->aa;
- img->alpha = 1;
- }
-
- if (win) {
- imlib_context_set_display(win->env.dpy);
- imlib_context_set_visual(win->env.vis);
- imlib_context_set_colormap(win->env.cmap);
- }
-}
+#endif /* EXIF_SUPPORT */
#ifdef GIF_SUPPORT
/* Originally based on, but in its current form merely inspired by Imlib2's
@@ -285,14 +290,16 @@ int img_load(img_t *img, const fileinfo_t *file) {
imlib_context_set_anti_alias(img->aa);
fmt = imlib_image_format();
+ /* avoid unused-but-set-variable warning */
+ (void) fmt;
+
+#ifdef EXIF_SUPPORT
if (!strcmp(fmt, "jpeg"))
exif_auto_orientate(file);
+#endif
#ifdef GIF_SUPPORT
if (!strcmp(fmt, "gif"))
img_load_gif(img, file);
-#else
- /* avoid unused-but-set-variable warning */
- (void) fmt;
#endif
img->scalemode = options->scalemode;