aboutsummaryrefslogtreecommitdiff
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
parentbfab4dc328f580cc21c31ee3e4f53e1b8ca7c4ab (diff)
Added EXIF_SUPPORT macro for optional dependency on libexif
-rw-r--r--image.c57
-rw-r--r--thumbs.c15
2 files changed, 42 insertions, 30 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;
diff --git a/thumbs.c b/thumbs.c
index cede997..63f08d3 100644
--- a/thumbs.c
+++ b/thumbs.c
@@ -34,7 +34,9 @@
#define st_atim st_atimespec
#endif
+#ifdef EXIF_SUPPORT
void exif_auto_orientate(const fileinfo_t*);
+#endif
const int thumb_dim = THUMB_SIZE + 10;
char *cache_dir = NULL;
@@ -255,11 +257,14 @@ int tns_load(tns_t *tns, int n, const fileinfo_t *file,
imlib_context_set_image(im);
imlib_context_set_anti_alias(1);
- if (!cache_hit) {
- fmt = imlib_image_format();
- if (!strcmp(fmt, "jpeg"))
- exif_auto_orientate(file);
- }
+ fmt = imlib_image_format();
+ /* avoid unused-but-set-variable warning */
+ (void) fmt;
+
+#ifdef EXIF_SUPPORT
+ if (!cache_hit !strcmp(fmt, "jpeg"))
+ exif_auto_orientate(file);
+#endif
w = imlib_image_get_width();
h = imlib_image_get_height();