1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-28 07:03:00 +08:00

fix(draw): Check for decoder result in sw_draw_img (#4416)

Signed-off-by: Peter Bee <bijunda1@xiaomi.com>
This commit is contained in:
Peter Bee 2023-07-31 18:46:33 +08:00 committed by GitHub
parent 5167731ede
commit 9beca819fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View File

@ -162,11 +162,12 @@ static lv_disp_t * lcd_init(int fd, int hor_res, int ver_res)
return NULL;
}
uint32_t px_size = lv_color_format_get_size(lv_disp_get_color_format(disp));
#if LV_NUTTX_LCD_BUFFER_COUNT > 0
uint32_t buf_size = hor_res * ver_res * sizeof(lv_color_t);
uint32_t buf_size = hor_res * ver_res * px_size;
lv_disp_render_mode_t render_mode = LV_DISP_RENDER_MODE_FULL;
#else
uint32_t buf_size = hor_res * LV_NUTTX_LCD_BUFFER_SIZE * sizeof(lv_color_t);
uint32_t buf_size = hor_res * LV_NUTTX_LCD_BUFFER_SIZE * px_size;
lv_disp_render_mode_t render_mode = LV_DISP_RENDER_MODE_PARTIAL;
#endif

View File

@ -168,7 +168,11 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_sw_img(lv_draw_unit_t * draw_unit, const lv_d
bool transformed = draw_dsc->angle != 0 || draw_dsc->zoom != LV_ZOOM_NONE ? true : false;
lv_img_decoder_dsc_t decoder_dsc;
lv_img_decoder_open(&decoder_dsc, draw_dsc->src, draw_dsc->recolor, -1);
lv_res_t res = lv_img_decoder_open(&decoder_dsc, draw_dsc->src, draw_dsc->recolor, -1);
if(res != LV_RES_OK) {
LV_LOG_ERROR("Failed to open image");
return;
}
const uint8_t * src_buf = decoder_dsc.img_data;
lv_color_format_t cf = decoder_dsc.header.cf;