diff options
author | Niklas Haas <git@nand.wakku.to> | 2016-04-03 13:55:37 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2016-04-03 14:51:31 +0200 |
commit | c0e13d54a85663ff8ac87d2910f1688978ea1f60 (patch) | |
tree | 81b8e28c24afba262d390ce5a4966da0f7e76300 | |
parent | 669a3228a2d3c5d63e2dd3bd0564c1274d6f3748 (diff) |
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.
-rw-r--r-- | DOCS/interface-changes.rst | 1 | ||||
-rw-r--r-- | DOCS/man/options.rst | 10 | ||||
-rw-r--r-- | video/out/aspect.c | 3 |
3 files changed, 7 insertions, 7 deletions
diff --git a/DOCS/interface-changes.rst b/DOCS/interface-changes.rst index 532cc05bff..f884296707 100644 --- a/DOCS/interface-changes.rst +++ b/DOCS/interface-changes.rst @@ -27,6 +27,7 @@ Interface changes - add "cache-speed" property - rename --input-unix-socket to --input-ipc-server, and make it work on Windows too + - change the exact behavior of the "video-zoom" property --- mpv 0.16.0 --- - change --audio-channels default to stereo (use --audio-channels=auto to get the old default) diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst index a885648b95..7921ba6b0d 100644 --- a/DOCS/man/options.rst +++ b/DOCS/man/options.rst @@ -732,12 +732,10 @@ Video appear in files, but can't be handled properly by mpv. ``--video-zoom=<value>`` - Adjust the video display scale factor by the given value. The unit is in - fractions of the (scaled) window video size. - - For example, given a 1280x720 video shown in a 1280x720 window, - ``--video-zoom=-0.1`` would make the video by 128 pixels smaller in - X direction, and 72 pixels in Y direction. + Adjust the video display scale factor by the given value. The parameter is + given log 2. For example, ``--video-zoom=0`` is unscaled, + ``--video-zoom=1`` is twice the size, ``--video-zoom=-2`` is one fourth of + the size, and so on. This option is disabled if the ``--no-keepaspect`` option is used. 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; |