diff options
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; |