fix(canvas) allocate a fake driver on the stack

As of v8 drivers are no longer stored inside lv_disp_t, so a driver
needs to be allocated as well.

Fixes #2204
This commit is contained in:
Themba Dube 2021-04-21 13:09:55 -04:00
parent 7522858d07
commit 980c18fa51

View File

@ -579,7 +579,10 @@ void lv_canvas_draw_rect(lv_obj_t * canvas, lv_coord_t x, lv_coord_t y, lv_coord
coords.y2 = y + h - 1;
lv_disp_t disp;
/*Allocate the fake driver on the stack as the entire display doesn't outlive this function*/
lv_disp_drv_t driver;
lv_memset_00(&disp, sizeof(lv_disp_t));
disp.driver = &driver;
lv_disp_draw_buf_t draw_buf;
lv_disp_draw_buf_init(&draw_buf, (void *)dsc->data, NULL, dsc->header.w * dsc->header.h);
@ -637,7 +640,10 @@ void lv_canvas_draw_text(lv_obj_t * canvas, lv_coord_t x, lv_coord_t y, lv_coord
coords.y2 = dsc->header.h - 1;
lv_disp_t disp;
/*Allocate the fake driver on the stack as the entire display doesn't outlive this function*/
lv_disp_drv_t driver;
lv_memset_00(&disp, sizeof(lv_disp_t));
disp.driver = &driver;
lv_disp_draw_buf_t draw_buf;
lv_disp_draw_buf_init(&draw_buf, (void *)dsc->data, NULL, dsc->header.w * dsc->header.h);
@ -695,7 +701,10 @@ void lv_canvas_draw_img(lv_obj_t * canvas, lv_coord_t x, lv_coord_t y, const voi
coords.y2 = y + header.h - 1;
lv_disp_t disp;
/*Allocate the fake driver on the stack as the entire display doesn't outlive this function*/
lv_disp_drv_t driver;
lv_memset_00(&disp, sizeof(lv_disp_t));
disp.driver = &driver;
lv_disp_draw_buf_t draw_buf;
lv_disp_draw_buf_init(&draw_buf, (void *)dsc->data, NULL, dsc->header.w * dsc->header.h);
@ -739,7 +748,10 @@ void lv_canvas_draw_line(lv_obj_t * canvas, const lv_point_t points[], uint32_t
mask.y2 = dsc->header.h - 1;
lv_disp_t disp;
/*Allocate the fake driver on the stack as the entire display doesn't outlive this function*/
lv_disp_drv_t driver;
lv_memset_00(&disp, sizeof(lv_disp_t));
disp.driver = &driver;
lv_disp_draw_buf_t draw_buf;
lv_disp_draw_buf_init(&draw_buf, (void *)dsc->data, NULL, dsc->header.w * dsc->header.h);
@ -794,7 +806,10 @@ void lv_canvas_draw_polygon(lv_obj_t * canvas, const lv_point_t points[], uint32
mask.y2 = dsc->header.h - 1;
lv_disp_t disp;
/*Allocate the fake driver on the stack as the entire display doesn't outlive this function*/
lv_disp_drv_t driver;
lv_memset_00(&disp, sizeof(lv_disp_t));
disp.driver = &driver;
lv_disp_draw_buf_t draw_buf;
lv_disp_draw_buf_init(&draw_buf, (void *)dsc->data, NULL, dsc->header.w * dsc->header.h);
@ -847,7 +862,10 @@ void lv_canvas_draw_arc(lv_obj_t * canvas, lv_coord_t x, lv_coord_t y, lv_coord_
mask.y2 = dsc->header.h - 1;
lv_disp_t disp;
/*Allocate the fake driver on the stack as the entire display doesn't outlive this function*/
lv_disp_drv_t driver;
lv_memset_00(&disp, sizeof(lv_disp_t));
disp.driver = &driver;
lv_disp_draw_buf_t draw_buf;
lv_disp_draw_buf_init(&draw_buf, (void *)dsc->data, NULL, dsc->header.w * dsc->header.h);