summaryrefslogtreecommitdiffstats
path: root/player/lua
diff options
context:
space:
mode:
authorChristoph Heinrich <christoph.heinrich@student.tugraz.at>2022-10-03 20:47:33 +0200
committerLeo Izen <leo.izen@gmail.com>2022-10-06 14:34:56 -0400
commitcc65b3892d89ae35d31067fba285ab20716a1aee (patch)
tree3aa1106525ac327e2339ed9a90addfa6c36004d3 /player/lua
parentd2a0791fe83d8382e06232e72549cab4e4c66130 (diff)
downloadmpv-cc65b3892d89ae35d31067fba285ab20716a1aee.tar.bz2
mpv-cc65b3892d89ae35d31067fba285ab20716a1aee.tar.xz
osc: scale rendered aspect ratio with window aspect ratio
The logo stays centered better and it doesn't distort anymore due to a recent change in libass https://github.com/libass/libass/pull/645
Diffstat (limited to 'player/lua')
-rw-r--r--player/lua/osc.lua10
1 files changed, 7 insertions, 3 deletions
diff --git a/player/lua/osc.lua b/player/lua/osc.lua
index fba6e881d7..67b6621256 100644
--- a/player/lua/osc.lua
+++ b/player/lua/osc.lua
@@ -2585,7 +2585,11 @@ function tick()
-- render idle message
msg.trace("idle message")
- local icon_x, icon_y = 320 - 26, 140
+ local _, _, display_aspect = mp.get_osd_size()
+ local display_h = 360
+ local display_w = display_h * display_aspect
+ -- logo is rendered at 2^(6-1) = 32 times resolution with size 1800x1800
+ local icon_x, icon_y = (display_w - 1800 / 32) / 2, 140
local line_prefix = ("{\\rDefault\\an7\\1a&H00&\\bord0\\shad0\\pos(%f,%f)}"):format(icon_x, icon_y)
local ass = assdraw.ass_new()
@@ -2607,11 +2611,11 @@ function tick()
if user_opts.idlescreen then
ass:new_event()
- ass:pos(320, icon_y+65)
+ ass:pos(display_w / 2, icon_y + 65)
ass:an(8)
ass:append("Drop files or URLs to play here.")
end
- set_osd(640, 360, ass.text)
+ set_osd(display_w, display_h, ass.text)
if state.showhide_enabled then
mp.disable_key_bindings("showhide")