diff --git a/src/libs/bin_decoder/lv_bin_decoder.c b/src/libs/bin_decoder/lv_bin_decoder.c index 604235fa7..b6a44c89a 100644 --- a/src/libs/bin_decoder/lv_bin_decoder.c +++ b/src/libs/bin_decoder/lv_bin_decoder.c @@ -399,7 +399,7 @@ lv_result_t lv_bin_decoder_get_area(lv_image_decoder_t * decoder, lv_image_decod int32_t w_px = lv_area_get_width(full_area); uint8_t * img_data = NULL; lv_draw_buf_t * decoded = NULL; - uint32_t offset = 0; + uint32_t offset = dsc->src_type == LV_IMAGE_SRC_FILE ? sizeof(lv_image_header_t) : 0; /*Skip the image header*/ /*We only support read line by line for now*/ if(decoded_area->y1 == LV_COORD_MIN) { @@ -443,7 +443,6 @@ lv_result_t lv_bin_decoder_get_area(lv_image_decoder_t * decoder, lv_image_decod offset += decoded_area->y1 * dsc->header.stride; offset += decoded_area->x1 * bpp / 8; /*Move to x1*/ if(dsc->src_type == LV_IMAGE_SRC_FILE) { - offset += sizeof(lv_image_header_t); /*File image starts with image header*/ buf = lv_malloc(len); LV_ASSERT_NULL(buf); if(buf == NULL) @@ -884,6 +883,7 @@ static lv_result_t decode_alpha_only(lv_image_decoder_t * decoder, lv_image_deco static lv_result_t decode_compressed(lv_image_decoder_t * decoder, lv_image_decoder_dsc_t * dsc) { +#if LV_BIN_DECODER_RAM_LOAD uint32_t rn; uint32_t len; uint32_t compressed_len; @@ -989,6 +989,13 @@ static lv_result_t decode_compressed(lv_image_decoder_t * decoder, lv_image_deco } return res; +#else + LV_UNUSED(decompress_image); + LV_UNUSED(decoder); + LV_UNUSED(dsc); + LV_LOG_ERROR("Need LV_BIN_DECODER_RAM_LOAD to be enabled"); + return LV_RESULT_INVALID; +#endif } static lv_result_t decode_indexed_line(lv_color_format_t color_format, const lv_color32_t * palette, int32_t x, diff --git a/tests/src/test_cases/draw/test_image_formats.c b/tests/src/test_cases/draw/test_image_formats.c index 91861508e..2a58f0a8c 100644 --- a/tests/src/test_cases/draw/test_image_formats.c +++ b/tests/src/test_cases/draw/test_image_formats.c @@ -22,8 +22,10 @@ static const char * color_formats[] = { static const char * compressions[] = { "UNCOMPRESSED", +#if LV_BIN_DECODER_RAM_LOAD == 1 "RLE", "LZ4" +#endif }; static const char * modes[] = { @@ -282,6 +284,9 @@ void test_image_formats(void) for(unsigned mode = 0; mode <= 3; mode++) { bool rotate = mode & 0x02; bool recolor = mode & 0x01; +#if LV_BIN_DECODER_RAM_LOAD == 0 + if(rotate) continue; /* Transform relies on LV_BIN_DECODER_RAM_LOAD to be enabled */ +#endif /*Loop compressions array and do test.*/ for(unsigned i = 0; i < sizeof(compressions) / sizeof(compressions[0]); i++) { char reference[256];