diff options
author | Oleg Oshmyan <chortos@inbox.lv> | 2022-02-12 18:54:40 +0200 |
---|---|---|
committer | Oleg Oshmyan <chortos@inbox.lv> | 2022-02-12 19:00:29 +0200 |
commit | fe7abffb6f5ad4658e5421ed71696b58c5d582a8 (patch) | |
tree | 35eab574dc7254582fb24d26cd1c7cf5fe5f0d95 | |
parent | 88cf01a448b1a14c8364294946f349af074c1969 (diff) | |
download | libass-fe7abffb6f5ad4658e5421ed71696b58c5d582a8.tar.bz2 libass-fe7abffb6f5ad4658e5421ed71696b58c5d582a8.tar.xz |
Round BorderStyle 4 box size equally in all directions
Current code uses fractional sizes and truncates the box's
coordinates to integers, so the box tends to be bigger
on the left and top than on the right and bottom.
Instead, lround() the sizes and add them symmetrically on all sides.
-rw-r--r-- | libass/ass_render.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/libass/ass_render.c b/libass/ass_render.c index 6991881..d5c931a 100644 --- a/libass/ass_render.c +++ b/libass/ass_render.c @@ -2582,10 +2582,10 @@ size_t ass_composite_construct(void *key, void *value, void *priv) static void add_background(ASS_Renderer *render_priv, EventImages *event_images) { - double size_x = render_priv->state.shadow_x > 0 ? - render_priv->state.shadow_x * render_priv->border_scale : 0; - double size_y = render_priv->state.shadow_y > 0 ? - render_priv->state.shadow_y * render_priv->border_scale : 0; + int size_x = render_priv->state.shadow_x > 0 ? + lround(render_priv->state.shadow_x * render_priv->border_scale) : 0; + int size_y = render_priv->state.shadow_y > 0 ? + lround(render_priv->state.shadow_y * render_priv->border_scale) : 0; int left = event_images->left - size_x; int top = event_images->top - size_y; int right = event_images->left + event_images->width + size_x; |