diff --git a/scripts/lv_conf_internal_gen.py b/scripts/lv_conf_internal_gen.py index da5dd8e0d1..e283918a77 100755 --- a/scripts/lv_conf_internal_gen.py +++ b/scripts/lv_conf_internal_gen.py @@ -170,6 +170,8 @@ fout.write( #ifndef __ASSEMBLY__ LV_EXPORT_CONST_INT(LV_DPI_DEF); +LV_EXPORT_CONST_INT(LV_DRAW_BUF_STRIDE_ALIGN); +LV_EXPORT_CONST_INT(LV_DRAW_BUF_ALIGN); #endif #undef _LV_KCONFIG_PRESENT diff --git a/src/lv_conf_internal.h b/src/lv_conf_internal.h index b0364d6c78..98d5f28aa5 100644 --- a/src/lv_conf_internal.h +++ b/src/lv_conf_internal.h @@ -2958,6 +2958,8 @@ #ifndef __ASSEMBLY__ LV_EXPORT_CONST_INT(LV_DPI_DEF); +LV_EXPORT_CONST_INT(LV_DRAW_BUF_STRIDE_ALIGN); +LV_EXPORT_CONST_INT(LV_DRAW_BUF_ALIGN); #endif #undef _LV_KCONFIG_PRESENT diff --git a/src/widgets/canvas/lv_canvas.h b/src/widgets/canvas/lv_canvas.h index e2aac005eb..69fe4beeaf 100644 --- a/src/widgets/canvas/lv_canvas.h +++ b/src/widgets/canvas/lv_canvas.h @@ -135,6 +135,14 @@ void lv_canvas_finish_layer(lv_obj_t * canvas, lv_layer_t * layer); #define LV_CANVAS_BUF_SIZE(w, h, bpp, stride) (((((w * bpp + 7) >> 3) + stride - 1) & ~(stride - 1)) * h + LV_DRAW_BUF_ALIGN) +/** + * Just a wrapper to `LV_CANVAS_BUF_SIZE` for bindings. + */ +static inline uint32_t lv_canvas_buf_size(int32_t w, int32_t h, uint8_t bpp, uint8_t stride) +{ + return (uint32_t)LV_CANVAS_BUF_SIZE(w, h, bpp, stride); +} + #endif /*LV_USE_CANVAS*/ #ifdef __cplusplus