diff options
author | Dr.Smile <vabnick@gmail.com> | 2021-09-26 15:20:58 +0300 |
---|---|---|
committer | Dr.Smile <vabnick@gmail.com> | 2021-09-26 17:13:12 +0300 |
commit | 9c1268afb52412b530795c749115e365f74180ea (patch) | |
tree | 566c399951c351d2803ce044fa03f980ea1b6cb1 /libass | |
parent | 813237b76e3219294a87160407d51932e53d5721 (diff) | |
download | libass-9c1268afb52412b530795c749115e365f74180ea.tar.bz2 libass-9c1268afb52412b530795c749115e365f74180ea.tar.xz |
rasterizer: use correct memory alignment instead of magic number
Diffstat (limited to 'libass')
-rw-r--r-- | libass/ass_rasterizer.c | 6 | ||||
-rw-r--r-- | libass/ass_rasterizer.h | 2 | ||||
-rw-r--r-- | libass/ass_render.c | 3 |
3 files changed, 6 insertions, 5 deletions
diff --git a/libass/ass_rasterizer.c b/libass/ass_rasterizer.c index f55c757..0ae9e56 100644 --- a/libass/ass_rasterizer.c +++ b/libass/ass_rasterizer.c @@ -51,7 +51,7 @@ static inline int ilog2(uint32_t n) } -bool rasterizer_init(RasterizerData *rst, int tile_order, int outline_error) +bool rasterizer_init(const BitmapEngine *engine, RasterizerData *rst, int outline_error) { rst->outline_error = outline_error; rst->linebuf[0] = rst->linebuf[1] = NULL; @@ -59,7 +59,9 @@ bool rasterizer_init(RasterizerData *rst, int tile_order, int outline_error) rst->size[1] = rst->capacity[1] = 0; rst->n_first = 0; - rst->tile = ass_aligned_alloc(32, 1 << (2 * tile_order), false); + unsigned align = 1 << engine->align_order; + unsigned size = 1 << (2 * engine->tile_order); + rst->tile = ass_aligned_alloc(align, size, false); return rst->tile; } diff --git a/libass/ass_rasterizer.h b/libass/ass_rasterizer.h index f99205b..21c3420 100644 --- a/libass/ass_rasterizer.h +++ b/libass/ass_rasterizer.h @@ -56,7 +56,7 @@ typedef struct { uint8_t *tile; } RasterizerData; -bool rasterizer_init(RasterizerData *rst, int tile_order, int outline_error); +bool rasterizer_init(const BitmapEngine *engine, RasterizerData *rst, int outline_error); void rasterizer_done(RasterizerData *rst); /** diff --git a/libass/ass_render.c b/libass/ass_render.c index 5fcbe96..f986b97 100644 --- a/libass/ass_render.c +++ b/libass/ass_render.c @@ -85,8 +85,7 @@ ASS_Renderer *ass_renderer_init(ASS_Library *library) priv->engine = &ass_bitmap_engine_c; #endif - if (!rasterizer_init(&priv->rasterizer, priv->engine->tile_order, - RASTERIZER_PRECISION)) + if (!rasterizer_init(priv->engine, &priv->rasterizer, RASTERIZER_PRECISION)) goto fail; priv->cache.font_cache = ass_font_cache_create(); |