diff options
author | Grigori Goronzy <greg@blackbox> | 2011-07-04 12:59:11 +0200 |
---|---|---|
committer | Grigori Goronzy <greg@blackbox> | 2011-07-04 12:59:11 +0200 |
commit | 53288ab83600d57f6082815183c068ab21959037 (patch) | |
tree | ad7ab95115d80c3f48f572b0e2c327c82f93086b /libass/ass_parse.c | |
parent | 0a539d83afef27b64228f5abd8f21c6e15972b0c (diff) | |
download | libass-53288ab83600d57f6082815183c068ab21959037.tar.bz2 libass-53288ab83600d57f6082815183c068ab21959037.tar.xz |
Introduce bitmap runs
Prepare for run-based rendering. In the parser, increment a run id
according to relevant style changes (color, border, shadow, etc.) to
mark the points where a new bitmap needs to be started. Modify the line
wrapper to increment the run ids of each glyph after a break.
Add functions to calculate the render size of runs for rasterization.
Diffstat (limited to 'libass/ass_parse.c')
-rw-r--r-- | libass/ass_parse.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/libass/ass_parse.c b/libass/ass_parse.c index d9fcb76..a0181bd 100644 --- a/libass/ass_parse.c +++ b/libass/ass_parse.c @@ -255,6 +255,7 @@ static char *parse_tag(ASS_Renderer *render_priv, char *p, double pwr) else val = -1.; change_border(render_priv, val, render_priv->state.border_y); + render_priv->state.bm_run_id++; } else if (mystrcmp(&p, "ybord")) { double val; if (mystrtod(&p, &val)) @@ -269,6 +270,7 @@ static char *parse_tag(ASS_Renderer *render_priv, char *p, double pwr) else val = 0.; render_priv->state.shadow_x = val; + render_priv->state.bm_run_id++; } else if (mystrcmp(&p, "yshad")) { double val; if (mystrtod(&p, &val)) @@ -276,6 +278,7 @@ static char *parse_tag(ASS_Renderer *render_priv, char *p, double pwr) else val = 0.; render_priv->state.shadow_y = val; + render_priv->state.bm_run_id++; } else if (mystrcmp(&p, "fax")) { double val; if (mystrtod(&p, &val)) @@ -327,6 +330,7 @@ static char *parse_tag(ASS_Renderer *render_priv, char *p, double pwr) render_priv->state.blur = val; } else render_priv->state.blur = 0.0; + render_priv->state.bm_run_id++; // ASS standard tags } else if (mystrcmp(&p, "fsc")) { char tp = *p++; @@ -387,6 +391,7 @@ static char *parse_tag(ASS_Renderer *render_priv, char *p, double pwr) } else val = -1.; // reset to default change_border(render_priv, val, val); + render_priv->state.bm_run_id++; } else if (mystrcmp(&p, "move")) { double x1, x2, y1, y2; long long t1, t2, delta_t, t; @@ -488,6 +493,7 @@ static char *parse_tag(ASS_Renderer *render_priv, char *p, double pwr) change_alpha(&render_priv->state.c[3], render_priv->state.style->BackColour, pwr); } + render_priv->state.bm_run_id++; // FIXME: simplify } else if (mystrcmp(&p, "an")) { int val; @@ -678,6 +684,7 @@ static char *parse_tag(ASS_Renderer *render_priv, char *p, double pwr) val = render_priv->state.style->PrimaryColour; ass_msg(render_priv->library, MSGL_DBG2, "color: %X", val); change_color(&render_priv->state.c[0], val, pwr); + render_priv->state.bm_run_id++; } else if ((*p >= '1') && (*p <= '4') && (++p) && (mystrcmp(&p, "c") || mystrcmp(&p, "a"))) { char n = *(p - 2); @@ -707,9 +714,11 @@ static char *parse_tag(ASS_Renderer *render_priv, char *p, double pwr) switch (cmd) { case 'c': change_color(render_priv->state.c + cidx, val, pwr); + render_priv->state.bm_run_id++; break; case 'a': change_alpha(render_priv->state.c + cidx, val >> 24, pwr); + render_priv->state.bm_run_id++; break; default: ass_msg(render_priv->library, MSGL_WARN, "Bad command: %c%c", @@ -729,6 +738,7 @@ static char *parse_tag(ASS_Renderer *render_priv, char *p, double pwr) render_priv->state.be = val; } else render_priv->state.be = 0; + render_priv->state.bm_run_id++; } else if (mystrcmp(&p, "b")) { int b; if (mystrtoi(&p, &b)) { @@ -777,18 +787,21 @@ static char *parse_tag(ASS_Renderer *render_priv, char *p, double pwr) } else val = 0.; render_priv->state.shadow_x = render_priv->state.shadow_y = val; + render_priv->state.bm_run_id++; } else if (mystrcmp(&p, "s")) { int val; if (mystrtoi(&p, &val) && val) render_priv->state.flags |= DECO_STRIKETHROUGH; else render_priv->state.flags &= ~DECO_STRIKETHROUGH; + render_priv->state.bm_run_id++; } else if (mystrcmp(&p, "u")) { int val; if (mystrtoi(&p, &val) && val) render_priv->state.flags |= DECO_UNDERLINE; else render_priv->state.flags &= ~DECO_UNDERLINE; + render_priv->state.bm_run_id++; } else if (mystrcmp(&p, "pbo")) { double val = 0; if (mystrtod(&p, &val)) |