From cb985b51683dcbff5671cf9abc65b1b0825b2e75 Mon Sep 17 00:00:00 2001 From: Oleg Oshmyan Date: Tue, 31 Jan 2017 00:11:49 +0200 Subject: Reduce precision of border width in outline cache keys The value used to generate outline cache values is 26.6, so there is no point in storing the more precise 16.16 in the cache key. Indeed, this can only reduce the efficiency of the cache and provide an extra opportunity for overflow. --- libass/ass_cache_template.h | 2 +- libass/ass_render.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'libass') diff --git a/libass/ass_cache_template.h b/libass/ass_cache_template.h index 834dafe..9d81231 100644 --- a/libass/ass_cache_template.h +++ b/libass/ass_cache_template.h @@ -90,7 +90,7 @@ START(glyph, glyph_hash_key) GENERIC(int, italic) GENERIC(unsigned, scale_x) // 16.16 GENERIC(unsigned, scale_y) // 16.16 - FTVECTOR(outline) // border width, 16.16 + FTVECTOR(outline) // border width, 26.6 GENERIC(unsigned, flags) // glyph decoration flags GENERIC(unsigned, border_style) GENERIC(int, hspacing) // 16.16 diff --git a/libass/ass_render.c b/libass/ass_render.c index 558f504..046ab57 100644 --- a/libass/ass_render.c +++ b/libass/ass_render.c @@ -1084,8 +1084,8 @@ fill_glyph_hash(ASS_Renderer *priv, OutlineHashKey *outline_key, outline_key->type = OUTLINE_DRAWING; key->scale_x = double_to_d16(info->scale_x); key->scale_y = double_to_d16(info->scale_y); - key->outline.x = double_to_d16(info->border_x * priv->border_scale); - key->outline.y = double_to_d16(info->border_y * priv->border_scale); + key->outline.x = double_to_d6(info->border_x * priv->border_scale); + key->outline.y = double_to_d6(info->border_y * priv->border_scale); key->border_style = info->border_style; // hpacing only matters for opaque box borders (see draw_opaque_box), // so for normal borders, maximize cache utility by ignoring it @@ -1106,8 +1106,8 @@ fill_glyph_hash(ASS_Renderer *priv, OutlineHashKey *outline_key, key->italic = info->italic; key->scale_x = double_to_d16(info->scale_x); key->scale_y = double_to_d16(info->scale_y); - key->outline.x = double_to_d16(info->border_x * priv->border_scale); - key->outline.y = double_to_d16(info->border_y * priv->border_scale); + key->outline.x = double_to_d6(info->border_x * priv->border_scale); + key->outline.y = double_to_d6(info->border_y * priv->border_scale); key->flags = info->flags; key->border_style = info->border_style; key->hspacing = -- cgit v1.2.3