History

console.lua: use the same blur amount as --osd-blur

I have no idea why, but console's blur is smaller than in OSD messages and stats (regardless of persistent_overlay). It's smaller regardless of scale_with_window, or if using 0 PlayRes like stats with persistent_overlay=yes. With scale_with_window=yes, multiplying the blur by 2.5 seems to make it the same. This is probably because 2.5 is 720 / 288, which are the base height sizes scale from and the OSD's PlayResY. With scale_with_window=no, we need to multiply by osd_h, which is always 720 with scale_with_window=yes.

Guido Cella committed 1 year ago

Commit 04c328f1 parent 51dc6281 file · +9 −2Browse files

Unified · Split

player/lua/console.lua+9−2
@@ -562,22 +562,29 @@ local function render() · 561 unmodified lines
562562 return
563563 end
564564
565+ local ass = assdraw.ass_new()
566+
565567 local osd_w, osd_h = get_scaled_osd_dimensions()
566568
567569 local x = get_margin_x()
568570 local y = osd_h * (1 - global_margins.b) - get_margin_y()
569571
572+ local font = get_font()
573+ -- Use the same blur value as the rest of the OSD. 288 is the OSD's
574+ -- PlayResY.
575+ local blur = mp.get_property_native('osd-blur') * osd_h / 288
570576 local coordinate_top = math.floor(global_margins.t * osd_h + 0.5)
571577 local clipping_coordinates = '0,' .. coordinate_top .. ',' ..
572578 osd_w .. ',' .. osd_h
573− local ass = assdraw.ass_new()
574− local font = get_font()
579+
575580 local style = '{\\r' ..
576581 (font and '\\fn' .. font or '') ..
577582 '\\fs' .. opts.font_size ..
578583 '\\bord' .. opts.border_size .. '\\fsp0' ..
584+ '\\blur' .. blur ..
579585 (selectable_items and '\\q2' or '\\q1') ..
580586 '\\clip(' .. clipping_coordinates .. ')}'
587+
581588 -- Create the cursor glyph as an ASS drawing. ASS will draw the cursor
582589 -- inline with the surrounding text, but it sets the advance to the width
583590 -- of the drawing. So the cursor doesn't affect layout too much, make it as

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t