fbff: fit the screen vertically if needed
authorAli Gholami Rudi <ali@rudi.ir>
Tue, 14 Feb 2012 18:53:50 +0000 (14 22:23 +0330)
committerAli Gholami Rudi <ali@rudi.ir>
Tue, 14 Feb 2012 18:53:50 +0000 (14 22:23 +0330)
Fitting the screen horizontally used to cut the lower parts of the
video.  This patch fits the screen vertically if this happens.

Suggested by Sara Fauzia <sfauzia@fas.harvard.edu>

fbff.c

diff --git a/fbff.c b/fbff.c
index 1c32b36..52e6252 100644 (file)
--- a/fbff.c
+++ b/fbff.c
@@ -391,8 +391,11 @@ int main(int argc, char *argv[])
                ffs_vinfo(vffs, &w, &h);
                if (magnify != 1 && sizeof(fbval_t) != FBM_BPP(fb_mode()))
                        fprintf(stderr, "fbff: magnify != 1 and fbval_t doesn't match\n");
-               if (fullscreen)
-                       zoom = (float) fb_cols() / w / magnify;
+               if (fullscreen) {
+                       float hz = (float) fb_rows() / h / magnify;
+                       float wz = (float) fb_cols() / w / magnify;
+                       zoom = hz < wz ? hz : wz;
+               }
                ffs_vsetup(vffs, zoom, fb_mode());
        }
        term_setup();