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
562 return562 return
563 end563 end
564 564
565 local ass = assdraw.ass_new()
566
565 local osd_w, osd_h = get_scaled_osd_dimensions()567 local osd_w, osd_h = get_scaled_osd_dimensions()
566 568
567 local x = get_margin_x()569 local x = get_margin_x()
568 local y = osd_h * (1 - global_margins.b) - get_margin_y()570 local y = osd_h * (1 - global_margins.b) - get_margin_y()
569 571
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
570 local coordinate_top = math.floor(global_margins.t * osd_h + 0.5)576 local coordinate_top = math.floor(global_margins.t * osd_h + 0.5)
571 local clipping_coordinates = '0,' .. coordinate_top .. ',' ..577 local clipping_coordinates = '0,' .. coordinate_top .. ',' ..
572 osd_w .. ',' .. osd_h578 osd_w .. ',' .. osd_h
573 local ass = assdraw.ass_new()579
574 local font = get_font()
575 local style = '{\\r' ..580 local style = '{\\r' ..
576 (font and '\\fn' .. font or '') ..581 (font and '\\fn' .. font or '') ..
577 '\\fs' .. opts.font_size ..582 '\\fs' .. opts.font_size ..
578 '\\bord' .. opts.border_size .. '\\fsp0' ..583 '\\bord' .. opts.border_size .. '\\fsp0' ..
584 '\\blur' .. blur ..
579 (selectable_items and '\\q2' or '\\q1') ..585 (selectable_items and '\\q2' or '\\q1') ..
580 '\\clip(' .. clipping_coordinates .. ')}'586 '\\clip(' .. clipping_coordinates .. ')}'
587
581 -- Create the cursor glyph as an ASS drawing. ASS will draw the cursor588 -- Create the cursor glyph as an ASS drawing. ASS will draw the cursor
582 -- inline with the surrounding text, but it sets the advance to the width589 -- inline with the surrounding text, but it sets the advance to the width
583 -- of the drawing. So the cursor doesn't affect layout too much, make it as590 -- 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