]> granicus.if.org Git - libass/commitdiff
Make \shad, \xshad and \yshad animatable.
authorGrigori Goronzy <greg@blackbox>
Sat, 27 Jun 2009 20:48:48 +0000 (22:48 +0200)
committerGrigori Goronzy <greg@blackbox>
Sat, 27 Jun 2009 21:35:09 +0000 (23:35 +0200)
libass/ass_render.c

index 4ea7196d43652e9e0da53db6274f824787d3c87c..a9de0af5445ac6c61fe02fc31c64017525fca65f 100644 (file)
@@ -969,11 +969,17 @@ static char *parse_tag(ass_renderer_t *render_priv, char *p, double pwr)
     } else if (mystrcmp(&p, "xshad")) {
         double val;
         if (mystrtod(&p, &val))
-            render_priv->state.shadow_x = val;
+            val = render_priv->state.shadow_x * (1 - pwr) + val * pwr;
+        else
+            val = 0.;
+        render_priv->state.shadow_x = val;
     } else if (mystrcmp(&p, "yshad")) {
         double val;
         if (mystrtod(&p, &val))
-            render_priv->state.shadow_y = val;
+            val = render_priv->state.shadow_y * (1 - pwr) + val * pwr;
+        else
+            val = 0.;
+        render_priv->state.shadow_y = val;
     } else if (mystrcmp(&p, "fax")) {
         double val;
         if (mystrtod(&p, &val))
@@ -1421,12 +1427,13 @@ static char *parse_tag(ass_renderer_t *render_priv, char *p, double pwr)
                 render_priv->state.effect_timing;
         render_priv->state.effect_timing = val * 10;
     } else if (mystrcmp(&p, "shad")) {
-        int val;
-        if (mystrtoi(&p, &val))
-            render_priv->state.shadow_x = render_priv->state.shadow_y = val;
-        else
-            render_priv->state.shadow_x = render_priv->state.shadow_y = 
-                render_priv->state.style->Shadow;
+        double val;
+        if (mystrtod(&p, &val)) {
+            if (render_priv->state.shadow_x == render_priv->state.shadow_y)
+                val = render_priv->state.shadow_x * (1 - pwr) + val * pwr;
+        } else
+            val = 0.;
+        render_priv->state.shadow_x = render_priv->state.shadow_y = val;
     } else if (mystrcmp(&p, "pbo")) {
         int val = 0;
         mystrtoi(&p, &val);     // ignored