From 6a47c6f33ac51a69cf241d43b74933c09c5d175f Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Fri, 12 May 2023 13:23:32 +0200 Subject: [PATCH] feat(refr): in DIRECT_MODE pass the refreshed area in flush_cb related to https://github.com/lvgl/lvgl/issues/4011#issuecomment-1543741410 --- src/core/lv_refr.c | 5 ++++- src/draw/lv_draw.h | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/core/lv_refr.c b/src/core/lv_refr.c index 51419cfb1..958e3d621 100644 --- a/src/core/lv_refr.c +++ b/src/core/lv_refr.c @@ -446,11 +446,13 @@ static void refr_area(const lv_area_t * area_p) if(disp_refr->render_mode == LV_DISP_RENDER_MODE_FULL) { disp_refr->last_part = 1; draw_ctx->clip_area = &disp_area; + draw_ctx->clip_area_original = disp_area; refr_area_part(draw_ctx); } else if(disp_refr->render_mode == LV_DISP_RENDER_MODE_DIRECT) { disp_refr->last_part = disp_refr->last_area; draw_ctx->clip_area = area_p; + draw_ctx->clip_area_original = *area_p; refr_area_part(draw_ctx); } return; @@ -490,6 +492,7 @@ static void refr_area(const lv_area_t * area_p) sub_area.x2 = area_p->x2; sub_area.y1 = row; sub_area.y2 = y2; + draw_ctx->clip_area_original = sub_area; draw_ctx->buf_area = &sub_area; draw_ctx->clip_area = &sub_area; draw_ctx->buf = disp_refr->draw_buf_act; @@ -1055,7 +1058,7 @@ static void draw_buf_flush(lv_disp_t * disp) draw_buf_rotate(draw_ctx->buf_area, draw_ctx->buf); } else { - call_flush_cb(disp, draw_ctx->buf_area, draw_ctx->buf); + call_flush_cb(disp, &draw_ctx->clip_area_original, draw_ctx->buf); } } /*If there are 2 buffers swap them. With direct mode swap only on the last area*/ diff --git a/src/draw/lv_draw.h b/src/draw/lv_draw.h index b8710a59d..0a9aab752 100644 --- a/src/draw/lv_draw.h +++ b/src/draw/lv_draw.h @@ -73,6 +73,9 @@ typedef struct _lv_draw_ctx_t { */ const lv_area_t * clip_area; + /** The original area which is updated*/ + lv_area_t clip_area_original; + /** * The rendered image in draw_ctx->buf will be converted to this format * using draw_ctx->buffer_convert.