summaryrefslogtreecommitdiffstats
path: root/video/out/aspect.c
diff options
context:
space:
mode:
authorNiklas Haas <git@nand.wakku.to>2016-04-03 13:55:37 +0200
committerwm4 <wm4@nowhere>2016-04-03 14:51:31 +0200
commitc0e13d54a85663ff8ac87d2910f1688978ea1f60 (patch)
tree81b8e28c24afba262d390ce5a4966da0f7e76300 /video/out/aspect.c
parent669a3228a2d3c5d63e2dd3bd0564c1274d6f3748 (diff)
downloadmpv-c0e13d54a85663ff8ac87d2910f1688978ea1f60.tar.bz2
mpv-c0e13d54a85663ff8ac87d2910f1688978ea1f60.tar.xz
aspect: make video-zoom logarithmic
The past behavior was a bit weird, especially when zooming out. There was no simple way to zoom in or out in consistent increments using keybindings alone. The new behavior preserves most of the old behavior's semantics but scales out to infinity better. It coincidentally also makes it really easy to get clean power of 2 ratios (e.g. 2x, 4x, 8x and their inverses). Fixes #3004.
Diffstat (limited to 'video/out/aspect.c')
-rw-r--r--video/out/aspect.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/video/out/aspect.c b/video/out/aspect.c
index 2d25bbdfd5..f3ba21c02e 100644
--- a/video/out/aspect.c
+++ b/video/out/aspect.c
@@ -17,6 +17,7 @@
/* Stuff for correct aspect scaling. */
#include "aspect.h"
+#include "math.h"
#include "vo.h"
#include "common/msg.h"
#include "options/options.h"
@@ -84,7 +85,7 @@ static void src_dst_split_scaling(int src_size, int dst_size,
zoom = 0.0;
}
- scaled_src_size += zoom * scaled_src_size;
+ scaled_src_size *= powf(2, zoom);
align = (align + 1) / 2;
*src_start = 0;