update GPU inteface with 2D fill

This commit is contained in:
Gabor Kiss-Vamosi
2019-04-05 06:55:35 +02:00
parent 248521da53
commit 6df6614016
3 changed files with 19 additions and 17 deletions

View File

@@ -157,16 +157,16 @@ void lv_draw_fill(const lv_area_t * cords_p, const lv_area_t * mask_p, lv_color_
/*Not opaque fill*/
else if(opa == LV_OPA_COVER) {
/*Use hw fill if present*/
if(disp->driver.mem_fill) {
if(disp->driver.mem_fill_cb) {
lv_coord_t row;
for(row = vdb_rel_a.y1; row <= vdb_rel_a.y2; row++) {
disp->driver.mem_fill(&vdb_buf_tmp[vdb_rel_a.x1], w, color);
disp->driver.mem_fill_cb(vdb->buf_act, &vdb->area, &vdb_rel_a, color);
vdb_buf_tmp += vdb_width;
}
}
/*Use hw blend if present and the area is not too small*/
else if(lv_area_get_height(&vdb_rel_a) > VFILL_HW_ACC_SIZE_LIMIT &&
disp->driver.mem_blend) {
disp->driver.mem_blend_cb) {
/*Fill a one line sized buffer with a color and blend this later*/
if(color_array_tmp[0].full != color.full || last_width != w) {
uint16_t i;
@@ -179,7 +179,7 @@ void lv_draw_fill(const lv_area_t * cords_p, const lv_area_t * mask_p, lv_color_
/*Blend the filled line to every line VDB line-by-line*/
lv_coord_t row;
for(row = vdb_rel_a.y1; row <= vdb_rel_a.y2; row++) {
disp->driver.mem_blend(&vdb_buf_tmp[vdb_rel_a.x1], color_array_tmp, w, opa);
disp->driver.mem_blend_cb(&vdb_buf_tmp[vdb_rel_a.x1], color_array_tmp, w, opa);
vdb_buf_tmp += vdb_width;
}
@@ -193,7 +193,7 @@ void lv_draw_fill(const lv_area_t * cords_p, const lv_area_t * mask_p, lv_color_
/*Fill with opacity*/
else {
/*Use hw blend if present*/
if(disp->driver.mem_blend) {
if(disp->driver.mem_blend_cb) {
if(color_array_tmp[0].full != color.full || last_width != w) {
uint16_t i;
for(i = 0; i < w; i++) {
@@ -204,7 +204,7 @@ void lv_draw_fill(const lv_area_t * cords_p, const lv_area_t * mask_p, lv_color_
}
lv_coord_t row;
for(row = vdb_rel_a.y1; row <= vdb_rel_a.y2; row++) {
disp->driver.mem_blend(&vdb_buf_tmp[vdb_rel_a.x1], color_array_tmp, w, opa);
disp->driver.mem_blend_cb(&vdb_buf_tmp[vdb_rel_a.x1], color_array_tmp, w, opa);
vdb_buf_tmp += vdb_width;
}
@@ -442,10 +442,10 @@ void lv_draw_map(const lv_area_t * cords_p, const lv_area_t * mask_p, const uint
else {
for(row = masked_a.y1; row <= masked_a.y2; row++) {
#if LV_USE_GPU
if(disp->driver.mem_blend == false) {
if(disp->driver.mem_blend_cb == false) {
sw_mem_blend(vdb_buf_tmp, (lv_color_t *)map_p, map_useful_w, opa);
} else {
disp->driver.mem_blend(vdb_buf_tmp, (lv_color_t *)map_p, map_useful_w, opa);
disp->driver.mem_blend_cb(vdb_buf_tmp, (lv_color_t *)map_p, map_useful_w, opa);
}
#else
sw_mem_blend(vdb_buf_tmp, (lv_color_t *)map_p, map_useful_w, opa);

View File

@@ -67,8 +67,8 @@ void lv_disp_drv_init(lv_disp_drv_t * driver)
#endif
#if LV_USE_GPU
driver->mem_blend = NULL;
driver->mem_fill = NULL;
driver->mem_blend_cb = NULL;
driver->mem_fill_cb = NULL;
#endif
driver->set_px_cb = NULL;

View File

@@ -90,6 +90,15 @@ typedef struct _disp_drv_t
* number of flushed pixels */
void (*monitor_cb)(struct _disp_drv_t * disp_drv, uint32_t time, uint32_t px);
#if LV_USE_GPU
/*OPTIONAL: Blend two memories using opacity (GPU only)*/
void (*mem_blend_cb)(lv_color_t * dest, const lv_color_t * src, uint32_t length, lv_opa_t opa);
/*OPTIONAL: Fill a memory with a color (GPU only)*/
void (*mem_fill_cb)(lv_color_t * dest_buf, const lv_area_t * dest_area, const lv_area_t * fill_area, lv_color_t color);
#endif
#if LV_USE_USER_DATA_SINGLE
lv_disp_drv_user_data_t user_data;
#endif
@@ -101,13 +110,6 @@ typedef struct _disp_drv_t
lv_disp_drv_user_data_t monitor_user_data;
#endif
#if LV_USE_GPU
/*OPTIONAL: Blend two memories using opacity (GPU only)*/
void (*mem_blend)(lv_color_t * dest, const lv_color_t * src, uint32_t length, lv_opa_t opa);
/*OPTIONAL: Fill a memory with a color (GPU only)*/
void (*mem_fill)(lv_color_t * dest, uint32_t length, lv_color_t color);
#endif
} lv_disp_drv_t;