feat(draw_buf): add color_format paramater to draw_buf_malloc and align
related to https://github.com/lvgl/lvgl/pull/4414#issuecomment-1707725195
This commit is contained in:
@@ -36,11 +36,11 @@ typedef struct {
|
||||
typedef void (*lv_draw_buf_init_cb)(lv_draw_buf_t * draw_buf, lv_coord_t w, lv_coord_t h,
|
||||
lv_color_format_t color_format);
|
||||
|
||||
typedef void * (*lv_draw_buf_malloc_cb)(size_t size);
|
||||
typedef void * (*lv_draw_buf_malloc_cb)(size_t size, lv_color_format_t color_format);
|
||||
|
||||
typedef void (*lv_draw_buf_free_cb)(void * draw_buf);
|
||||
|
||||
typedef void * (*lv_draw_buf_align_buf_cb)(void * buf);
|
||||
typedef void * (*lv_draw_buf_align_buf_cb)(void * buf, lv_color_format_t color_format);
|
||||
|
||||
typedef void (*lv_draw_buf_invalidate_cache_cb)(lv_draw_buf_t * draw_buf, const char * area);
|
||||
|
||||
@@ -103,12 +103,13 @@ void lv_draw_buf_init_alloc(lv_draw_buf_t * draw_buf, lv_coord_t w, lv_coord_t h
|
||||
|
||||
/**
|
||||
* Allocate a buffer with the given size. It might allocate slightly larger buffer to fulfill the alignment requirements.
|
||||
* @param size the size to allocate in bytes
|
||||
* @param the allocated buffer.
|
||||
* @param size the size to allocate in bytes
|
||||
* @param color_format the color format of the buffer to allcoate
|
||||
* @return the allocated buffer.
|
||||
* @note The returned value can be saved in draw_buf->buf
|
||||
* @note lv_draw_buf_align_buf can be sued the align the returned pointer
|
||||
*/
|
||||
void * lv_draw_buf_malloc(size_t size);
|
||||
void * lv_draw_buf_malloc(size_t size_bytes, lv_color_format_t color_format);
|
||||
|
||||
/**
|
||||
* Free a buffer allocated by lv_draw_buf_malloc
|
||||
@@ -119,9 +120,10 @@ void lv_draw_buf_free(void * buf);
|
||||
/**
|
||||
* Align the address of a buffer. The buffer needs to be large enough for the real data after alignement
|
||||
* @param buf the data to align
|
||||
* @param color_format the color format of the buffer
|
||||
* @return the aligned buffer
|
||||
*/
|
||||
void * lv_draw_buf_align_buf(void * buf);
|
||||
void * lv_draw_buf_align_buf(void * buf, lv_color_format_t color_format);
|
||||
|
||||
/**
|
||||
* Get the buffer of the draw_buf.
|
||||
|
||||
Reference in New Issue
Block a user