mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-28 07:03:00 +08:00
fix(canvas): force canvas to use sw draw (#3045)
* force canvas to use sw draw * added userdata to lv_draw_sdl_drv_param_t * fixing build test * Update src/draw/sdl/lv_draw_sdl.h Co-authored-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com> Co-authored-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com>
This commit is contained in:
parent
8a2d72c35b
commit
70c2b57abe
@ -44,6 +44,7 @@ typedef struct {
|
||||
* Render for display driver
|
||||
*/
|
||||
SDL_Renderer * renderer;
|
||||
void * user_data;
|
||||
} lv_draw_sdl_drv_param_t;
|
||||
|
||||
typedef struct {
|
||||
|
@ -14,6 +14,8 @@
|
||||
|
||||
#if LV_USE_CANVAS != 0
|
||||
|
||||
#include "../draw/sw/lv_draw_sw.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
@ -844,12 +846,10 @@ static void init_fake_disp(lv_obj_t * canvas, lv_disp_t * disp, lv_disp_drv_t *
|
||||
disp->driver->hor_res = dsc->header.w;
|
||||
disp->driver->ver_res = dsc->header.h;
|
||||
|
||||
lv_disp_t * canvas_disp = lv_obj_get_disp(canvas);
|
||||
|
||||
lv_draw_ctx_t * draw_ctx = lv_mem_alloc(canvas_disp->driver->draw_ctx_size);
|
||||
lv_draw_ctx_t * draw_ctx = lv_mem_alloc(sizeof(lv_draw_sw_ctx_t));
|
||||
LV_ASSERT_MALLOC(draw_ctx);
|
||||
if(draw_ctx == NULL) return;
|
||||
canvas_disp->driver->draw_ctx_init(disp->driver, draw_ctx);
|
||||
lv_draw_sw_init_ctx(drv, draw_ctx);
|
||||
disp->driver->draw_ctx = draw_ctx;
|
||||
draw_ctx->clip_area = clip_area;
|
||||
draw_ctx->buf_area = clip_area;
|
||||
@ -860,8 +860,9 @@ static void init_fake_disp(lv_obj_t * canvas, lv_disp_t * disp, lv_disp_drv_t *
|
||||
|
||||
static void deinit_fake_disp(lv_obj_t * canvas, lv_disp_t * disp)
|
||||
{
|
||||
lv_disp_t * canvas_disp = lv_obj_get_disp(canvas);
|
||||
canvas_disp->driver->draw_ctx_deinit(disp->driver, disp->driver->draw_ctx);
|
||||
LV_UNUSED(canvas);
|
||||
lv_draw_sw_deinit_ctx(disp->driver, disp->driver->draw_ctx);
|
||||
lv_mem_free(disp->driver->draw_ctx);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user