From 4516018ce781c23c055d74345121820c2a0982c3 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Sun, 14 Mar 2021 13:57:46 +0100 Subject: [PATCH] refactor(draw_buf): rename vdb to draw_buf It affected only local variables and comments --- examples/porting/lv_port_disp_template.c | 19 +--- src/lv_core/lv_refr.c | 116 +++++++++++------------ src/lv_draw/lv_draw_blend.c | 12 +-- src/lv_draw/lv_draw_img.c | 12 +-- src/lv_draw/lv_draw_label.c | 30 +++--- src/lv_draw/lv_draw_line.c | 34 +++---- src/lv_draw/lv_draw_rect.c | 36 +++---- src/lv_hal/lv_hal_disp.h | 2 +- 8 files changed, 122 insertions(+), 139 deletions(-) diff --git a/examples/porting/lv_port_disp_template.c b/examples/porting/lv_port_disp_template.c index 90dd9acd0..a789ea92b 100644 --- a/examples/porting/lv_port_disp_template.c +++ b/examples/porting/lv_port_disp_template.c @@ -111,11 +111,6 @@ void lv_port_disp_init(void) disp_drv.buffer = &draw_buf_dsc_1; #if LV_USE_GPU - /*Optionally add functions to access the GPU. (Only in buffered mode, LV_VDB_SIZE != 0)*/ - - /*Blend two color array using opacity*/ - disp_drv.gpu_blend_cb = gpu_blend; - /*Fill a memory array with a color*/ disp_drv.gpu_fill_cb = gpu_fill; #endif @@ -159,19 +154,7 @@ static void disp_flush(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_colo /*OPTIONAL: GPU INTERFACE*/ #if LV_USE_GPU -/* If your MCU has hardware accelerator (GPU) then you can use it to blend to memories using opacity - * It can be used only in buffered mode (LV_VDB_SIZE != 0 in lv_conf.h)*/ -static void gpu_blend(lv_disp_drv_t * disp_drv, lv_color_t * dest, const lv_color_t * src, uint32_t length, lv_opa_t opa) -{ - /*It's an example code which should be done by your GPU*/ - uint32_t i; - for(i = 0; i < length; i++) { - dest[i] = lv_color_mix(dest[i], src[i], opa); - } -} - -/* If your MCU has hardware accelerator (GPU) then you can use it to fill a memory with a color - * It can be used only in buffered mode (LV_VDB_SIZE != 0 in lv_conf.h)*/ +/* If your MCU has hardware accelerator (GPU) then you can use it to fill a memory with a color*/ static void gpu_fill(lv_disp_drv_t * disp_drv, lv_color_t * dest_buf, lv_coord_t dest_width, const lv_area_t * fill_area, lv_color_t color) { diff --git a/src/lv_core/lv_refr.c b/src/lv_core/lv_refr.c index 8ac1b3417..891b31d66 100644 --- a/src/lv_core/lv_refr.c +++ b/src/lv_core/lv_refr.c @@ -43,7 +43,7 @@ static void lv_refr_area_part(const lv_area_t * area_p); static lv_obj_t * lv_refr_get_top_obj(const lv_area_t * area_p, lv_obj_t * obj); static void lv_refr_obj_and_children(lv_obj_t * top_p, const lv_area_t * mask_p); static void lv_refr_obj(lv_obj_t * obj, const lv_area_t * mask_ori_p); -static void lv_refr_vdb_flush(void); +static void draw_buf_flush(void); static lv_draw_res_t call_draw_cb(lv_obj_t * obj, const lv_area_t * clip_area, lv_draw_mode_t mode); static void call_flush_cb(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_p); @@ -223,7 +223,7 @@ void _lv_disp_refr_timer(lv_timer_t * tmr) /*If refresh happened ...*/ if(disp_refr->inv_p != 0) { if(lv_disp_is_true_double_buf(disp_refr)) { - lv_refr_vdb_flush(); + draw_buf_flush(); } /*Clean up*/ @@ -409,28 +409,28 @@ static void lv_refr_area(const lv_area_t * area_p) /*True double buffering: there are two screen sized buffers. Just redraw directly into a * buffer*/ if(lv_disp_is_true_double_buf(disp_refr)) { - lv_disp_draw_buf_t * vdb = lv_disp_get_draw_buf(disp_refr); - vdb->area.x1 = 0; - vdb->area.x2 = lv_disp_get_hor_res(disp_refr) - 1; - vdb->area.y1 = 0; - vdb->area.y2 = lv_disp_get_ver_res(disp_refr) - 1; + lv_disp_draw_buf_t * draw_buf = lv_disp_get_draw_buf(disp_refr); + draw_buf->area.x1 = 0; + draw_buf->area.x2 = lv_disp_get_hor_res(disp_refr) - 1; + draw_buf->area.y1 = 0; + draw_buf->area.y2 = lv_disp_get_ver_res(disp_refr) - 1; disp_refr->driver->draw_buf->last_part = 1; lv_refr_area_part(area_p); } /*The buffer is smaller: refresh the area in parts*/ else { - lv_disp_draw_buf_t * vdb = lv_disp_get_draw_buf(disp_refr); + lv_disp_draw_buf_t * draw_buf = lv_disp_get_draw_buf(disp_refr); /*Calculate the max row num*/ lv_coord_t w = lv_area_get_width(area_p); lv_coord_t h = lv_area_get_height(area_p); lv_coord_t y2 = area_p->y2 >= lv_disp_get_ver_res(disp_refr) ? lv_disp_get_ver_res(disp_refr) - 1 : area_p->y2; - int32_t max_row = (uint32_t)vdb->size / w; + int32_t max_row = (uint32_t)draw_buf->size / w; if(max_row > h) max_row = h; - /*Round down the lines of VDB if rounding is added*/ + /*Round down the lines of draw_buf if rounding is added*/ if(disp_refr->driver->rounder_cb) { lv_area_t tmp; tmp.x1 = 0; @@ -450,8 +450,8 @@ static void lv_refr_area(const lv_area_t * area_p) } while(h_tmp > 0); if(h_tmp <= 0) { - LV_LOG_WARN("Can't set VDB height using the round function. (Wrong round_cb or to " - "small VDB)"); + LV_LOG_WARN("Can't set draw_buf height using the round function. (Wrong round_cb or to " + "small draw_buf)"); return; } else { @@ -463,24 +463,24 @@ static void lv_refr_area(const lv_area_t * area_p) lv_coord_t row; lv_coord_t row_last = 0; for(row = area_p->y1; row + max_row - 1 <= y2; row += max_row) { - /*Calc. the next y coordinates of VDB*/ - vdb->area.x1 = area_p->x1; - vdb->area.x2 = area_p->x2; - vdb->area.y1 = row; - vdb->area.y2 = row + max_row - 1; - if(vdb->area.y2 > y2) vdb->area.y2 = y2; - row_last = vdb->area.y2; + /*Calc. the next y coordinates of draw_buf*/ + draw_buf->area.x1 = area_p->x1; + draw_buf->area.x2 = area_p->x2; + draw_buf->area.y1 = row; + draw_buf->area.y2 = row + max_row - 1; + if(draw_buf->area.y2 > y2) draw_buf->area.y2 = y2; + row_last = draw_buf->area.y2; if(y2 == row_last) disp_refr->driver->draw_buf->last_part = 1; lv_refr_area_part(area_p); } /*If the last y coordinates are not handled yet ...*/ if(y2 != row_last) { - /*Calc. the next y coordinates of VDB*/ - vdb->area.x1 = area_p->x1; - vdb->area.x2 = area_p->x2; - vdb->area.y1 = row; - vdb->area.y2 = y2; + /*Calc. the next y coordinates of draw_buf*/ + draw_buf->area.x1 = area_p->x1; + draw_buf->area.x2 = area_p->x2; + draw_buf->area.y1 = row; + draw_buf->area.y2 = y2; disp_refr->driver->draw_buf->last_part = 1; lv_refr_area_part(area_p); @@ -494,19 +494,19 @@ static void lv_refr_area(const lv_area_t * area_p) */ static void lv_refr_area_part(const lv_area_t * area_p) { - lv_disp_draw_buf_t * vdb = lv_disp_get_draw_buf(disp_refr); + lv_disp_draw_buf_t * draw_buf = lv_disp_get_draw_buf(disp_refr); - while(vdb->flushing) { + while(draw_buf->flushing) { if(disp_refr->driver->wait_cb) disp_refr->driver->wait_cb(disp_refr->driver); } lv_obj_t * top_act_scr = NULL; lv_obj_t * top_prev_scr = NULL; - /*Get the new mask from the original area and the act. VDB + /*Get the new mask from the original area and the act. draw_buf It will be a part of 'area_p'*/ lv_area_t start_mask; - _lv_area_intersect(&start_mask, area_p, &vdb->area); + _lv_area_intersect(&start_mask, area_p, &draw_buf->area); /*Get the most top object which is not covered by others*/ top_act_scr = lv_refr_get_top_obj(&start_mask, lv_disp_get_scr_act(disp_refr)); @@ -565,7 +565,7 @@ static void lv_refr_area_part(const lv_area_t * area_p) /* In true double buffered mode flush only once when all areas were rendered. * In normal mode flush after every area */ if(lv_disp_is_true_double_buf(disp_refr) == false) { - lv_refr_vdb_flush(); + draw_buf_flush(); } } @@ -747,7 +747,7 @@ static void lv_refr_obj(lv_obj_t * obj, const lv_area_t * mask_ori_p) } } -static void lv_refr_vdb_rotate_180(lv_disp_drv_t *drv, lv_area_t *area, lv_color_t *color_p) { +static void draw_buf_rotate_180(lv_disp_drv_t *drv, lv_area_t *area, lv_color_t *color_p) { lv_coord_t area_w = lv_area_get_width(area); lv_coord_t area_h = lv_area_get_height(area); uint32_t total = area_w * area_h; @@ -770,7 +770,7 @@ static void lv_refr_vdb_rotate_180(lv_disp_drv_t *drv, lv_area_t *area, lv_color area->x1 = drv->hor_res - tmp_coord - 1; } -static LV_ATTRIBUTE_FAST_MEM void lv_refr_vdb_rotate_90(bool invert_i, lv_coord_t area_w, lv_coord_t area_h, lv_color_t *orig_color_p, lv_color_t *rot_buf) { +static LV_ATTRIBUTE_FAST_MEM void draw_buf_rotate_90(bool invert_i, lv_coord_t area_w, lv_coord_t area_h, lv_color_t *orig_color_p, lv_color_t *rot_buf) { uint32_t invert = (area_w * area_h) - 1; uint32_t initial_i = ((area_w - 1) * area_h); @@ -789,9 +789,9 @@ static LV_ATTRIBUTE_FAST_MEM void lv_refr_vdb_rotate_90(bool invert_i, lv_coord_ } /** - * Helper function for lv_refr_vdb_rotate_90_sqr. Given a list of four numbers, rotate the entire list to the left. + * Helper function for draw_buf_rotate_90_sqr. Given a list of four numbers, rotate the entire list to the left. */ -static inline void lv_vdb_rotate4(lv_color_t *a, lv_color_t *b, lv_color_t * c, lv_color_t * d) { +static inline void draw_buf_rotate4(lv_color_t *a, lv_color_t *b, lv_color_t * c, lv_color_t * d) { lv_color_t tmp; tmp = *a; *a = *b; @@ -804,20 +804,20 @@ static inline void lv_vdb_rotate4(lv_color_t *a, lv_color_t *b, lv_color_t * c, * Rotate a square image 90/270 degrees in place. * @note inspired by https://stackoverflow.com/a/43694906 */ -static void lv_refr_vdb_rotate_90_sqr(bool is_270, lv_coord_t w, lv_color_t * color_p) { +static void draw_buf_rotate_90_sqr(bool is_270, lv_coord_t w, lv_color_t * color_p) { for(lv_coord_t i = 0; i < w/2; i++) { for(lv_coord_t j = 0; j < (w + 1)/2; j++) { lv_coord_t inv_i = (w - 1) - i; lv_coord_t inv_j = (w - 1) - j; if(is_270) { - lv_vdb_rotate4( + draw_buf_rotate4( &color_p[i * w + j], &color_p[inv_j * w + i], &color_p[inv_i * w + inv_j], &color_p[j * w + inv_i] ); } else { - lv_vdb_rotate4( + draw_buf_rotate4( &color_p[i * w + j], &color_p[j * w + inv_i], &color_p[inv_i * w + inv_j], @@ -830,21 +830,21 @@ static void lv_refr_vdb_rotate_90_sqr(bool is_270, lv_coord_t w, lv_color_t * co } /** - * Rotate the VDB to the display's native orientation. + * Rotate the draw_buf to the display's native orientation. */ -static void lv_refr_vdb_rotate(lv_area_t *area, lv_color_t *color_p) { +static void draw_buf_rotate(lv_area_t *area, lv_color_t *color_p) { lv_disp_drv_t * drv = disp_refr->driver; if(lv_disp_is_true_double_buf(disp_refr) && drv->sw_rotate) { LV_LOG_ERROR("cannot rotate a true double-buffered display!"); return; } if(drv->rotated == LV_DISP_ROT_180) { - lv_refr_vdb_rotate_180(drv, area, color_p); + draw_buf_rotate_180(drv, area, color_p); call_flush_cb(drv, area, color_p); } else if(drv->rotated == LV_DISP_ROT_90 || drv->rotated == LV_DISP_ROT_270) { /*Allocate a temporary buffer to store rotated image */ lv_color_t * rot_buf = NULL; - lv_disp_draw_buf_t * vdb = lv_disp_get_draw_buf(disp_refr); + lv_disp_draw_buf_t * draw_buf = lv_disp_get_draw_buf(disp_refr); lv_coord_t area_w = lv_area_get_width(area); lv_coord_t area_h = lv_area_get_height(area); /*Determine the maximum number of rows that can be rotated at a time*/ @@ -858,16 +858,16 @@ static void lv_refr_vdb_rotate(lv_area_t *area, lv_color_t *color_p) { area->y1 = area->x1; area->y2 = area->y1 + area_w - 1; } - vdb->flushing = 0; + draw_buf->flushing = 0; /*Rotate the screen in chunks, flushing after each one*/ lv_coord_t row = 0; while(row < area_h) { lv_coord_t height = LV_MIN(max_row, area_h-row); - vdb->flushing = 1; + draw_buf->flushing = 1; if((row == 0) && (area_h >= area_w)) { /*Rotate the initial area as a square*/ height = area_w; - lv_refr_vdb_rotate_90_sqr(drv->rotated == LV_DISP_ROT_270, area_w, color_p); + draw_buf_rotate_90_sqr(drv->rotated == LV_DISP_ROT_270, area_w, color_p); if(drv->rotated == LV_DISP_ROT_90) { area->x1 = init_y_off; area->x2 = init_y_off+area_w-1; @@ -878,7 +878,7 @@ static void lv_refr_vdb_rotate(lv_area_t *area, lv_color_t *color_p) { } else { /*Rotate other areas using a maximum buffer size*/ if(rot_buf == NULL) rot_buf = lv_mem_buf_get(LV_DISP_ROT_MAX_BUF); - lv_refr_vdb_rotate_90(drv->rotated == LV_DISP_ROT_270, area_w, height, color_p, rot_buf); + draw_buf_rotate_90(drv->rotated == LV_DISP_ROT_270, area_w, height, color_p, rot_buf); if(drv->rotated == LV_DISP_ROT_90) { area->x1 = init_y_off+row; @@ -891,7 +891,7 @@ static void lv_refr_vdb_rotate(lv_area_t *area, lv_color_t *color_p) { /*Flush the completed area to the display*/ call_flush_cb(drv, area, rot_buf == NULL ? color_p : rot_buf); /*FIXME: Rotation forces legacy behavior where rendering and flushing are done serially*/ - while(vdb->flushing) { + while(draw_buf->flushing) { if(drv->wait_cb) drv->wait_cb(drv); } color_p += area_w * height; @@ -903,17 +903,17 @@ static void lv_refr_vdb_rotate(lv_area_t *area, lv_color_t *color_p) { } /** - * Flush the content of the VDB + * Flush the content of the draw buffer */ -static void lv_refr_vdb_flush(void) +static void draw_buf_flush(void) { - lv_disp_draw_buf_t * vdb = lv_disp_get_draw_buf(disp_refr); - lv_color_t * color_p = vdb->buf_act; + lv_disp_draw_buf_t * draw_buf = lv_disp_get_draw_buf(disp_refr); + lv_color_t * color_p = draw_buf->buf_act; - vdb->flushing = 1; + draw_buf->flushing = 1; - if(disp_refr->driver->draw_buf->last_area && disp_refr->driver->draw_buf->last_part) vdb->flushing_last = 1; - else vdb->flushing_last = 0; + if(disp_refr->driver->draw_buf->last_area && disp_refr->driver->draw_buf->last_part) draw_buf->flushing_last = 1; + else draw_buf->flushing_last = 0; /*Flush the rendered content to the display*/ lv_disp_t * disp = _lv_refr_get_disp_refreshing(); @@ -922,16 +922,16 @@ static void lv_refr_vdb_flush(void) if(disp->driver->flush_cb) { /*Rotate the buffer to the display's native orientation if necessary*/ if(disp->driver->rotated != LV_DISP_ROT_NONE && disp->driver->sw_rotate) { - lv_refr_vdb_rotate(&vdb->area, vdb->buf_act); + draw_buf_rotate(&draw_buf->area, draw_buf->buf_act); } else { - call_flush_cb(disp->driver, &vdb->area, color_p); + call_flush_cb(disp->driver, &draw_buf->area, color_p); } } - if(vdb->buf1 && vdb->buf2) { - if(vdb->buf_act == vdb->buf1) - vdb->buf_act = vdb->buf2; + if(draw_buf->buf1 && draw_buf->buf2) { + if(draw_buf->buf_act == draw_buf->buf1) + draw_buf->buf_act = draw_buf->buf2; else - vdb->buf_act = vdb->buf1; + draw_buf->buf_act = draw_buf->buf1; } } diff --git a/src/lv_draw/lv_draw_blend.c b/src/lv_draw/lv_draw_blend.c index 61a1cfe0b..8ebdbce34 100644 --- a/src/lv_draw/lv_draw_blend.c +++ b/src/lv_draw/lv_draw_blend.c @@ -132,9 +132,9 @@ LV_ATTRIBUTE_FAST_MEM void _lv_blend_fill(const lv_area_t * clip_area, const lv_ if(mask_res == LV_DRAW_MASK_RES_TRANSP) return; lv_disp_t * disp = _lv_refr_get_disp_refreshing(); - lv_disp_draw_buf_t * vdb = lv_disp_get_draw_buf(disp); - const lv_area_t * disp_area = &vdb->area; - lv_color_t * disp_buf = vdb->buf_act; + lv_disp_draw_buf_t * draw_buf = lv_disp_get_draw_buf(disp); + const lv_area_t * disp_area = &draw_buf->area; + lv_color_t * disp_buf = draw_buf->buf_act; if(disp->driver->gpu_wait_cb) disp->driver->gpu_wait_cb(disp->driver); @@ -202,9 +202,9 @@ LV_ATTRIBUTE_FAST_MEM void _lv_blend_map(const lv_area_t * clip_area, const lv_a if(!is_common) return; lv_disp_t * disp = _lv_refr_get_disp_refreshing(); - lv_disp_draw_buf_t * vdb = lv_disp_get_draw_buf(disp); - const lv_area_t * disp_area = &vdb->area; - lv_color_t * disp_buf = vdb->buf_act; + lv_disp_draw_buf_t * draw_buf = lv_disp_get_draw_buf(disp); + const lv_area_t * disp_area = &draw_buf->area; + lv_color_t * disp_buf = draw_buf->buf_act; if(disp->driver->gpu_wait_cb) disp->driver->gpu_wait_cb(disp->driver); diff --git a/src/lv_draw/lv_draw_img.c b/src/lv_draw/lv_draw_img.c index fd45deba6..ba0296ac1 100644 --- a/src/lv_draw/lv_draw_img.c +++ b/src/lv_draw/lv_draw_img.c @@ -328,7 +328,7 @@ LV_ATTRIBUTE_FAST_MEM static lv_res_t lv_img_draw_core(const lv_area_t * coords, /** * Draw a color map to the display (image) * @param cords_p coordinates the color map - * @param mask_p the map will drawn only on this area (truncated to VDB area) + * @param mask_p the map will drawn only on this area (truncated to draw_buf area) * @param map_p pointer to a lv_color_t array * @param draw_dsc pointer to an initialized `lv_draw_img_dsc_t` variable * @param chroma_keyed true: enable transparency of LV_IMG_LV_COLOR_TRANSP color pixels @@ -344,8 +344,8 @@ LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const lv_area_copy(&draw_area, clip_area); lv_disp_t * disp = _lv_refr_get_disp_refreshing(); - lv_disp_draw_buf_t * vdb = lv_disp_get_draw_buf(disp); - const lv_area_t * disp_area = &vdb->area; + lv_disp_draw_buf_t * draw_buf = lv_disp_get_draw_buf(disp); + const lv_area_t * disp_area = &draw_buf->area; /* Now `draw_area` has absolute coordinates. * Make it relative to `disp_area` to simplify draw to `disp_buf`*/ @@ -356,7 +356,7 @@ LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const uint8_t other_mask_cnt = lv_draw_mask_get_cnt(); - /*The simplest case just copy the pixels into the VDB*/ + /*The simplest case just copy the pixels into the draw_buf*/ if(other_mask_cnt == 0 && draw_dsc->angle == 0 && draw_dsc->zoom == LV_IMG_ZOOM_NONE && chroma_key == false && alpha_byte == false && draw_dsc->recolor_opa == LV_OPA_TRANSP) { _lv_blend_map(clip_area, map_area, (lv_color_t *)map_p, NULL, LV_DRAW_MASK_RES_FULL_COVER, draw_dsc->opa, @@ -414,7 +414,7 @@ LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const /*Blend ARGB images directly*/ if(lv_area_get_size(&draw_area) > 240) { int32_t disp_w = lv_area_get_width(disp_area); - lv_color_t * disp_buf = vdb->buf_act; + lv_color_t * disp_buf = draw_buf->buf_act; lv_color_t * disp_buf_first = disp_buf + disp_w * draw_area.y1 + draw_area.x1; lv_gpu_stm32_dma2d_blend(disp_buf_first, disp_w, (const lv_color_t *)map_buf_tmp, draw_dsc->opa, map_w, draw_area_w, draw_area_h); @@ -582,7 +582,7 @@ LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const /*Apply the masks if any*/ if(other_mask_cnt) { lv_draw_mask_res_t mask_res_sub; - mask_res_sub = lv_draw_mask_apply(mask_buf + px_i_start, draw_area.x1 + vdb->area.x1, y + draw_area.y1 + vdb->area.y1, + mask_res_sub = lv_draw_mask_apply(mask_buf + px_i_start, draw_area.x1 + draw_buf->area.x1, y + draw_area.y1 + draw_buf->area.y1, lv_area_get_width(&draw_area)); if(mask_res_sub == LV_DRAW_MASK_RES_TRANSP) { lv_memset_00(mask_buf + px_i_start, lv_area_get_width(&draw_area)); diff --git a/src/lv_draw/lv_draw_label.c b/src/lv_draw/lv_draw_label.c index 8a1aae9b2..781ca3935 100644 --- a/src/lv_draw/lv_draw_label.c +++ b/src/lv_draw/lv_draw_label.c @@ -391,7 +391,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_label(const lv_area_t * coords, const lv_area /** * Draw a letter in the Virtual Display Buffer * @param pos_p left-top coordinate of the latter - * @param mask_p the letter will be drawn only on this area (truncated to VDB area) + * @param mask_p the letter will be drawn only on this area (truncated to draw_buf area) * @param font_p pointer to font * @param letter a letter to draw * @param color color of letter @@ -671,16 +671,16 @@ static void draw_letter_subpx(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_ lv_color_t * color_buf = lv_mem_buf_get(mask_buf_size * sizeof(lv_color_t)); lv_disp_t * disp = _lv_refr_get_disp_refreshing(); - lv_disp_buf_t * vdb = lv_disp_get_draw_buf(disp); + lv_disp_buf_t * draw_buf = lv_disp_get_draw_buf(disp); - int32_t vdb_width = lv_area_get_width(&vdb->area); - lv_color_t * vdb_buf_tmp = vdb->buf_act; + int32_t draw_buf_width = lv_area_get_width(&draw_buf->area); + lv_color_t * draw_buf_buf_tmp = draw_buf->buf_act; - /*Set a pointer on VDB to the first pixel of the letter*/ - vdb_buf_tmp += ((pos_y - vdb->area.y1) * vdb_width) + pos_x - vdb->area.x1; + /*Set a pointer on draw_buf to the first pixel of the letter*/ + draw_buf_buf_tmp += ((pos_y - draw_buf->area.y1) * draw_buf_width) + pos_x - draw_buf->area.x1; - /*If the letter is partially out of mask the move there on VDB*/ - vdb_buf_tmp += (row_start * vdb_width) + col_start / 3; + /*If the letter is partially out of mask the move there on draw_buf*/ + draw_buf_buf_tmp += (row_start * draw_buf_width) + col_start / 3; lv_area_t map_area; map_area.x1 = col_start / 3 + pos_x; @@ -727,11 +727,11 @@ static void draw_letter_subpx(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_ lv_color_t res_color; #if LV_COLOR_16_SWAP == 0 - uint8_t bg_rgb[3] = {vdb_buf_tmp->ch.red, vdb_buf_tmp->ch.green, vdb_buf_tmp->ch.blue}; + uint8_t bg_rgb[3] = {draw_buf_buf_tmp->ch.red, draw_buf_buf_tmp->ch.green, draw_buf_buf_tmp->ch.blue}; #else - uint8_t bg_rgb[3] = {vdb_buf_tmp->ch.red, - (vdb_buf_tmp->ch.green_h << 3) + vdb_buf_tmp->ch.green_l, - vdb_buf_tmp->ch.blue + uint8_t bg_rgb[3] = {draw_buf_buf_tmp->ch.red, + (draw_buf_buf_tmp->ch.green_h << 3) + draw_buf_buf_tmp->ch.green_l, + draw_buf_buf_tmp->ch.blue }; #endif @@ -761,7 +761,7 @@ static void draw_letter_subpx(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_ /*Next mask byte*/ mask_p++; - vdb_buf_tmp++; + draw_buf_buf_tmp++; } /*Go to the next column*/ @@ -801,8 +801,8 @@ static void draw_letter_subpx(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_ map_p += (col_bit >> 3); col_bit = col_bit & 0x7; - /*Next row in VDB*/ - vdb_buf_tmp += vdb_width - (col_end - col_start) / 3; + /*Next row in draw_buf*/ + draw_buf_buf_tmp += draw_buf_width - (col_end - col_start) / 3; } /*Flush the last part*/ diff --git a/src/lv_draw/lv_draw_line.c b/src/lv_draw/lv_draw_line.c index 63ec340d7..f2fb9b369 100644 --- a/src/lv_draw/lv_draw_line.c +++ b/src/lv_draw/lv_draw_line.c @@ -150,8 +150,8 @@ LV_ATTRIBUTE_FAST_MEM static void draw_line_hor(const lv_point_t * point1, const /*If there other mask apply it*/ else { lv_disp_t * disp = _lv_refr_get_disp_refreshing(); - lv_disp_draw_buf_t * vdb = lv_disp_get_draw_buf(disp); - const lv_area_t * disp_area = &vdb->area; + lv_disp_draw_buf_t * draw_buf = lv_disp_get_draw_buf(disp); + const lv_area_t * disp_area = &draw_buf->area; /* Get clipped fill area which is the real draw area. * It is always the same or inside `fill_area` */ bool is_common; @@ -175,14 +175,14 @@ LV_ATTRIBUTE_FAST_MEM static void draw_line_hor(const lv_point_t * point1, const lv_coord_t dash_start = 0; if(dashed) { - dash_start = (vdb->area.x1 + draw_area.x1) % (dsc->dash_gap + dsc->dash_width); + dash_start = (draw_buf->area.x1 + draw_area.x1) % (dsc->dash_gap + dsc->dash_width); } lv_opa_t * mask_buf = lv_mem_buf_get(draw_area_w); int32_t h; for(h = draw_area.y1; h <= draw_area.y2; h++) { lv_memset_ff(mask_buf, draw_area_w); - lv_draw_mask_res_t mask_res = lv_draw_mask_apply(mask_buf, vdb->area.x1 + draw_area.x1, vdb->area.y1 + h, draw_area_w); + lv_draw_mask_res_t mask_res = lv_draw_mask_apply(mask_buf, draw_buf->area.x1 + draw_area.x1, draw_buf->area.y1 + h, draw_area_w); if(dashed) { if(mask_res != LV_DRAW_MASK_RES_TRANSP) { @@ -251,8 +251,8 @@ LV_ATTRIBUTE_FAST_MEM static void draw_line_ver(const lv_point_t * point1, const /*If there other mask apply it*/ else { lv_disp_t * disp = _lv_refr_get_disp_refreshing(); - lv_disp_draw_buf_t * vdb = lv_disp_get_draw_buf(disp); - const lv_area_t * disp_area = &vdb->area; + lv_disp_draw_buf_t * draw_buf = lv_disp_get_draw_buf(disp); + const lv_area_t * disp_area = &draw_buf->area; /* Get clipped fill area which is the real draw area. * It is always the same or inside `fill_area` */ bool is_common; @@ -261,10 +261,10 @@ LV_ATTRIBUTE_FAST_MEM static void draw_line_ver(const lv_point_t * point1, const /* Now `draw_area` has absolute coordinates. * Make it relative to `disp_area` to simplify draw to `disp_buf`*/ - draw_area.x1 -= vdb->area.x1; - draw_area.y1 -= vdb->area.y1; - draw_area.x2 -= vdb->area.x1; - draw_area.y2 -= vdb->area.y1; + draw_area.x1 -= draw_buf->area.x1; + draw_area.y1 -= draw_buf->area.y1; + draw_area.x2 -= draw_buf->area.x1; + draw_area.y2 -= draw_buf->area.y1; int32_t draw_area_w = lv_area_get_width(&draw_area); @@ -278,7 +278,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_line_ver(const lv_point_t * point1, const lv_coord_t dash_start = 0; if(dashed) { - dash_start = (vdb->area.y1 + draw_area.y1) % (dsc->dash_gap + dsc->dash_width); + dash_start = (draw_buf->area.y1 + draw_area.y1) % (dsc->dash_gap + dsc->dash_width); } lv_coord_t dash_cnt = dash_start; @@ -286,7 +286,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_line_ver(const lv_point_t * point1, const int32_t h; for(h = draw_area.y1; h <= draw_area.y2; h++) { lv_memset_ff(mask_buf, draw_area_w); - lv_draw_mask_res_t mask_res = lv_draw_mask_apply(mask_buf, vdb->area.x1 + draw_area.x1, vdb->area.y1 + h, draw_area_w); + lv_draw_mask_res_t mask_res = lv_draw_mask_apply(mask_buf, draw_buf->area.x1 + draw_area.x1, draw_buf->area.y1 + h, draw_area_w); if(dashed) { if(mask_res != LV_DRAW_MASK_RES_TRANSP) { @@ -362,7 +362,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_line_skew(const lv_point_t * point1, cons draw_area.y2 = LV_MAX(p1.y, p2.y) + w; /* Get the union of `coords` and `clip`*/ - /* `clip` is already truncated to the `vdb` size + /* `clip` is already truncated to the `draw_buf` size * in 'lv_refr_area' function */ bool is_common = _lv_area_intersect(&draw_area, &draw_area, clip); if(is_common == false) return; @@ -408,11 +408,11 @@ LV_ATTRIBUTE_FAST_MEM static void draw_line_skew(const lv_point_t * point1, cons } lv_disp_t * disp = _lv_refr_get_disp_refreshing(); - lv_disp_draw_buf_t * vdb = lv_disp_get_draw_buf(disp); + lv_disp_draw_buf_t * draw_buf = lv_disp_get_draw_buf(disp); - const lv_area_t * disp_area = &vdb->area; + const lv_area_t * disp_area = &draw_buf->area; - /*Store the coordinates of the `draw_a` relative to the VDB */ + /*Store the coordinates of the `draw_a` relative to the draw_buf */ draw_area.x1 -= disp_area->x1; draw_area.y1 -= disp_area->y1; draw_area.x2 -= disp_area->x1; @@ -435,7 +435,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_line_skew(const lv_point_t * point1, cons fill_area.y1 = draw_area.y1 + disp_area->y1; fill_area.y2 = fill_area.y1; - int32_t x = vdb->area.x1 + draw_area.x1; + int32_t x = draw_buf->area.x1 + draw_area.x1; uint32_t mask_p = 0; diff --git a/src/lv_draw/lv_draw_rect.c b/src/lv_draw/lv_draw_rect.c index 3ba10d7be..8e2ab4869 100644 --- a/src/lv_draw/lv_draw_rect.c +++ b/src/lv_draw/lv_draw_rect.c @@ -140,7 +140,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_bg(const lv_area_t * coords, const lv_are if(opa > LV_OPA_MAX) opa = LV_OPA_COVER; lv_disp_t * disp = _lv_refr_get_disp_refreshing(); - lv_disp_draw_buf_t * vdb = lv_disp_get_draw_buf(disp); + lv_disp_draw_buf_t * draw_buf = lv_disp_get_draw_buf(disp); /* Get clipped fill area which is the real draw area. * It is always the same or inside `fill_area` */ @@ -149,7 +149,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_bg(const lv_area_t * coords, const lv_are is_common = _lv_area_intersect(&draw_area, &coords_bg, clip); if(is_common == false) return; - const lv_area_t * disp_area = &vdb->area; + const lv_area_t * disp_area = &draw_buf->area; /* Now `draw_area` has absolute coordinates. * Make it relative to `disp_area` to simplify draw to `disp_buf`*/ @@ -222,7 +222,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_bg(const lv_area_t * coords, const lv_are fill_area.y1 = disp_area->y1 + draw_area.y1; fill_area.y2 = fill_area.y1; for(h = draw_area.y1; h <= draw_area.y2; h++) { - int32_t y = h + vdb->area.y1; + int32_t y = h + draw_buf->area.y1; opa2 = opa; @@ -232,13 +232,13 @@ LV_ATTRIBUTE_FAST_MEM static void draw_bg(const lv_area_t * coords, const lv_are mask_res = LV_DRAW_MASK_RES_FULL_COVER; if(simple_mode == false) { lv_memset(mask_buf, opa, draw_area_w); - mask_res = lv_draw_mask_apply(mask_buf, vdb->area.x1 + draw_area.x1, vdb->area.y1 + h, draw_area_w); + mask_res = lv_draw_mask_apply(mask_buf, draw_buf->area.x1 + draw_area.x1, draw_buf->area.y1 + h, draw_area_w); } } /*In corner areas apply the mask anyway*/ else { lv_memset(mask_buf, opa, draw_area_w); - mask_res = lv_draw_mask_apply(mask_buf, vdb->area.x1 + draw_area.x1, vdb->area.y1 + h, draw_area_w); + mask_res = lv_draw_mask_apply(mask_buf, draw_buf->area.x1 + draw_area.x1, draw_buf->area.y1 + h, draw_area_w); } /*If mask will taken into account its base opacity was already set by memset above*/ @@ -279,7 +279,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_bg(const lv_area_t * coords, const lv_are fill_area2.x1 = coords_bg.x2 - rout + 1; fill_area2.x2 = coords_bg.x2; - int32_t mask_ofs = (coords_bg.x2 - rout + 1) - (vdb->area.x1 + draw_area.x1); + int32_t mask_ofs = (coords_bg.x2 - rout + 1) - (draw_buf->area.x1 + draw_area.x1); if(mask_ofs < 0) mask_ofs = 0; _lv_blend_fill(clip, &fill_area2, grad_color, mask_buf + mask_ofs, mask_res, opa2, dsc->blend_mode); @@ -421,7 +421,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_border(const lv_area_t * coords, const lv if(opa > LV_OPA_MAX) opa = LV_OPA_COVER; lv_disp_t * disp = _lv_refr_get_disp_refreshing(); - lv_disp_draw_buf_t * vdb = lv_disp_get_draw_buf(disp); + lv_disp_draw_buf_t * draw_buf = lv_disp_get_draw_buf(disp); /* Get clipped fill area which is the real draw area. * It is always the same or inside `fill_area` */ @@ -430,7 +430,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_border(const lv_area_t * coords, const lv is_common = _lv_area_intersect(&draw_area, coords, clip); if(is_common == false) return; - const lv_area_t * disp_area = &vdb->area; + const lv_area_t * disp_area = &draw_buf->area; /* Now `draw_area` has absolute coordinates. * Make it relative to `disp_area` to simplify draw to `disp_buf`*/ @@ -491,7 +491,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_border(const lv_area_t * coords, const lv (top_only && fill_area.y1 <= coords->y1 + corner_size) || (bottom_only && fill_area.y1 >= coords->y2 - corner_size)) { lv_memset_ff(mask_buf, draw_area_w); - mask_res = lv_draw_mask_apply(mask_buf, vdb->area.x1 + draw_area.x1, vdb->area.y1 + h, draw_area_w); + mask_res = lv_draw_mask_apply(mask_buf, draw_buf->area.x1 + draw_area.x1, draw_buf->area.y1 + h, draw_area_w); _lv_blend_fill(clip, &fill_area, color, mask_buf, mask_res, opa, blend_mode); } fill_area.y1++; @@ -552,7 +552,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv if(opa > LV_OPA_MAX) opa = LV_OPA_COVER; lv_disp_t * disp = _lv_refr_get_disp_refreshing(); - lv_disp_draw_buf_t * vdb = lv_disp_get_draw_buf(disp); + lv_disp_draw_buf_t * draw_buf = lv_disp_get_draw_buf(disp); /* Get clipped fill area which is the real draw area. * It is always the same or inside `fill_area` */ @@ -561,7 +561,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv is_common = _lv_area_intersect(&draw_area, &sh_area, clip); if(is_common == false) return; - const lv_area_t * disp_area = &vdb->area; + const lv_area_t * disp_area = &draw_buf->area; /* Now `draw_area` has absolute coordinates. * Make it relative to `disp_area` to simplify draw to `disp_buf`*/ @@ -1286,7 +1286,7 @@ static void draw_full_border(const lv_area_t * area_inner, const lv_area_t * are } lv_disp_t * disp = _lv_refr_get_disp_refreshing(); - lv_disp_draw_buf_t * vdb = lv_disp_get_draw_buf(disp); + lv_disp_draw_buf_t * draw_buf = lv_disp_get_draw_buf(disp); /* Get clipped fill area which is the real draw area. * It is always the same or inside `fill_area` */ @@ -1295,7 +1295,7 @@ static void draw_full_border(const lv_area_t * area_inner, const lv_area_t * are is_common = _lv_area_intersect(&draw_area, area_outer, clip); if(is_common == false) return; - const lv_area_t * disp_area = &vdb->area; + const lv_area_t * disp_area = &draw_buf->area; /* Now `draw_area` has absolute coordinates. * Make it relative to `disp_area` to simplify draw to `disp_buf`*/ @@ -1334,7 +1334,7 @@ static void draw_full_border(const lv_area_t * area_inner, const lv_area_t * are fill_area.y2 = fill_area.y1; for(h = draw_area.y1; h <= upper_corner_end; h++) { lv_memset_ff(mask_buf, draw_area_w); - mask_res = lv_draw_mask_apply(mask_buf, vdb->area.x1 + draw_area.x1, vdb->area.y1 + h, draw_area_w); + mask_res = lv_draw_mask_apply(mask_buf, draw_buf->area.x1 + draw_area.x1, draw_buf->area.y1 + h, draw_area_w); lv_area_t fill_area2; fill_area2.y1 = fill_area.y1; @@ -1356,7 +1356,7 @@ static void draw_full_border(const lv_area_t * area_inner, const lv_area_t * are fill_area2.x1 = area_outer->x2 - rout + 1; fill_area2.x2 = area_outer->x2; - int32_t mask_ofs = (area_outer->x2 - rout + 1) - (vdb->area.x1 + draw_area.x1); + int32_t mask_ofs = (area_outer->x2 - rout + 1) - (draw_buf->area.x1 + draw_area.x1); if(mask_ofs < 0) mask_ofs = 0; _lv_blend_fill(clip, &fill_area2, color, mask_buf + mask_ofs, mask_res, opa, blend_mode); @@ -1371,7 +1371,7 @@ static void draw_full_border(const lv_area_t * area_inner, const lv_area_t * are fill_area.y2 = fill_area.y1; for(h = lower_corner_end; h <= draw_area.y2; h++) { lv_memset_ff(mask_buf, draw_area_w); - mask_res = lv_draw_mask_apply(mask_buf, vdb->area.x1 + draw_area.x1, vdb->area.y1 + h, draw_area_w); + mask_res = lv_draw_mask_apply(mask_buf, draw_buf->area.x1 + draw_area.x1, draw_buf->area.y1 + h, draw_area_w); lv_area_t fill_area2; fill_area2.x1 = area_outer->x1; @@ -1391,7 +1391,7 @@ static void draw_full_border(const lv_area_t * area_inner, const lv_area_t * are fill_area2.x1 = area_outer->x2 - rout + 1; fill_area2.x2 = area_outer->x2; - int32_t mask_ofs = (area_outer->x2 - rout + 1) - (vdb->area.x1 + draw_area.x1); + int32_t mask_ofs = (area_outer->x2 - rout + 1) - (draw_buf->area.x1 + draw_area.x1); if(mask_ofs < 0) mask_ofs = 0; _lv_blend_fill(clip, &fill_area2, color, mask_buf + mask_ofs, mask_res, opa, blend_mode); @@ -1422,7 +1422,7 @@ static void draw_full_border(const lv_area_t * area_inner, const lv_area_t * are for(h = draw_area.y1; h <= draw_area.y2; h++) { lv_memset_ff(mask_buf, draw_area_w); - mask_res = lv_draw_mask_apply(mask_buf, vdb->area.x1 + draw_area.x1, vdb->area.y1 + h, draw_area_w); + mask_res = lv_draw_mask_apply(mask_buf, draw_buf->area.x1 + draw_area.x1, draw_buf->area.y1 + h, draw_area_w); _lv_blend_fill(clip, &fill_area, color, mask_buf, mask_res, opa, blend_mode); fill_area.y1++; diff --git a/src/lv_hal/lv_hal_disp.h b/src/lv_hal/lv_hal_disp.h index b476d9703..6062674ec 100644 --- a/src/lv_hal/lv_hal_disp.h +++ b/src/lv_hal/lv_hal_disp.h @@ -97,7 +97,7 @@ typedef struct _lv_disp_drv_t { */ uint32_t dpi : 10; - /** MANDATORY: Write the internal buffer (VDB) to the display. 'lv_disp_flush_ready()' has to be + /** MANDATORY: Write the internal buffer (draw_buf) to the display. 'lv_disp_flush_ready()' has to be * called when finished */ void (*flush_cb)(struct _lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p);