fix(jpg): swap high and low bytes when macro LV_COLOR_16_SWAP is 1 (#3138)

This commit is contained in:
LY3T
2022-03-02 01:57:48 +08:00
committed by GitHub
parent c0575c57af
commit 5a3ca098f7

View File

@@ -766,7 +766,7 @@ static lv_res_t decoder_read_line(lv_img_decoder_t * decoder, lv_img_decoder_dsc
uint16_t col_16bit = (*cache++ & 0xf8) << 8; uint16_t col_16bit = (*cache++ & 0xf8) << 8;
col_16bit |= (*cache++ & 0xFC) << 3; col_16bit |= (*cache++ & 0xFC) << 3;
col_16bit |= (*cache++ >> 3); col_16bit |= (*cache++ >> 3);
#if LV_BIG_ENDIAN_SYSTEM == 1 #if LV_BIG_ENDIAN_SYSTEM == 1 || LV_COLOR_16_SWAP == 1
buf[offset++] = col_16bit >> 8; buf[offset++] = col_16bit >> 8;
buf[offset++] = col_16bit & 0xff; buf[offset++] = col_16bit & 0xff;
#else #else
@@ -830,7 +830,7 @@ static lv_res_t decoder_read_line(lv_img_decoder_t * decoder, lv_img_decoder_dsc
uint16_t col_8bit = (*cache++ & 0xf8) << 8; uint16_t col_8bit = (*cache++ & 0xf8) << 8;
col_8bit |= (*cache++ & 0xFC) << 3; col_8bit |= (*cache++ & 0xFC) << 3;
col_8bit |= (*cache++ >> 3); col_8bit |= (*cache++ >> 3);
#if LV_BIG_ENDIAN_SYSTEM == 1 #if LV_BIG_ENDIAN_SYSTEM == 1 || LV_COLOR_16_SWAP == 1
buf[offset++] = col_8bit >> 8; buf[offset++] = col_8bit >> 8;
buf[offset++] = col_8bit & 0xff; buf[offset++] = col_8bit & 0xff;
#else #else