mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-28 07:03:00 +08:00
chore: simplify and flatten code (#4097)
This commit is contained in:
parent
74c415536f
commit
02b5611517
@ -844,7 +844,6 @@ void lv_obj_invalidate(const lv_obj_t * obj)
|
||||
obj_coords.y2 += ext_size;
|
||||
|
||||
lv_obj_invalidate_area(obj, &obj_coords);
|
||||
|
||||
}
|
||||
|
||||
bool lv_obj_area_is_visible(const lv_obj_t * obj, lv_area_t * area)
|
||||
@ -911,7 +910,6 @@ bool lv_obj_is_visible(const lv_obj_t * obj)
|
||||
obj_coords.y2 += ext_size;
|
||||
|
||||
return lv_obj_area_is_visible(obj, &obj_coords);
|
||||
|
||||
}
|
||||
|
||||
void lv_obj_set_ext_click_area(lv_obj_t * obj, lv_coord_t size)
|
||||
|
@ -249,14 +249,14 @@ void _lv_inv_area(lv_disp_t * disp, const lv_area_t * area_p)
|
||||
}
|
||||
|
||||
/*Save the area*/
|
||||
if(disp->inv_p < LV_INV_BUF_SIZE) {
|
||||
lv_area_copy(&disp->inv_areas[disp->inv_p], &com_area);
|
||||
}
|
||||
else { /*If no place for the area add the screen*/
|
||||
lv_area_t * tmp_area_p = &com_area;
|
||||
if(disp->inv_p >= LV_INV_BUF_SIZE) { /*If no place for the area add the screen*/
|
||||
disp->inv_p = 0;
|
||||
lv_area_copy(&disp->inv_areas[disp->inv_p], &scr_area);
|
||||
tmp_area_p = &scr_area;
|
||||
}
|
||||
lv_area_copy(&disp->inv_areas[disp->inv_p], tmp_area_p);
|
||||
disp->inv_p++;
|
||||
|
||||
if(disp->refr_timer) lv_timer_resume(disp->refr_timer);
|
||||
}
|
||||
|
||||
@ -424,13 +424,15 @@ void _lv_disp_refr_timer(lv_timer_t * tmr)
|
||||
|
||||
refr_invalid_areas();
|
||||
|
||||
if(disp_refr->inv_p == 0) goto refr_cache_clean_up;
|
||||
|
||||
/*If refresh happened ...*/
|
||||
if(disp_refr->inv_p != 0) {
|
||||
/*Call monitor cb if present*/
|
||||
lv_disp_send_event(disp_refr, LV_EVENT_RENDER_READY, NULL);
|
||||
|
||||
if(!lv_disp_is_double_buffered(disp_refr) || disp_refr->render_mode != LV_DISP_RENDER_MODE_DIRECT) goto refr_clean_up;
|
||||
|
||||
/*With double buffered direct mode synchronize the rendered areas to the other buffer*/
|
||||
if(lv_disp_is_double_buffered(disp_refr) && disp_refr->render_mode == LV_DISP_RENDER_MODE_DIRECT) {
|
||||
/*We need to wait for ready here to not mess up the active screen*/
|
||||
while(disp_refr->flushing) {
|
||||
if(disp_refr->wait_cb) disp_refr->wait_cb(disp_refr);
|
||||
@ -438,25 +440,27 @@ void _lv_disp_refr_timer(lv_timer_t * tmr)
|
||||
/*The buffers are already swapped.
|
||||
*So the active buffer is the off screen buffer where LVGL will render*/
|
||||
void * buf_off_screen = disp_refr->draw_buf_act;
|
||||
void * buf_on_screen = disp_refr->draw_buf_act == disp_refr->draw_buf_1 ? disp_refr->draw_buf_2 : disp_refr->draw_buf_1;
|
||||
void * buf_on_screen = disp_refr->draw_buf_act == disp_refr->draw_buf_1
|
||||
? disp_refr->draw_buf_2
|
||||
: disp_refr->draw_buf_1;
|
||||
|
||||
lv_coord_t stride = lv_disp_get_hor_res(disp_refr);
|
||||
uint32_t i;
|
||||
for(i = 0; i < disp_refr->inv_p; i++) {
|
||||
if(disp_refr->inv_area_joined[i]) continue;
|
||||
disp_refr->draw_ctx->buffer_copy(disp_refr->draw_ctx,
|
||||
disp_refr->draw_ctx->buffer_copy(
|
||||
disp_refr->draw_ctx,
|
||||
buf_off_screen, stride, &disp_refr->inv_areas[i],
|
||||
buf_on_screen, stride, &disp_refr->inv_areas[i]);
|
||||
}
|
||||
buf_on_screen, stride, &disp_refr->inv_areas[i]
|
||||
);
|
||||
}
|
||||
|
||||
/*Clean up*/
|
||||
refr_clean_up:
|
||||
lv_memzero(disp_refr->inv_areas, sizeof(disp_refr->inv_areas));
|
||||
lv_memzero(disp_refr->inv_area_joined, sizeof(disp_refr->inv_area_joined));
|
||||
disp_refr->inv_p = 0;
|
||||
|
||||
}
|
||||
|
||||
refr_cache_clean_up:
|
||||
_lv_font_clean_up_fmt_txt();
|
||||
|
||||
#if LV_USE_DRAW_MASKS
|
||||
|
Loading…
x
Reference in New Issue
Block a user