comparison libass/ass_render.c @ 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 48bdad54ac3f
comparison
equal deleted inserted replaced
19663:042680f89e7d 19664:f6badf921e82
1941 static void shift_event(event_images_t* ei, int shift) 1941 static void shift_event(event_images_t* ei, int shift)
1942 { 1942 {
1943 ass_image_t* cur = ei->imgs; 1943 ass_image_t* cur = ei->imgs;
1944 while (cur) { 1944 while (cur) {
1945 cur->dst_y += shift; 1945 cur->dst_y += shift;
1946 // clip top and bottom
1947 if (cur->dst_y < 0) {
1948 int clip = - cur->dst_y;
1949 cur->h -= clip;
1950 cur->bitmap += clip * cur->stride;
1951 cur->dst_y = 0;
1952 }
1953 if (cur->dst_y + cur->h >= frame_context.height) {
1954 int clip = cur->dst_y + cur->h - frame_context.height;
1955 cur->h -= clip;
1956 }
1957 if (cur->h <= 0) {
1958 cur->h = 0;
1959 cur->dst_y = 0;
1960 }
1946 cur = cur->next; 1961 cur = cur->next;
1947 } 1962 }
1948 ei->top += shift; 1963 ei->top += shift;
1949 } 1964 }
1950 1965