changeset 19664:f6badf921e82

Add vertical clipping for subtitles that were moved because of a collision.
author eugeni
date Mon, 04 Sep 2006 17:55:57 +0000
parents 042680f89e7d
children 4ae116b5a5b2
files libass/ass_render.c
diffstat 1 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libass/ass_render.c	Mon Sep 04 17:52:28 2006 +0000
+++ b/libass/ass_render.c	Mon Sep 04 17:55:57 2006 +0000
@@ -1943,6 +1943,21 @@
 	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;