+ int tw, th, pct;
+
+ /* If the window is a goofy aspect ratio, take a middle slice of
+ the image instead. */
+ if (dest_w > dest_h * 5 || dest_h > dest_w * 5)
+ {
+ double r2 = (dest_w > dest_h
+ ? dest_w / (double) dest_h
+ : dest_h / (double) dest_w);
+ r *= r2;
+ if (verbose_p)
+ fprintf (stderr, "%s: weird aspect: scaling by %.1f\n",
+ progname, r2);
+ }
+
+ tw = src_w * r;
+ th = src_h * r;
+ pct = (r * 100);