diff options
author | rcombs <rcombs@rcombs.me> | 2022-07-26 22:16:27 -0500 |
---|---|---|
committer | rcombs <rcombs@rcombs.me> | 2022-11-15 21:14:37 -0600 |
commit | 206043f48f020b7a65800ec7792c9cda98631e65 (patch) | |
tree | e52439f45c395bf92684fd7c3b9910b956a3ee55 | |
parent | c4c49c6f696499d5f6ce58dcb0c0f935d25ace74 (diff) | |
download | libass-206043f48f020b7a65800ec7792c9cda98631e65.tar.bz2 libass-206043f48f020b7a65800ec7792c9cda98631e65.tar.xz |
ass_render: take RenderContext* in reset_render_context()
-rw-r--r-- | libass/ass_parse.c | 4 | ||||
-rw-r--r-- | libass/ass_render.c | 64 | ||||
-rw-r--r-- | libass/ass_render.h | 2 |
3 files changed, 35 insertions, 35 deletions
diff --git a/libass/ass_parse.c b/libass/ass_parse.c index 6ef4a06..ee77aea 100644 --- a/libass/ass_parse.c +++ b/libass/ass_parse.c @@ -803,10 +803,10 @@ char *ass_parse_tags(ASS_Renderer *render_priv, char *p, char *end, double pwr, } else if (tag("r")) { if (nargs) { int len = args->end - args->start; - ass_reset_render_context(render_priv, + ass_reset_render_context(state, lookup_style_strict(render_priv->track, args->start, len)); } else - ass_reset_render_context(render_priv, NULL); + ass_reset_render_context(state, NULL); } else if (tag("be")) { double dval; if (nargs) { diff --git a/libass/ass_render.c b/libass/ass_render.c index f8a77c5..06a876b 100644 --- a/libass/ass_render.c +++ b/libass/ass_render.c @@ -1034,42 +1034,42 @@ static void init_font_scale(RenderContext *state) * \brief partially reset render_context to style values * Works like {\r}: resets some style overrides */ -void ass_reset_render_context(ASS_Renderer *render_priv, ASS_Style *style) +void ass_reset_render_context(RenderContext *state, ASS_Style *style) { - style = handle_selective_style_overrides(&render_priv->state, style); + style = handle_selective_style_overrides(state, style); - init_font_scale(&render_priv->state); + init_font_scale(state); - render_priv->state.c[0] = style->PrimaryColour; - render_priv->state.c[1] = style->SecondaryColour; - render_priv->state.c[2] = style->OutlineColour; - render_priv->state.c[3] = style->BackColour; - render_priv->state.flags = + state->c[0] = style->PrimaryColour; + state->c[1] = style->SecondaryColour; + state->c[2] = style->OutlineColour; + state->c[3] = style->BackColour; + state->flags = (style->Underline ? DECO_UNDERLINE : 0) | (style->StrikeOut ? DECO_STRIKETHROUGH : 0); - render_priv->state.font_size = style->FontSize; - - render_priv->state.family.str = style->FontName; - render_priv->state.family.len = strlen(style->FontName); - render_priv->state.treat_family_as_pattern = style->treat_fontname_as_pattern; - render_priv->state.bold = style->Bold; - render_priv->state.italic = style->Italic; - ass_update_font(&render_priv->state); - - render_priv->state.border_style = style->BorderStyle; - render_priv->state.border_x = style->Outline; - render_priv->state.border_y = style->Outline; - render_priv->state.scale_x = style->ScaleX; - render_priv->state.scale_y = style->ScaleY; - render_priv->state.hspacing = style->Spacing; - render_priv->state.be = 0; - render_priv->state.blur = style->Blur; - render_priv->state.shadow_x = style->Shadow; - render_priv->state.shadow_y = style->Shadow; - render_priv->state.frx = render_priv->state.fry = 0.; - render_priv->state.frz = style->Angle; - render_priv->state.fax = render_priv->state.fay = 0.; - render_priv->state.font_encoding = style->Encoding; + state->font_size = style->FontSize; + + state->family.str = style->FontName; + state->family.len = strlen(style->FontName); + state->treat_family_as_pattern = style->treat_fontname_as_pattern; + state->bold = style->Bold; + state->italic = style->Italic; + ass_update_font(state); + + state->border_style = style->BorderStyle; + state->border_x = style->Outline; + state->border_y = style->Outline; + state->scale_x = style->ScaleX; + state->scale_y = style->ScaleY; + state->hspacing = style->Spacing; + state->be = 0; + state->blur = style->Blur; + state->shadow_x = style->Shadow; + state->shadow_y = style->Shadow; + state->frx = state->fry = 0.; + state->frz = style->Angle; + state->fax = state->fay = 0.; + state->font_encoding = style->Encoding; } /** @@ -1109,7 +1109,7 @@ init_render_context(ASS_Renderer *render_priv, ASS_Event *event) render_priv->state.explicit = render_priv->state.evt_type != EVENT_NORMAL || ass_event_has_hard_overrides(event->Text); - ass_reset_render_context(render_priv, NULL); + ass_reset_render_context(&render_priv->state, NULL); render_priv->state.alignment = render_priv->state.style->Alignment; render_priv->state.justify = render_priv->state.style->Justify; } diff --git a/libass/ass_render.h b/libass/ass_render.h index 6438e48..cf0eb41 100644 --- a/libass/ass_render.h +++ b/libass/ass_render.h @@ -350,7 +350,7 @@ typedef struct { int y1; } Rect; -void ass_reset_render_context(ASS_Renderer *render_priv, ASS_Style *style); +void ass_reset_render_context(RenderContext *state, ASS_Style *style); void ass_frame_ref(ASS_Image *img); void ass_frame_unref(ASS_Image *img); ASS_Vector ass_layout_res(ASS_Renderer *render_priv); |