summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrcombs <rcombs@rcombs.me>2022-07-26 22:22:07 -0500
committerrcombs <rcombs@rcombs.me>2022-11-15 21:14:37 -0600
commitb5a5175a5bc84d7bce9ac8b18ab693b7fa115ea6 (patch)
treed8183c33b876a5495459085331dd17697c49cc1e
parent5c9aed60d6bc6780c053916976179af0135c871a (diff)
downloadlibass-b5a5175a5bc84d7bce9ac8b18ab693b7fa115ea6.tar.bz2
libass-b5a5175a5bc84d7bce9ac8b18ab693b7fa115ea6.tar.xz
ass_parse: take RenderContext* in process_karaoke_effects()
-rw-r--r--libass/ass_parse.c17
-rw-r--r--libass/ass_parse.h2
-rw-r--r--libass/ass_render.c5
3 files changed, 13 insertions, 11 deletions
diff --git a/libass/ass_parse.c b/libass/ass_parse.c
index 350797c..2b28401 100644
--- a/libass/ass_parse.c
+++ b/libass/ass_parse.c
@@ -1020,19 +1020,20 @@ void ass_apply_transition_effects(RenderContext *state)
* 2. sets effect_timing for all glyphs to x coordinate of the border line between the left and right karaoke parts
* (left part is filled with PrimaryColour, right one - with SecondaryColour).
*/
-void ass_process_karaoke_effects(ASS_Renderer *render_priv)
+void ass_process_karaoke_effects(RenderContext *state)
{
- long long tm_current = render_priv->time - render_priv->state.event->Start;
+ TextInfo *text_info = state->text_info;
+ long long tm_current = state->renderer->time - state->event->Start;
int32_t timing = 0, skip_timing = 0;
Effect effect_type = EF_NONE;
GlyphInfo *last_boundary = NULL;
bool has_reset = false;
- for (int i = 0; i <= render_priv->text_info.length; i++) {
- if (i < render_priv->text_info.length &&
- !render_priv->text_info.glyphs[i].starts_new_run) {
+ for (int i = 0; i <= text_info->length; i++) {
+ if (i < text_info->length &&
+ !text_info->glyphs[i].starts_new_run) {
- if (render_priv->text_info.glyphs[i].reset_effect) {
+ if (text_info->glyphs[i].reset_effect) {
has_reset = true;
skip_timing = 0;
}
@@ -1041,12 +1042,12 @@ void ass_process_karaoke_effects(ASS_Renderer *render_priv)
// break, subsequent text is still part of the same karaoke word,
// the current word's starting and ending time stay unchanged,
// but the starting time of the next karaoke word is advanced.
- skip_timing += (uint32_t) render_priv->text_info.glyphs[i].effect_skip_timing;
+ skip_timing += (uint32_t) text_info->glyphs[i].effect_skip_timing;
continue;
}
GlyphInfo *start = last_boundary;
- GlyphInfo *end = render_priv->text_info.glyphs + i;
+ GlyphInfo *end = text_info->glyphs + i;
last_boundary = end;
if (!start)
continue;
diff --git a/libass/ass_parse.h b/libass/ass_parse.h
index d16d730..6c96eb1 100644
--- a/libass/ass_parse.h
+++ b/libass/ass_parse.h
@@ -30,7 +30,7 @@
void ass_update_font(RenderContext *state);
void ass_apply_transition_effects(RenderContext *state);
-void ass_process_karaoke_effects(ASS_Renderer *render_priv);
+void ass_process_karaoke_effects(RenderContext *state);
unsigned ass_get_next_char(RenderContext *state, char **str);
char *ass_parse_tags(RenderContext *state, char *p, char *end, double pwr,
bool nested);
diff --git a/libass/ass_render.c b/libass/ass_render.c
index 487bee4..b0d7792 100644
--- a/libass/ass_render.c
+++ b/libass/ass_render.c
@@ -2792,7 +2792,8 @@ ass_render_event(ASS_Renderer *render_priv, ASS_Event *event,
return false;
}
- free_render_context(&render_priv->state);
+ RenderContext *state = &render_priv->state;
+ free_render_context(state);
init_render_context(render_priv, event);
if (!parse_events(render_priv, event))
@@ -2840,7 +2841,7 @@ ass_render_event(ASS_Renderer *render_priv, ASS_Event *event,
wrap_lines_smart(render_priv, max_text_width);
// depends on glyph x coordinates being monotonous within runs, so it should be done before reorder
- ass_process_karaoke_effects(render_priv);
+ ass_process_karaoke_effects(state);
reorder_text(render_priv);