arch(draw): add parallel rendering architecture

BREAKING CHANGE

This is a huge update which introduces parallel rendering. lv_conf.h needs to be updated too.
This commit is contained in:
Gabor Kiss-Vamosi
2023-07-05 13:05:19 +02:00
parent 08870996d1
commit f753265a79
637 changed files with 34425 additions and 35325 deletions

View File

@@ -18,8 +18,9 @@ static void timer_cb(lv_timer_t * timer)
static void event_cb(lv_event_t * e)
{
lv_obj_t * obj = lv_event_get_target(e);
lv_obj_draw_part_dsc_t * dsc = lv_event_get_draw_part_dsc(e);
if(dsc->class_p == &lv_obj_class && dsc->part == LV_PART_MAIN) {
lv_draw_task_t * draw_task = lv_event_get_draw_task(e);
lv_draw_dsc_base_t * base_dsc = draw_task->draw_dsc;
if(base_dsc->part == LV_PART_MAIN) {
lv_draw_rect_dsc_t draw_dsc;
lv_draw_rect_dsc_init(&draw_dsc);
draw_dsc.bg_color = lv_color_hex(0xffaaaa);
@@ -37,7 +38,7 @@ static void event_cb(lv_event_t * e)
a.y2 = size;
lv_area_align(&obj->coords, &a, LV_ALIGN_CENTER, 0, 0);
lv_draw_rect(dsc->draw_ctx, &draw_dsc, &a);
lv_draw_rect(base_dsc->layer, &draw_dsc, &a);
}
}
@@ -49,7 +50,8 @@ void lv_example_event_4(void)
lv_obj_t * cont = lv_obj_create(lv_scr_act());
lv_obj_set_size(cont, 200, 200);
lv_obj_center(cont);
lv_obj_add_event(cont, event_cb, LV_EVENT_DRAW_PART_END, NULL);
lv_obj_add_event(cont, event_cb, LV_EVENT_DRAW_TASK_ADDED, NULL);
lv_obj_add_flag(cont, LV_OBJ_FLAG_SEND_DRAW_TASK_EVENTS);
lv_timer_create(timer_cb, 30, cont);
}

View File

@@ -9,7 +9,8 @@ class LV_Example_Event_4:
self.cont = lv.obj(lv.scr_act())
self.cont.set_size(200, 200)
self.cont.center()
self.cont.add_event(self.event_cb, lv.EVENT.DRAW_PART_END, None)
self.cont.add_event(self.event_cb, lv.EVENT.DRAW_TASK_ADDED, None)
self.cont.add_flag(lv.obj.FLAG.SEND_DRAW_TASK_EVENTS)
lv.timer_create(self.timer_cb, 30, None)
def timer_cb(self,timer) :
@@ -26,18 +27,9 @@ class LV_Example_Event_4:
def event_cb(self,e) :
obj = e.get_target_obj()
dsc = e.get_draw_part_dsc()
if dsc.class_p == lv.obj_class and dsc.part == lv.PART.MAIN :
draw_dsc = lv.draw_rect_dsc_t()
draw_dsc.init()
draw_dsc.bg_color = lv.color_hex(0xffaaaa)
draw_dsc.radius = lv.RADIUS_CIRCLE
draw_dsc.border_color = lv.color_hex(0xff5555)
draw_dsc.border_width = 2
draw_dsc.outline_color = lv.color_hex(0xff0000)
draw_dsc.outline_pad = 3
draw_dsc.outline_width = 2
dsc = e.get_draw_task()
base_dsc = lv.draw_dsc_base_t.__cast__(dsc.draw_dsc)
if base_dsc.part == lv.PART.MAIN:
a = lv.area_t()
a.x1 = 0
a.y1 = 0
@@ -47,6 +39,15 @@ class LV_Example_Event_4:
obj.get_coords(coords)
coords.align(a, lv.ALIGN.CENTER, 0, 0)
dsc.draw_ctx.rect(draw_dsc, a)
draw_dsc = lv.draw_rect_dsc_t()
draw_dsc.init()
draw_dsc.bg_color = lv.color_hex(0xffaaaa)
draw_dsc.radius = lv.RADIUS_CIRCLE
draw_dsc.border_color = lv.color_hex(0xff5555)
draw_dsc.border_width = 2
draw_dsc.outline_color = lv.color_hex(0xff0000)
draw_dsc.outline_pad = 3
draw_dsc.outline_width = 2
lv.draw_rect(base_dsc.layer, draw_dsc, a)
lv_example_event_4 = LV_Example_Event_4()