diff options
author | eugeni <eugeni@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2006-09-04 17:55:57 +0000 |
---|---|---|
committer | eugeni <eugeni@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2006-09-04 17:55:57 +0000 |
commit | d764df09de78c3c5c9740442d1031de82695f178 (patch) | |
tree | a88e3b2f8a87ae854dea2836c659d1afbda625ee /libass/ass_render.c | |
parent | 06ffbd9d7d36a00fc3f1521fef2d9b64ab8150c5 (diff) | |
download | mpv-d764df09de78c3c5c9740442d1031de82695f178.tar.bz2 mpv-d764df09de78c3c5c9740442d1031de82695f178.tar.xz |
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
Diffstat (limited to 'libass/ass_render.c')
-rw-r--r-- | libass/ass_render.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/libass/ass_render.c b/libass/ass_render.c index 0d774dd987..ded1d56c2f 100644 --- a/libass/ass_render.c +++ b/libass/ass_render.c @@ -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; |