1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-14 06:42:58 +08:00

feat(math): add LV_ALIGN_UP macro (#5053)

Signed-off-by: Xu Xingliang <xuxingliang@xiaomi.com>
This commit is contained in:
Neo Xu 2023-12-20 17:07:27 +08:00 committed by GitHub
parent cdf97139ca
commit deb43a2333
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -399,8 +399,8 @@ static void draw_letter(lv_draw_unit_t * draw_unit, lv_draw_glyph_dsc_t * dsc,
}
uint32_t bitmap_size = lv_draw_buf_width_to_stride(g.box_w, LV_COLOR_FORMAT_A8) * g.box_h;
bitmap_size = (bitmap_size + 63) &
(~63); /*Round up to avoid many allocations if the next buffer is just slightly larger*/
/*Round up to avoid many allocations if the next buffer is just slightly larger*/
bitmap_size = LV_ALIGN_UP(bitmap_size, 64);
if(dsc->_bitmap_buf_size < bitmap_size) {
lv_draw_buf_free(dsc->_bitmap_buf_unaligned);
dsc->_bitmap_buf_unaligned = lv_draw_buf_malloc(bitmap_size, LV_COLOR_FORMAT_A8);

View File

@ -27,6 +27,9 @@ extern "C" {
#define LV_BEZIER_VAL_MAX (1L << LV_BEZIER_VAL_SHIFT) /**< Max time in Bezier functions (not [0..1] to use integers)*/
#define LV_BEZIER_VAL_FLOAT(f) ((int32_t)((f) * LV_BEZIER_VAL_MAX)) /**< Convert const float number cubic-bezier values to fix-point value*/
/*Align up value x to align, align must be a power of two*/
#define LV_ALIGN_UP(x, align) (((x) + ((align) - 1)) & ~((align) - 1))
/**********************
* TYPEDEFS
**********************/