summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2020-03-26 11:36:37 +0100
committerOleg Oshmyan <chortos@inbox.lv>2020-07-05 21:25:52 +0300
commit4698e1474a573659cfe97ebde3335ef4f4c48237 (patch)
treeb91a178e2c4744ae7e8810ac7384ca028ec75c24
parent5421fbc999f68e8bf2ada00ef4f59f23e7756567 (diff)
downloadlibass-4698e1474a573659cfe97ebde3335ef4f4c48237.tar.bz2
libass-4698e1474a573659cfe97ebde3335ef4f4c48237.tar.xz
renderer: remove bogus clip rect for unclipped subtitles
Normal subtitles in use_margins mode, which do not have \clip tags or similar, were clipped in a nonsensical way. It was especially visible when moving subtitles up with ass_set_line_position(). This happened because state.clip_* is initialized with a clipping rectangle for the video area. Later it tries to translate the clipping rect accordingly, but this does not make much sense if you account for the margins. Just reset the clipping rect to the screen in these cases. explicit=0 is enough to know that the clipping rect was never explicitly set.
-rw-r--r--libass/ass_render.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libass/ass_render.c b/libass/ass_render.c
index fc32e07..1a92717 100644
--- a/libass/ass_render.c
+++ b/libass/ass_render.c
@@ -2730,6 +2730,12 @@ ass_render_event(ASS_Renderer *render_priv, ASS_Event *event,
render_priv->state.clip_y0 = render_priv->state.clip_y0 < zy ? zy : render_priv->state.clip_y0;
render_priv->state.clip_x1 = render_priv->state.clip_x1 > sx ? sx : render_priv->state.clip_x1;
render_priv->state.clip_y1 = render_priv->state.clip_y1 > sy ? sy : render_priv->state.clip_y1;
+ } else if (render_priv->settings.use_margins) {
+ // no \clip (explicit==0) and use_margins => only clip to screen with margins
+ render_priv->state.clip_x0 = 0;
+ render_priv->state.clip_y0 = 0;
+ render_priv->state.clip_x1 = render_priv->settings.frame_width;
+ render_priv->state.clip_y1 = render_priv->settings.frame_height;
}
calculate_rotation_params(render_priv, &bbox, device_x, device_y);