fix(draw_buf): use LV_ROUND_UP to align draw buffer address

From test config lv_test_conf.h:

/*Use non power of 2 to avoid the case when `malloc` returns aligned pointer by default, and use a large value be sure any issues will cause crash*/
\#define LV_DRAW_BUF_ALIGN                       852

We need to support non-power-of-2 draw buffer alignement.
Introduce LV_ROUND_UP in lv_math.h and use it instead.

Signed-off-by: Xu Xingliang <xuxingliang@xiaomi.com>
This commit is contained in:
Xu Xingliang
2024-04-22 14:08:28 +08:00
committed by Neo Xu
parent 5894d53840
commit 79b64c8bd8
2 changed files with 5 additions and 2 deletions

View File

@@ -29,6 +29,9 @@ extern "C" {
/*Align up value x to align, align must be a power of two*/
#define LV_ALIGN_UP(x, align) (((x) + ((align) - 1)) & ~((align) - 1))
/*Round up value x to round, round can be any integer number*/
#define LV_ROUND_UP(x, round) ((((x) + ((round) - 1)) / (round)) * (round))
/**********************
* TYPEDEFS
**********************/