File xscreensaver-zoom-heuristics.diff of Package xscreensaver
# From: garloff@usse.de
# Subject: [3/4] Adapt zoom heuristics
# Change the zoo heuristics a bit;
# - Zooming in does match better how the human visul recognition works
# so make this happen in 75% of the cases (as opposed to 50%).
# - Make the zoomed out state closer to 100%, so we get to see most
# of the picture (assuming the photographer typically has not too
# much unneeded space at the edges.
# - Zoom in a bit more if we have a mismatch of portrait/landscape format
# between screen and picture, to mitigate the letterbox effect a bit.
Index: xscreensaver-5.22/hacks/glx/glslideshow.c
===================================================================
--- xscreensaver-5.22.orig/hacks/glx/glslideshow.c
+++ xscreensaver-5.22/hacks/glx/glslideshow.c
@@ -491,8 +491,10 @@ randomize_sprite (ModeInfo *mi, sprite *
int img_w = sp->img->geom.width * zoom/MAGNIF;
int img_h = sp->img->geom.height * zoom/MAGNIF;
int min_w, max_w;
double ratio = (double) img_h / img_w;
+ /* Zoom in more if portrait/landscape of visual and image differ */
+ double zfact = ((vp_w > vp_h) ^ (img_w > img_h))? 0.4: 0.5;
if (letterbox_p)
{
min_w = img_w;
@@ -506,10 +508,10 @@ randomize_sprite (ModeInfo *mi, sprite *
}
max_w = min_w * 100 / zoom;
- sp->from.w = min_w + frand ((max_w - min_w) * 0.4);
- sp->to.w = max_w - frand ((max_w - min_w) * 0.4);
+ sp->from.w = min_w + frand ((max_w - min_w) * 0.15);
+ sp->to.w = max_w - frand ((max_w - min_w) * zfact);
sp->from.h = sp->from.w * ratio;
sp->to.h = sp->to.w * ratio;
if (zoom == 100) /* only one box, and it is centered */
@@ -537,9 +539,9 @@ randomize_sprite (ModeInfo *mi, sprite *
? -frand (sp->to.h - vp_h)
: frand (vp_h - sp->to.h));
}
- if (random() & 1)
+ if (!(random() & 3))
{
rect swap = sp->to;
sp->to = sp->from;
sp->from = swap;