From 8f8aef70a5049573864be5caf92304ecbac9f0ea Mon Sep 17 00:00:00 2001
From: Daniel Friesel <derf@finalrewind.org>
Date: Sat, 22 Jan 2011 20:47:19 +0100
Subject: Implement --zoom max (zoom like --bg-max)

---
 src/winwidget.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/winwidget.c b/src/winwidget.c
index 8192700..e918cd3 100644
--- a/src/winwidget.c
+++ b/src/winwidget.c
@@ -426,7 +426,7 @@ void winwidget_render_image(winwidget winwid, int resize, int alias)
 		smaller = ((winwid->im_w < max_w)
 			   && (winwid->im_h < max_h));
 
-		if (!smaller || (opt.zoom_mode == ZOOM_MODE_FILL)) {
+		if (!smaller || opt.zoom_mode) {
 			double ratio = 0.0;
 
 			/* Image is larger than the screen (so wants shrinking), or it's
@@ -580,6 +580,9 @@ double feh_calc_needed_zoom(double *zoom, int orig_w, int orig_h, int dest_w, in
 
 	ratio = ((double) orig_w / orig_h) / ((double) dest_w / dest_h);
 
+	if (opt.zoom_mode == ZOOM_MODE_MAX)
+		ratio = 1.0 / ratio;
+
 	if (ratio > 1.0)
 		*zoom = ((double) dest_w / orig_w);
 	else
-- 
cgit v1.2.3