diff options
author | Oleg Oshmyan <chortos@inbox.lv> | 2020-10-16 18:48:03 +0300 |
---|---|---|
committer | Oleg Oshmyan <chortos@inbox.lv> | 2020-10-27 01:24:26 +0200 |
commit | 8c114f64cdf76c26161a6618df123a119d4a1ed7 (patch) | |
tree | c5f8776433091b6543417ea4eba850505c17ffb3 /libass | |
parent | b4303ad8c2142b8bdbedebb381a8ad4e6cd4feda (diff) | |
download | libass-8c114f64cdf76c26161a6618df123a119d4a1ed7.tar.bz2 libass-8c114f64cdf76c26161a6618df123a119d4a1ed7.tar.xz |
Delay angle conversion to radians until the last moment
This allows decisions based on the angle values to be
slightly more accurate and might save us a few flops.
Diffstat (limited to 'libass')
-rw-r--r-- | libass/ass_parse.c | 5 | ||||
-rw-r--r-- | libass/ass_render.c | 12 |
2 files changed, 9 insertions, 8 deletions
diff --git a/libass/ass_parse.c b/libass/ass_parse.c index 5666ca6..a19037b 100644 --- a/libass/ass_parse.c +++ b/libass/ass_parse.c @@ -495,7 +495,6 @@ char *parse_tags(ASS_Renderer *render_priv, char *p, char *end, double pwr, double val; if (nargs) { val = argtod(*args); - val *= M_PI / 180; render_priv->state.frx = val * pwr + render_priv->state.frx * (1 - pwr); } else @@ -504,7 +503,6 @@ char *parse_tags(ASS_Renderer *render_priv, char *p, char *end, double pwr, double val; if (nargs) { val = argtod(*args); - val *= M_PI / 180; render_priv->state.fry = val * pwr + render_priv->state.fry * (1 - pwr); } else @@ -513,12 +511,11 @@ char *parse_tags(ASS_Renderer *render_priv, char *p, char *end, double pwr, double val; if (nargs) { val = argtod(*args); - val *= M_PI / 180; render_priv->state.frz = val * pwr + render_priv->state.frz * (1 - pwr); } else render_priv->state.frz = - M_PI * render_priv->state.style->Angle / 180.; + render_priv->state.style->Angle; } else if (tag("fn")) { char *family; char *start = args->start; diff --git a/libass/ass_render.c b/libass/ass_render.c index 0ef7158..64dde4d 100644 --- a/libass/ass_render.c +++ b/libass/ass_render.c @@ -1019,7 +1019,7 @@ void reset_render_context(ASS_Renderer *render_priv, ASS_Style *style) 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 = M_PI * style->Angle / 180.; + render_priv->state.frz = style->Angle; render_priv->state.fax = render_priv->state.fay = 0.; render_priv->state.font_encoding = style->Encoding; } @@ -1248,9 +1248,13 @@ size_t ass_outline_construct(void *key, void *value, void *priv) static void calc_transform_matrix(ASS_Renderer *render_priv, GlyphInfo *info, double m[3][3]) { - double sx = -sin(info->frx), cx = cos(info->frx); - double sy = sin(info->fry), cy = cos(info->fry); - double sz = -sin(info->frz), cz = cos(info->frz); + double frx = M_PI / 180 * info->frx; + double fry = M_PI / 180 * info->fry; + double frz = M_PI / 180 * info->frz; + + double sx = -sin(frx), cx = cos(frx); + double sy = sin(fry), cy = cos(fry); + double sz = -sin(frz), cz = cos(frz); double fax = info->fax * info->scale_x / info->scale_y; double fay = info->fay * info->scale_y / info->scale_x; |