changeset 19044:96bd8ce93786

Support 6 argument variant of \move.
author eugeni
date Wed, 12 Jul 2006 22:28:20 +0000
parents fc0b6b0ba74f
children 9b94255a50b4
files libass/ass_render.c
diffstat 1 files changed, 20 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/libass/ass_render.c	Wed Jul 12 21:25:23 2006 +0000
+++ b/libass/ass_render.c	Wed Jul 12 22:28:20 2006 +0000
@@ -653,7 +653,7 @@
 		change_border(val);
 	} else if (mystrcmp(&p, "move")) {
 		int x1, x2, y1, y2;
-		long long t1, delta_t, t;
+		long long t1, t2, delta_t, t;
 		int x, y;
 		double k;
 		skip('(');
@@ -664,12 +664,25 @@
 		x2 = strtol(p, &p, 10);
 		skip(',');
 		y2 = strtol(p, &p, 10);
-		skip(')'); // FIXME: 2 more optional args
-		mp_msg(MSGT_GLOBAL, MSGL_DBG2, "movement: (%d, %d) -> (%d, %d)\n", x1, y1, x2, y2);
-		t1 = render_context.event->Start;
-		delta_t = render_context.event->Duration;
-		t = frame_context.time; // FIXME: move to render_context
-		k = ((double)(t - t1)) / delta_t;
+		if (*p == ',') {
+			skip(',');
+			t1 = strtoll(p, &p, 10);
+			skip(',');
+			t2 = strtoll(p, &p, 10);
+			mp_msg(MSGT_GLOBAL, MSGL_DBG2, "movement6: (%d, %d) -> (%d, %d), (%lld .. %lld)\n", x1, y1, x2, y2, t1, t2);
+		} else {
+			t1 = 0;
+			t2 = render_context.event->Duration;
+			mp_msg(MSGT_GLOBAL, MSGL_DBG2, "movement: (%d, %d) -> (%d, %d)\n", x1, y1, x2, y2);
+		}
+		skip(')');
+		delta_t = t2 - t1;
+		t = frame_context.time - render_context.event->Start;
+		if (t < t1)
+			k = 0.;
+		else if (t > t2)
+			k = 1.;
+		else k = ((double)(t - t1)) / delta_t;
 		x = k * (x2 - x1) + x1;
 		y = k * (y2 - y1) + y1;
 		render_context.pos_x = x;