mirror of https://github.com/mpv-player/mpv
video: report negative subtitle/OSD margins if necessary
Until now, it used only coordinates clipped to the screen for this, which meant no negative margins were ever reported to libass. This broke proper rendering of explicitly positioned ASS events (libass simply could not know the real video size in this case.) Fix this by reporting margins even if they're negative. This makes it apparently work correctly with vo_gpu at least. Note that I'm not really sure if anything in the rendering chain required non-negative margins. If so, and that code implicitly assumed it, I suppose crashes and such are possible.
This commit is contained in:
parent
30f6f27976
commit
537f011c6d
|
@ -90,6 +90,10 @@ static void src_dst_split_scaling(int src_size, int dst_size,
|
|||
*dst_start = (dst_size - scaled_src_size) * align + pan * scaled_src_size;
|
||||
*dst_end = *dst_start + scaled_src_size;
|
||||
|
||||
// Distance of screen frame to video
|
||||
*osd_margin_a = *dst_start;
|
||||
*osd_margin_b = dst_size - *dst_end;
|
||||
|
||||
// Clip to screen
|
||||
int s_src = *src_end - *src_start;
|
||||
int s_dst = *dst_end - *dst_start;
|
||||
|
@ -107,10 +111,6 @@ static void src_dst_split_scaling(int src_size, int dst_size,
|
|||
// For sanity: avoid bothering VOs with corner cases
|
||||
clamp_size(src_size, src_start, src_end);
|
||||
clamp_size(dst_size, dst_start, dst_end);
|
||||
|
||||
// Distance of screen frame to video
|
||||
*osd_margin_a = *dst_start;
|
||||
*osd_margin_b = dst_size - *dst_end;
|
||||
}
|
||||
|
||||
static void calc_margin(float opts[2], int out[2], int size)
|
||||
|
|
Loading…
Reference in New Issue