improve dirty_rects

This commit is contained in:
lixianjing 2021-07-16 15:24:59 +08:00
parent e339d0a5bd
commit b66d33cd76

View File

@ -25,13 +25,15 @@ static inline ret_t dirty_rects_dump(dirty_rects_t* dirty_rects) {
static inline ret_t dirty_rects_paint(dirty_rects_t* dirty_rects, widget_t* widget, canvas_t* c,
widget_on_paint_t on_paint) {
uint32_t cost = 0;
rect_t full_screen;
rect_t* iter = NULL;
uint64_t start = time_now_us();
return_value_if_fail(dirty_rects != NULL, RET_BAD_PARAMS);
return_value_if_fail(widget != NULL && c != NULL && on_paint != NULL, RET_BAD_PARAMS);
full_screen = rect_init(0, 0, c->lcd->w, c->lcd->h);
if (dirty_rects->disable_multiple) {
iter = &(dirty_rects->max);
if (dirty_rects->disable_multiple || !c->lcd->support_dirty_rect) {
iter = c->lcd->support_dirty_rect ? &(dirty_rects->max) : &full_screen;
widget_paint_with_clip(widget, iter, c, on_paint);
if (dirty_rects->profile) {
cost = time_now_us() - start;