diff --git a/lv_core/lv_disp.c b/lv_core/lv_disp.c index 5c108cd1f..6017ba27c 100644 --- a/lv_core/lv_disp.c +++ b/lv_core/lv_disp.c @@ -52,6 +52,18 @@ void lv_disp_pop_from_inv_buf(lv_disp_t * disp, uint16_t num) else disp->inv_p -= num; } +void lv_disp_assign_screen(lv_disp_t * disp, lv_obj_t * scr) +{ + lv_disp_t * old_disp = lv_scr_get_disp(scr); + + if(old_disp == disp) { + LV_LOG_WARN("lv_disp_assign_screen: tried to assign to the same screen") + return; + } + + lv_ll_chg_list(&old_disp->scr_ll, &disp->scr_ll, scr); +} + /********************** * STATIC FUNCTIONS **********************/ diff --git a/lv_core/lv_disp.h b/lv_core/lv_disp.h index aff3ce110..62690f551 100644 --- a/lv_core/lv_disp.h +++ b/lv_core/lv_disp.h @@ -14,6 +14,7 @@ extern "C" { * INCLUDES *********************/ #include "../lv_hal/lv_hal.h" +#include "lv_obj.h" /********************* * DEFINES @@ -26,6 +27,7 @@ extern "C" { /********************** * GLOBAL PROTOTYPES **********************/ +void lv_disp_assign_screen(lv_disp_t * disp, lv_obj_t * scr); /** * Get the number of areas in the buffer diff --git a/lv_core/lv_vdb.c b/lv_core/lv_vdb.c index 6ab6a9243..12523b2a2 100644 --- a/lv_core/lv_vdb.c +++ b/lv_core/lv_vdb.c @@ -111,7 +111,7 @@ void lv_vdb_flush(void) /*Flush the rendered content to the display*/ lv_disp_t * disp = lv_refr_get_disp_refreshing(); - if(disp->driver.disp_flush) disp->driver.disp_flush(vdb_act->area.x1, vdb_act->area.y1, vdb_act->area.x2, vdb_act->area.y2, vdb_act->buf); + if(disp->driver.disp_flush) disp->driver.disp_flush(disp, &vdb_act->area, vdb_act->buf); #if LV_VDB_DOUBLE diff --git a/lv_hal/lv_hal_disp.h b/lv_hal/lv_hal_disp.h index dd1060640..6480824a2 100644 --- a/lv_hal/lv_hal_disp.h +++ b/lv_hal/lv_hal_disp.h @@ -33,6 +33,8 @@ extern "C" { * TYPEDEFS **********************/ +struct _disp_t; + /** * Display Driver structure to be registered by HAL */ @@ -42,7 +44,7 @@ typedef struct _disp_drv_t { lv_coord_t ver_res; /*Write the internal buffer (VDB) to the display. 'lv_flush_ready()' has to be called when finished*/ - void (*disp_flush)(int32_t x1, int32_t y1, int32_t x2, int32_t y2, const lv_color_t * color_p); + void (*disp_flush)(struct _disp_t * disp, const lv_area_t * area, lv_color_t * color_p); /*Fill an area with a color on the display*/ void (*disp_fill)(int32_t x1, int32_t y1, int32_t x2, int32_t y2, lv_color_t color); @@ -68,15 +70,16 @@ typedef struct _disp_drv_t { struct _lv_obj_t; typedef struct _disp_t { + void * user_data; lv_disp_drv_t driver; - lv_area_t inv_areas[LV_INV_BUF_SIZE]; - uint8_t inv_area_joined[LV_INV_BUF_SIZE]; - uint16_t inv_p; lv_ll_t scr_ll; struct _lv_obj_t * act_scr; struct _lv_obj_t * top_layer; struct _lv_obj_t * sys_layer; - uint8_t orientation:2; + lv_area_t inv_areas[LV_INV_BUF_SIZE]; + uint8_t inv_area_joined[LV_INV_BUF_SIZE]; + uint16_t inv_p :10; + uint16_t orientation :2; } lv_disp_t; /**********************