img_decoder: handle error messages as placeholder.
This commit is contained in:
@@ -455,10 +455,14 @@ static lv_res_t lv_img_draw_core(const lv_area_t * coords, const lv_area_t * mas
|
|||||||
bool chroma_keyed = lv_img_color_format_is_chroma_keyed(cdsc->dsc.header.cf);
|
bool chroma_keyed = lv_img_color_format_is_chroma_keyed(cdsc->dsc.header.cf);
|
||||||
bool alpha_byte = lv_img_color_format_has_alpha(cdsc->dsc.header.cf);
|
bool alpha_byte = lv_img_color_format_has_alpha(cdsc->dsc.header.cf);
|
||||||
|
|
||||||
|
if(cdsc->dsc.error_msg != NULL) {
|
||||||
|
LV_LOG_WARN("Image draw error");
|
||||||
|
lv_draw_rect(coords, mask, &lv_style_plain, LV_OPA_COVER);
|
||||||
|
lv_draw_label(coords, mask, &lv_style_plain, LV_OPA_COVER, cdsc->dsc.error_msg, LV_TXT_FLAG_NONE, NULL, -1, -1, NULL);
|
||||||
|
}
|
||||||
/* The decoder open could open the image and gave the entire uncompressed image.
|
/* The decoder open could open the image and gave the entire uncompressed image.
|
||||||
* Just draw it!*/
|
* Just draw it!*/
|
||||||
if(cdsc->dsc.img_data) {
|
else if(cdsc->dsc.img_data) {
|
||||||
lv_draw_map(coords, mask, cdsc->dsc.img_data, opa, chroma_keyed, alpha_byte, style->image.color, style->image.intense);
|
lv_draw_map(coords, mask, cdsc->dsc.img_data, opa, chroma_keyed, alpha_byte, style->image.color, style->image.intense);
|
||||||
}
|
}
|
||||||
/* The whole uncompressed image is not available. Try to read it line-by-line*/
|
/* The whole uncompressed image is not available. Try to read it line-by-line*/
|
||||||
|
|||||||
@@ -134,7 +134,10 @@ lv_res_t lv_img_decoder_open(lv_img_decoder_dsc_t * dsc, const void * src, const
|
|||||||
LV_LL_READ(LV_GC_ROOT(_lv_img_defoder_ll), d)
|
LV_LL_READ(LV_GC_ROOT(_lv_img_defoder_ll), d)
|
||||||
{
|
{
|
||||||
res = LV_RES_INV;
|
res = LV_RES_INV;
|
||||||
|
dsc->error_msg = NULL;
|
||||||
|
dsc->img_data = NULL;
|
||||||
dsc->decoder = d;
|
dsc->decoder = d;
|
||||||
|
|
||||||
if(d->open_cb) res = d->open_cb(d, dsc);
|
if(d->open_cb) res = d->open_cb(d, dsc);
|
||||||
|
|
||||||
if(res == LV_RES_OK) break;
|
if(res == LV_RES_OK) break;
|
||||||
|
|||||||
Reference in New Issue
Block a user