mirror of https://github.com/mpv-player/mpv
Add vertical clipping for subtitles that were moved because of a collision.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@19670 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
06ffbd9d7d
commit
d764df09de
|
@ -1943,6 +1943,21 @@ static void shift_event(event_images_t* ei, int shift)
|
|||
ass_image_t* cur = ei->imgs;
|
||||
while (cur) {
|
||||
cur->dst_y += shift;
|
||||
// clip top and bottom
|
||||
if (cur->dst_y < 0) {
|
||||
int clip = - cur->dst_y;
|
||||
cur->h -= clip;
|
||||
cur->bitmap += clip * cur->stride;
|
||||
cur->dst_y = 0;
|
||||
}
|
||||
if (cur->dst_y + cur->h >= frame_context.height) {
|
||||
int clip = cur->dst_y + cur->h - frame_context.height;
|
||||
cur->h -= clip;
|
||||
}
|
||||
if (cur->h <= 0) {
|
||||
cur->h = 0;
|
||||
cur->dst_y = 0;
|
||||
}
|
||||
cur = cur->next;
|
||||
}
|
||||
ei->top += shift;
|
||||
|
|
Loading…
Reference in New Issue