X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?p=xscreensaver;a=blobdiff_plain;f=hacks%2Fanalogtv.c;fp=hacks%2Fanalogtv.c;h=81e3823305e2fa656e505cf248cbab51c36df23f;hp=642037de54d6365f05055089efb0f9c26f694b8f;hb=39809ded547bdbb08207d3e514950425215b4410;hpb=4361b69d3178d7fc98d0388f9a223af6c2651aba diff --git a/hacks/analogtv.c b/hacks/analogtv.c index 642037de..81e38233 100644 --- a/hacks/analogtv.c +++ b/hacks/analogtv.c @@ -305,7 +305,8 @@ analogtv_configure(analogtv *it) /* If the window is very small, don't let the image we draw get lower than the actual TV resolution (266x200.) - If the aspect ratio of the window is close to a 4:3 or 16:9 ratio, + If the aspect ratio of the window is close to a 4:3 or 16:9 ratio -- + or if it is a completely weird aspect ratio -- then scale the image to exactly fill the window. Otherwise, center the image either horizontally or vertically, @@ -317,6 +318,8 @@ analogtv_configure(analogtv *it) float percent = 0.15; float min_ratio = 4.0 / 3.0 * (1 - percent); float max_ratio = 16.0 / 9.0 * (1 + percent); + float crazy_min_ratio = 10; + float crazy_max_ratio = 1/crazy_min_ratio; float ratio; float height_snap=0.025; @@ -370,6 +373,20 @@ analogtv_configure(analogtv *it) # endif } + if (ratio < crazy_min_ratio || ratio > crazy_max_ratio) + { + if (ratio < crazy_min_ratio) + hlim = it->xgwa.height; + else + wlim = it->xgwa.width; +# ifdef DEBUG + fprintf (stderr, + "size: aspect: %dx%d in %dx%d (%.3f < %.3f < %.3f)\n", + wlim, hlim, it->xgwa.width, it->xgwa.height, + min_ratio, ratio, max_ratio); +# endif + } + height_diff = ((hlim + ANALOGTV_VISLINES/2) % ANALOGTV_VISLINES) - ANALOGTV_VISLINES/2; if (height_diff != 0 && abs(height_diff) < hlim * height_snap)