From fdbc5cf76b547e60395027e60011d9f301bbb776 Mon Sep 17 00:00:00 2001 From: Bert Date: Thu, 8 Sep 2011 15:55:03 +0200 Subject: Added EXIF_SUPPORT macro for optional dependency on libexif --- image.c | 57 ++++++++++++++++++++++++++++++++------------------------- 1 file changed, 32 insertions(+), 25 deletions(-) (limited to 'image.c') diff --git a/image.c b/image.c index 486f78d..7774267 100644 --- a/image.c +++ b/image.c @@ -18,7 +18,10 @@ #include #include + +#ifdef EXIF_SUPPORT #include +#endif #ifdef GIF_SUPPORT #include @@ -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; -- cgit v1.2.3-54-g00ecf