feat(draw_buf): remove legacy lv_draw_buf_go_to_xy (#5035)
Signed-off-by: Xu Xingliang <xuxingliang@xiaomi.com>
This commit is contained in:
@@ -399,8 +399,13 @@ void * lv_draw_layer_alloc_buf(lv_layer_t * layer)
|
|||||||
|
|
||||||
void * lv_draw_layer_go_to_xy(lv_layer_t * layer, int32_t x, int32_t y)
|
void * lv_draw_layer_go_to_xy(lv_layer_t * layer, int32_t x, int32_t y)
|
||||||
{
|
{
|
||||||
return lv_draw_buf_go_to_xy(layer->buf, layer->buf_stride, layer->color_format, x, y);
|
lv_draw_buf_t tmp;
|
||||||
|
tmp.data = layer->buf;
|
||||||
|
tmp.header.stride = layer->buf_stride;
|
||||||
|
tmp.header.cf = layer->color_format;
|
||||||
|
tmp.header.w = lv_area_get_width(&layer->buf_area);
|
||||||
|
tmp.header.h = lv_area_get_height(&layer->buf_area);
|
||||||
|
return lv_draw_buf_goto_xy(&tmp, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
|
|||||||
@@ -27,9 +27,6 @@ static void * buf_malloc(size_t size, lv_color_format_t color_format);
|
|||||||
static void buf_free(void * buf);
|
static void buf_free(void * buf);
|
||||||
static void * buf_align(void * buf, lv_color_format_t color_format);
|
static void * buf_align(void * buf, lv_color_format_t color_format);
|
||||||
static uint32_t width_to_stride(uint32_t w, lv_color_format_t color_format);
|
static uint32_t width_to_stride(uint32_t w, lv_color_format_t color_format);
|
||||||
static void * buf_go_to_xy(const void * buf, uint32_t stride, lv_color_format_t color_format, int32_t x,
|
|
||||||
int32_t y);
|
|
||||||
|
|
||||||
static void buf_clear(void * buf, uint32_t w, uint32_t h, lv_color_format_t color_format, const lv_area_t * a);
|
static void buf_clear(void * buf, uint32_t w, uint32_t h, lv_color_format_t color_format, const lv_area_t * a);
|
||||||
|
|
||||||
static void buf_copy(void * dest_buf, uint32_t dest_w, uint32_t dest_h, const lv_area_t * dest_area_to_copy,
|
static void buf_copy(void * dest_buf, uint32_t dest_w, uint32_t dest_h, const lv_area_t * dest_area_to_copy,
|
||||||
@@ -56,7 +53,6 @@ void _lv_draw_buf_init_handlers(void)
|
|||||||
handlers.align_pointer_cb = buf_align;
|
handlers.align_pointer_cb = buf_align;
|
||||||
handlers.invalidate_cache_cb = NULL;
|
handlers.invalidate_cache_cb = NULL;
|
||||||
handlers.width_to_stride_cb = width_to_stride;
|
handlers.width_to_stride_cb = width_to_stride;
|
||||||
handlers.go_to_xy_cb = buf_go_to_xy;
|
|
||||||
handlers.buf_clear_cb = buf_clear;
|
handlers.buf_clear_cb = buf_clear;
|
||||||
handlers.buf_copy_cb = buf_copy;
|
handlers.buf_copy_cb = buf_copy;
|
||||||
}
|
}
|
||||||
@@ -94,13 +90,6 @@ void lv_draw_buf_invalidate_cache(void * buf, uint32_t stride, lv_color_format_t
|
|||||||
if(handlers.invalidate_cache_cb) handlers.invalidate_cache_cb(buf, stride, color_format, area);
|
if(handlers.invalidate_cache_cb) handlers.invalidate_cache_cb(buf, stride, color_format, area);
|
||||||
}
|
}
|
||||||
|
|
||||||
void * lv_draw_buf_go_to_xy(const void * buf, uint32_t stride, lv_color_format_t color_format, int32_t x,
|
|
||||||
int32_t y)
|
|
||||||
{
|
|
||||||
if(handlers.go_to_xy_cb) return handlers.go_to_xy_cb(buf, stride, color_format, x, y);
|
|
||||||
else return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void lv_draw_buf_clear(void * buf, uint32_t w, uint32_t h, lv_color_format_t color_format, const lv_area_t * a)
|
void lv_draw_buf_clear(void * buf, uint32_t w, uint32_t h, lv_color_format_t color_format, const lv_area_t * a)
|
||||||
{
|
{
|
||||||
if(handlers.buf_clear_cb) handlers.buf_clear_cb(buf, w, h, color_format, a);
|
if(handlers.buf_clear_cb) handlers.buf_clear_cb(buf, w, h, color_format, a);
|
||||||
@@ -249,16 +238,6 @@ static uint32_t width_to_stride(uint32_t w, lv_color_format_t color_format)
|
|||||||
return (width_byte + LV_DRAW_BUF_STRIDE_ALIGN - 1) & ~(LV_DRAW_BUF_STRIDE_ALIGN - 1);
|
return (width_byte + LV_DRAW_BUF_STRIDE_ALIGN - 1) & ~(LV_DRAW_BUF_STRIDE_ALIGN - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void * buf_go_to_xy(const void * buf, uint32_t stride, lv_color_format_t color_format, int32_t x,
|
|
||||||
int32_t y)
|
|
||||||
{
|
|
||||||
const uint8_t * buf_tmp = buf;
|
|
||||||
buf_tmp += stride * y;
|
|
||||||
buf_tmp += x * lv_color_format_get_size(color_format);
|
|
||||||
|
|
||||||
return (void *)buf_tmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void buf_clear(void * buf, uint32_t w, uint32_t h, lv_color_format_t color_format, const lv_area_t * a)
|
static void buf_clear(void * buf, uint32_t w, uint32_t h, lv_color_format_t color_format, const lv_area_t * a)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -43,9 +43,6 @@ typedef void (*lv_draw_buf_invalidate_cache_cb)(void * buf, uint32_t stride, lv_
|
|||||||
|
|
||||||
typedef uint32_t (*lv_draw_buf_width_to_stride_cb)(uint32_t w, lv_color_format_t color_format);
|
typedef uint32_t (*lv_draw_buf_width_to_stride_cb)(uint32_t w, lv_color_format_t color_format);
|
||||||
|
|
||||||
typedef void * (*lv_draw_buf_go_to_xy_cb)(const void * buf, uint32_t stride, lv_color_format_t color_format,
|
|
||||||
int32_t x, int32_t y);
|
|
||||||
|
|
||||||
typedef void (*lv_draw_buf_clear_cb)(void * buf, uint32_t w, uint32_t h, lv_color_format_t color_format,
|
typedef void (*lv_draw_buf_clear_cb)(void * buf, uint32_t w, uint32_t h, lv_color_format_t color_format,
|
||||||
const lv_area_t * a);
|
const lv_area_t * a);
|
||||||
|
|
||||||
@@ -60,7 +57,6 @@ typedef struct {
|
|||||||
lv_draw_buf_align_cb align_pointer_cb;
|
lv_draw_buf_align_cb align_pointer_cb;
|
||||||
lv_draw_buf_invalidate_cache_cb invalidate_cache_cb;
|
lv_draw_buf_invalidate_cache_cb invalidate_cache_cb;
|
||||||
lv_draw_buf_width_to_stride_cb width_to_stride_cb;
|
lv_draw_buf_width_to_stride_cb width_to_stride_cb;
|
||||||
lv_draw_buf_go_to_xy_cb go_to_xy_cb;
|
|
||||||
lv_draw_buf_clear_cb buf_clear_cb;
|
lv_draw_buf_clear_cb buf_clear_cb;
|
||||||
lv_draw_buf_copy_cb buf_copy_cb;
|
lv_draw_buf_copy_cb buf_copy_cb;
|
||||||
} lv_draw_buf_handlers_t;
|
} lv_draw_buf_handlers_t;
|
||||||
@@ -122,18 +118,6 @@ void lv_draw_buf_invalidate_cache(void * buf, uint32_t stride, lv_color_format_t
|
|||||||
*/
|
*/
|
||||||
uint32_t lv_draw_buf_width_to_stride(uint32_t w, lv_color_format_t color_format);
|
uint32_t lv_draw_buf_width_to_stride(uint32_t w, lv_color_format_t color_format);
|
||||||
|
|
||||||
/**
|
|
||||||
* Got to a pixel at X and Y coordinate in a buffer
|
|
||||||
* @param buf pointer to a buffer
|
|
||||||
* @param stride stride of the buffer
|
|
||||||
* @param color_format color format of the buffer
|
|
||||||
* @param x the target X coordinate
|
|
||||||
* @param y the target X coordinate
|
|
||||||
* @return `buf` offset to point to the given X and Y coordinate
|
|
||||||
*/
|
|
||||||
void * lv_draw_buf_go_to_xy(const void * buf, uint32_t stride, lv_color_format_t color_format, int32_t x,
|
|
||||||
int32_t y);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear an area on the buffer
|
* Clear an area on the buffer
|
||||||
* @param draw_buf pointer to draw buffer
|
* @param draw_buf pointer to draw buffer
|
||||||
@@ -183,7 +167,6 @@ lv_draw_buf_t * lv_draw_buf_create(uint32_t w, uint32_t h, lv_color_format_t cf,
|
|||||||
void lv_draw_buf_destroy(lv_draw_buf_t * buf);
|
void lv_draw_buf_destroy(lv_draw_buf_t * buf);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @todo, need to replace lv_draw_buf_go_to_xy.
|
|
||||||
* Return pointer to the buffer at the given coordinates
|
* Return pointer to the buffer at the given coordinates
|
||||||
*/
|
*/
|
||||||
void * lv_draw_buf_goto_xy(lv_draw_buf_t * buf, uint32_t x, uint32_t y);
|
void * lv_draw_buf_goto_xy(lv_draw_buf_t * buf, uint32_t x, uint32_t y);
|
||||||
|
|||||||
@@ -69,7 +69,6 @@ void lv_draw_buf_vglite_init_handlers(void)
|
|||||||
handlers->align_pointer_cb = _align_buf;
|
handlers->align_pointer_cb = _align_buf;
|
||||||
handlers->invalidate_cache_cb = _invalidate_cache;
|
handlers->invalidate_cache_cb = _invalidate_cache;
|
||||||
handlers->width_to_stride_cb = _width_to_stride;
|
handlers->width_to_stride_cb = _width_to_stride;
|
||||||
handlers->go_to_xy_cb = _go_to_xy;
|
|
||||||
handlers->buf_clear_cb = _vglite_buf_clear;
|
handlers->buf_clear_cb = _vglite_buf_clear;
|
||||||
handlers->buf_copy_cb = _vglite_buf_copy;
|
handlers->buf_copy_cb = _vglite_buf_copy;
|
||||||
}
|
}
|
||||||
@@ -119,18 +118,6 @@ static uint32_t _width_to_stride(uint32_t w, lv_color_format_t cf)
|
|||||||
return (width_bytes + align_bytes - 1) & ~(align_bytes - 1);
|
return (width_bytes + align_bytes - 1) & ~(align_bytes - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void * _go_to_xy(lv_draw_buf_t * draw_buf, int32_t x, int32_t y)
|
|
||||||
{
|
|
||||||
uint8_t bits_per_pixel = vglite_get_px_size(draw_buf->color_format);
|
|
||||||
uint32_t stride = lv_draw_buf_get_stride(draw_buf);
|
|
||||||
uint8_t * buf_tmp = lv_draw_buf_get_buf(draw_buf);
|
|
||||||
|
|
||||||
buf_tmp += stride * y;
|
|
||||||
buf_tmp += (x * bits_per_pixel) / 8;
|
|
||||||
|
|
||||||
return buf_tmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void _vglite_buf_clear(lv_draw_buf_t * draw_buf, const lv_area_t * area)
|
static void _vglite_buf_clear(lv_draw_buf_t * draw_buf, const lv_area_t * area)
|
||||||
{
|
{
|
||||||
uint32_t stride = lv_draw_buf_get_stride(draw_buf);
|
uint32_t stride = lv_draw_buf_get_stride(draw_buf);
|
||||||
|
|||||||
@@ -107,10 +107,6 @@ static void _draw_vglite_letter(lv_draw_unit_t * draw_unit, lv_draw_glyph_dsc_t
|
|||||||
return;
|
return;
|
||||||
lv_area_move(&blend_area, -layer->draw_buf_ofs.x, -layer->draw_buf_ofs.y);
|
lv_area_move(&blend_area, -layer->draw_buf_ofs.x, -layer->draw_buf_ofs.y);
|
||||||
|
|
||||||
//void * dest_buf = lv_draw_buf_go_to_xy(&layer->draw_buf,
|
|
||||||
// blend_area.x1 - layer->draw_buf_ofs.x,
|
|
||||||
// blend_area.y1 - layer->draw_buf_ofs.y);
|
|
||||||
|
|
||||||
const uint8_t * mask_buf = glyph_draw_dsc->bitmap;
|
const uint8_t * mask_buf = glyph_draw_dsc->bitmap;
|
||||||
lv_area_t mask_area;
|
lv_area_t mask_area;
|
||||||
lv_area_copy(&mask_area, glyph_draw_dsc->letter_coords);
|
lv_area_copy(&mask_area, glyph_draw_dsc->letter_coords);
|
||||||
|
|||||||
Reference in New Issue
Block a user