test(draw): add rendering test for RGB565, RGB888, XRGRB8888, and ARGB8888

This commit is contained in:
Gabor Kiss-Vamosi
2023-11-15 12:51:48 +01:00
parent 628fb98b52
commit 6e91a1e99c
98 changed files with 249 additions and 82 deletions

View File

@@ -662,7 +662,7 @@ static void refr_area_part(lv_layer_t * layer)
}
/*If the screen is transparent initialize it when the flushing is ready*/
if(lv_color_format_has_alpha(disp_refr->color_format)) {
uint32_t w = layer->buf_stride;
uint32_t w = lv_area_get_width(&layer->buf_area);
uint32_t h = lv_area_get_height(&layer->buf_area);
lv_draw_buf_clear(layer->buf, w, h, layer->color_format, &disp_refr->refreshed_area);
}

View File

@@ -47,13 +47,12 @@ void lv_draw_sw_blend(lv_draw_unit_t * draw_unit, const lv_draw_sw_blend_dsc_t *
lv_layer_t * layer = draw_unit->target_layer;
uint32_t layer_stride_byte = lv_draw_buf_width_to_stride(lv_area_get_width(&layer->buf_area), layer->color_format);
uint32_t layer_stride_px = layer_stride_byte / lv_color_format_get_size(layer->color_format);
if(blend_dsc->src_buf == NULL) {
_lv_draw_sw_blend_fill_dsc_t fill_dsc;
fill_dsc.dest_w = lv_area_get_width(&blend_area);
fill_dsc.dest_h = lv_area_get_height(&blend_area);
fill_dsc.dest_stride = layer_stride_px;
fill_dsc.dest_stride = layer_stride_byte;
fill_dsc.opa = blend_dsc->opa;
fill_dsc.color = blend_dsc->color;
@@ -93,7 +92,7 @@ void lv_draw_sw_blend(lv_draw_unit_t * draw_unit, const lv_draw_sw_blend_dsc_t *
_lv_draw_sw_blend_image_dsc_t image_dsc;
image_dsc.dest_w = lv_area_get_width(&blend_area);
image_dsc.dest_h = lv_area_get_height(&blend_area);
image_dsc.dest_stride = layer_stride_px;
image_dsc.dest_stride = layer_stride_byte;
image_dsc.opa = blend_dsc->opa;
image_dsc.blend_mode = blend_dsc->blend_mode;

View File

@@ -68,7 +68,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_sw_blend_color_to_argb8888(_lv_draw_sw_blend_
lv_opa_t opa = dsc->opa;
const lv_opa_t * mask = dsc->mask_buf;
int32_t mask_stride = dsc->mask_stride;
int32_t dest_stride = dsc->dest_stride;
int32_t dest_stride_px = dsc->dest_stride / 4;
lv_color_mix_alpha_cache_t cache;
lv_color_mix_with_alpha_cache_init(&cache);
@@ -106,7 +106,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_sw_blend_color_to_argb8888(_lv_draw_sw_blend_
dest_buf[x] = color32;
}
dest_buf += dest_stride;
dest_buf += dest_stride_px;
}
}
/*Opacity only*/
@@ -118,7 +118,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_sw_blend_color_to_argb8888(_lv_draw_sw_blend_
for(x = 0; x < w; x++) {
dest_buf[x] = lv_color_32_32_mix(color_argb, dest_buf[x], &cache);
}
dest_buf += dest_stride;
dest_buf += dest_stride_px;
}
}
/*Masked with full opacity*/
@@ -131,7 +131,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_sw_blend_color_to_argb8888(_lv_draw_sw_blend_
dest_buf[x] = lv_color_32_32_mix(color_argb, dest_buf[x], &cache);
}
dest_buf += dest_stride;
dest_buf += dest_stride_px;
mask += mask_stride;
}
}
@@ -144,7 +144,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_sw_blend_color_to_argb8888(_lv_draw_sw_blend_
color_argb.alpha = LV_OPA_MIX2(mask[x], opa);
dest_buf[x] = lv_color_32_32_mix(color_argb, dest_buf[x], &cache);
}
dest_buf += dest_stride;
dest_buf += dest_stride_px;
mask += mask_stride;
}
}
@@ -181,7 +181,7 @@ LV_ATTRIBUTE_FAST_MEM static void rgb565_image_blend(_lv_draw_sw_blend_image_dsc
int32_t h = dsc->dest_h;
lv_opa_t opa = dsc->opa;
lv_color32_t * dest_buf_c32 = dsc->dest_buf;
int32_t dest_stride = dsc->dest_stride;
int32_t dest_stride_px = dsc->dest_stride / 4;
const lv_color16_t * src_buf_c16 = (const lv_color16_t *) dsc->src_buf;
int32_t src_stride = dsc->src_stride;
const lv_opa_t * mask_buf = dsc->mask_buf;
@@ -204,7 +204,7 @@ LV_ATTRIBUTE_FAST_MEM static void rgb565_image_blend(_lv_draw_sw_blend_image_dsc
color_argb.blue = (src_buf_c16[x].blue * 2106) >> 8;
dest_buf_c32[x] = lv_color_32_32_mix(color_argb, dest_buf_c32[x], &cache);
}
dest_buf_c32 += dest_stride;
dest_buf_c32 += dest_stride_px;
src_buf_c16 += src_stride;
}
}
@@ -217,7 +217,7 @@ LV_ATTRIBUTE_FAST_MEM static void rgb565_image_blend(_lv_draw_sw_blend_image_dsc
color_argb.blue = (src_buf_c16[x].blue * 2106) >> 8;
dest_buf_c32[x] = lv_color_32_32_mix(color_argb, dest_buf_c32[x], &cache);
}
dest_buf_c32 += dest_stride;
dest_buf_c32 += dest_stride_px;
src_buf_c16 += src_stride;
mask_buf += mask_stride;
}
@@ -231,7 +231,7 @@ LV_ATTRIBUTE_FAST_MEM static void rgb565_image_blend(_lv_draw_sw_blend_image_dsc
color_argb.blue = (src_buf_c16[x].blue * 2106) >> 8;
dest_buf_c32[x] = lv_color_32_32_mix(color_argb, dest_buf_c32[x], &cache);
}
dest_buf_c32 += dest_stride;
dest_buf_c32 += dest_stride_px;
src_buf_c16 += src_stride;
mask_buf += mask_stride;
}
@@ -249,7 +249,7 @@ LV_ATTRIBUTE_FAST_MEM static void rgb565_image_blend(_lv_draw_sw_blend_image_dsc
blend_non_normal_pixel(&dest_buf_c32[x], src_argb, dsc->blend_mode, &cache);
}
if(mask_buf) mask_buf += mask_stride;
dest_buf_c32 += dest_stride;
dest_buf_c32 += dest_stride_px;
src_buf_c16 += src_stride;
}
}
@@ -262,7 +262,7 @@ LV_ATTRIBUTE_FAST_MEM static void rgb888_image_blend(_lv_draw_sw_blend_image_dsc
int32_t h = dsc->dest_h;
lv_opa_t opa = dsc->opa;
lv_color32_t * dest_buf_c32 = dsc->dest_buf;
int32_t dest_stride = dsc->dest_stride;
int32_t dest_stride_px = dsc->dest_stride / 4;
const uint8_t * src_buf = dsc->src_buf;
int32_t src_stride = dsc->src_stride * src_px_size;
const lv_opa_t * mask_buf = dsc->mask_buf;
@@ -283,7 +283,7 @@ LV_ATTRIBUTE_FAST_MEM static void rgb888_image_blend(_lv_draw_sw_blend_image_dsc
uint32_t line_in_bytes = w * 4;
for(y = 0; y < h; y++) {
lv_memcpy(dest_buf_c32, src_buf, line_in_bytes);
dest_buf_c32 += dest_stride;
dest_buf_c32 += dest_stride_px;
src_buf += src_stride;
}
}
@@ -295,7 +295,7 @@ LV_ATTRIBUTE_FAST_MEM static void rgb888_image_blend(_lv_draw_sw_blend_image_dsc
dest_buf_c32[dest_x].blue = src_buf[src_x + 0];
dest_buf_c32[dest_x].alpha = 0xff;
}
dest_buf_c32 += dest_stride;
dest_buf_c32 += dest_stride_px;
src_buf += src_stride;
}
}
@@ -309,7 +309,7 @@ LV_ATTRIBUTE_FAST_MEM static void rgb888_image_blend(_lv_draw_sw_blend_image_dsc
color_argb.blue = src_buf[src_x + 0];
dest_buf_c32[dest_x] = lv_color_32_32_mix(color_argb, dest_buf_c32[dest_x], &cache);
}
dest_buf_c32 += dest_stride;
dest_buf_c32 += dest_stride_px;
src_buf += src_stride;
}
}
@@ -322,7 +322,7 @@ LV_ATTRIBUTE_FAST_MEM static void rgb888_image_blend(_lv_draw_sw_blend_image_dsc
color_argb.blue = src_buf[src_x + 0];
dest_buf_c32[dest_x] = lv_color_32_32_mix(color_argb, dest_buf_c32[dest_x], &cache);
}
dest_buf_c32 += dest_stride;
dest_buf_c32 += dest_stride_px;
src_buf += src_stride;
mask_buf += mask_stride;
}
@@ -336,7 +336,7 @@ LV_ATTRIBUTE_FAST_MEM static void rgb888_image_blend(_lv_draw_sw_blend_image_dsc
color_argb.blue = src_buf[src_x + 0];
dest_buf_c32[dest_x] = lv_color_32_32_mix(color_argb, dest_buf_c32[dest_x], &cache);
}
dest_buf_c32 += dest_stride;
dest_buf_c32 += dest_stride_px;
src_buf += src_stride;
mask_buf += mask_stride;
}
@@ -355,7 +355,7 @@ LV_ATTRIBUTE_FAST_MEM static void rgb888_image_blend(_lv_draw_sw_blend_image_dsc
blend_non_normal_pixel(&dest_buf_c32[dest_x], src_argb, dsc->blend_mode, &cache);
}
if(mask_buf) mask_buf += mask_stride;
dest_buf_c32 += dest_stride;
dest_buf_c32 += dest_stride_px;
src_buf += src_stride;
}
}
@@ -367,7 +367,7 @@ LV_ATTRIBUTE_FAST_MEM static void argb8888_image_blend(_lv_draw_sw_blend_image_d
int32_t h = dsc->dest_h;
lv_opa_t opa = dsc->opa;
lv_color32_t * dest_buf_c32 = dsc->dest_buf;
int32_t dest_stride = dsc->dest_stride;
int32_t dest_stride_px = dsc->dest_stride / 4;
const lv_color32_t * src_buf_c32 = dsc->src_buf;
int32_t src_stride = dsc->src_stride;
const lv_opa_t * mask_buf = dsc->mask_buf;
@@ -386,7 +386,7 @@ LV_ATTRIBUTE_FAST_MEM static void argb8888_image_blend(_lv_draw_sw_blend_image_d
for(x = 0; x < w; x++) {
dest_buf_c32[x] = lv_color_32_32_mix(src_buf_c32[x], dest_buf_c32[x], &cache);
}
dest_buf_c32 += dest_stride;
dest_buf_c32 += dest_stride_px;
src_buf_c32 += src_stride;
}
}
@@ -397,7 +397,7 @@ LV_ATTRIBUTE_FAST_MEM static void argb8888_image_blend(_lv_draw_sw_blend_image_d
color_argb.alpha = LV_OPA_MIX2(color_argb.alpha, opa);
dest_buf_c32[x] = lv_color_32_32_mix(color_argb, dest_buf_c32[x], &cache);
}
dest_buf_c32 += dest_stride;
dest_buf_c32 += dest_stride_px;
src_buf_c32 += src_stride;
}
}
@@ -408,7 +408,7 @@ LV_ATTRIBUTE_FAST_MEM static void argb8888_image_blend(_lv_draw_sw_blend_image_d
color_argb.alpha = LV_OPA_MIX2(color_argb.alpha, mask_buf[x]);
dest_buf_c32[x] = lv_color_32_32_mix(color_argb, dest_buf_c32[x], &cache);
}
dest_buf_c32 += dest_stride;
dest_buf_c32 += dest_stride_px;
src_buf_c32 += src_stride;
mask_buf += mask_stride;
}
@@ -420,7 +420,7 @@ LV_ATTRIBUTE_FAST_MEM static void argb8888_image_blend(_lv_draw_sw_blend_image_d
color_argb.alpha = LV_OPA_MIX3(color_argb.alpha, opa, mask_buf[x]);
dest_buf_c32[x] = lv_color_32_32_mix(color_argb, dest_buf_c32[x], &cache);
}
dest_buf_c32 += dest_stride;
dest_buf_c32 += dest_stride_px;
src_buf_c32 += src_stride;
mask_buf += mask_stride;
}
@@ -435,7 +435,7 @@ LV_ATTRIBUTE_FAST_MEM static void argb8888_image_blend(_lv_draw_sw_blend_image_d
blend_non_normal_pixel(&dest_buf_c32[x], color_argb, dsc->blend_mode, &cache);
}
if(mask_buf) mask_buf += mask_stride;
dest_buf_c32 += dest_stride;
dest_buf_c32 += dest_stride_px;
src_buf_c32 += src_stride;
}
}

View File

@@ -70,7 +70,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_sw_blend_color_to_rgb565(_lv_draw_sw_blend_fi
const lv_opa_t * mask = dsc->mask_buf;
int32_t mask_stride = dsc->mask_stride;
uint16_t * dest_buf_u16 = dsc->dest_buf;
int32_t dest_stride = dsc->dest_stride;
int32_t dest_stride_px = dsc->dest_stride / 2;
int32_t x;
int32_t y;
@@ -106,7 +106,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_sw_blend_color_to_rgb565(_lv_draw_sw_blend_fi
dest_buf_u16++;
}
dest_buf_u16 += dest_stride - w;
dest_buf_u16 += dest_stride_px - w;
}
}
/*Opacity only*/
@@ -145,7 +145,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_sw_blend_color_to_rgb565(_lv_draw_sw_blend_fi
for(; x < w ; x++) {
dest_buf_u16[x] = lv_color_16_16_mix(color16, dest_buf_u16[x], opa);
}
dest_buf_u16 += dest_stride;
dest_buf_u16 += dest_stride_px;
}
}
@@ -183,7 +183,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_sw_blend_color_to_rgb565(_lv_draw_sw_blend_fi
for(; x < w ; x++) {
dest_buf_u16[x] = lv_color_16_16_mix(color16, dest_buf_u16[x], mask[x]);
}
dest_buf_u16 += dest_stride;
dest_buf_u16 += dest_stride_px;
mask += mask_stride;
}
}
@@ -193,7 +193,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_sw_blend_color_to_rgb565(_lv_draw_sw_blend_fi
for(x = 0; x < w; x++) {
dest_buf_u16[x] = lv_color_16_16_mix(color16, dest_buf_u16[x], LV_OPA_MIX2(mask[x], opa));
}
dest_buf_u16 += dest_stride;
dest_buf_u16 += dest_stride_px;
mask += mask_stride;
}
}
@@ -231,7 +231,7 @@ LV_ATTRIBUTE_FAST_MEM static void rgb565_image_blend(_lv_draw_sw_blend_image_dsc
int32_t h = dsc->dest_h;
lv_opa_t opa = dsc->opa;
uint16_t * dest_buf_u16 = dsc->dest_buf;
int32_t dest_stride = dsc->dest_stride;
int32_t dest_stride_px = dsc->dest_stride / 2;
const uint16_t * src_buf_u16 = dsc->src_buf;
int32_t src_stride = dsc->src_stride;
const lv_opa_t * mask_buf = dsc->mask_buf;
@@ -245,7 +245,7 @@ LV_ATTRIBUTE_FAST_MEM static void rgb565_image_blend(_lv_draw_sw_blend_image_dsc
uint32_t line_in_bytes = w * 2;
for(y = 0; y < h; y++) {
lv_memcpy(dest_buf_u16, src_buf_u16, line_in_bytes);
dest_buf_u16 += dest_stride;
dest_buf_u16 += dest_stride_px;
src_buf_u16 += src_stride;
}
}
@@ -254,7 +254,7 @@ LV_ATTRIBUTE_FAST_MEM static void rgb565_image_blend(_lv_draw_sw_blend_image_dsc
for(x = 0; x < w; x++) {
dest_buf_u16[x] = lv_color_16_16_mix(src_buf_u16[x], dest_buf_u16[x], opa);
}
dest_buf_u16 += dest_stride;
dest_buf_u16 += dest_stride_px;
src_buf_u16 += src_stride;
}
}
@@ -263,7 +263,7 @@ LV_ATTRIBUTE_FAST_MEM static void rgb565_image_blend(_lv_draw_sw_blend_image_dsc
for(x = 0; x < w; x++) {
dest_buf_u16[x] = lv_color_16_16_mix(src_buf_u16[x], dest_buf_u16[x], mask_buf[x]);
}
dest_buf_u16 += dest_stride;
dest_buf_u16 += dest_stride_px;
src_buf_u16 += src_stride;
mask_buf += mask_stride;
}
@@ -273,7 +273,7 @@ LV_ATTRIBUTE_FAST_MEM static void rgb565_image_blend(_lv_draw_sw_blend_image_dsc
for(x = 0; x < w; x++) {
dest_buf_u16[x] = lv_color_16_16_mix(src_buf_u16[x], dest_buf_u16[x], LV_OPA_MIX2(mask_buf[x], opa));
}
dest_buf_u16 += dest_stride;
dest_buf_u16 += dest_stride_px;
src_buf_u16 += src_stride;
mask_buf += mask_stride;
}
@@ -318,7 +318,7 @@ LV_ATTRIBUTE_FAST_MEM static void rgb565_image_blend(_lv_draw_sw_blend_image_dsc
}
}
dest_buf_u16 += dest_stride;
dest_buf_u16 += dest_stride_px;
src_buf_u16 += src_stride;
if(mask_buf) mask_buf += mask_stride;
}
@@ -331,7 +331,7 @@ LV_ATTRIBUTE_FAST_MEM static void rgb888_image_blend(_lv_draw_sw_blend_image_dsc
int32_t h = dsc->dest_h;
lv_opa_t opa = dsc->opa;
uint16_t * dest_buf_u16 = dsc->dest_buf;
int32_t dest_stride = dsc->dest_stride;
int32_t dest_stride_px = dsc->dest_stride / 2;
const uint8_t * src_buf_u8 = dsc->src_buf;
int32_t src_stride = dsc->src_stride * src_px_size;
const lv_opa_t * mask_buf = dsc->mask_buf;
@@ -349,7 +349,7 @@ LV_ATTRIBUTE_FAST_MEM static void rgb888_image_blend(_lv_draw_sw_blend_image_dsc
((src_buf_u8[src_x + 1] & 0xFC) << 3) +
((src_buf_u8[src_x + 0] & 0xF8) >> 3);
}
dest_buf_u16 += dest_stride;
dest_buf_u16 += dest_stride_px;
src_buf_u8 += src_stride;
}
}
@@ -358,7 +358,7 @@ LV_ATTRIBUTE_FAST_MEM static void rgb888_image_blend(_lv_draw_sw_blend_image_dsc
for(dest_x = 0, src_x = 0; dest_x < w; dest_x++, src_x += src_px_size) {
dest_buf_u16[dest_x] = lv_color_24_16_mix(&src_buf_u8[src_x], dest_buf_u16[dest_x], opa);
}
dest_buf_u16 += dest_stride;
dest_buf_u16 += dest_stride_px;
src_buf_u8 += src_stride;
}
}
@@ -367,7 +367,7 @@ LV_ATTRIBUTE_FAST_MEM static void rgb888_image_blend(_lv_draw_sw_blend_image_dsc
for(dest_x = 0, src_x = 0; dest_x < w; dest_x++, src_x += src_px_size) {
dest_buf_u16[dest_x] = lv_color_24_16_mix(&src_buf_u8[src_x], dest_buf_u16[dest_x], mask_buf[dest_x]);
}
dest_buf_u16 += dest_stride;
dest_buf_u16 += dest_stride_px;
src_buf_u8 += src_stride;
mask_buf += mask_stride;
}
@@ -377,7 +377,7 @@ LV_ATTRIBUTE_FAST_MEM static void rgb888_image_blend(_lv_draw_sw_blend_image_dsc
for(dest_x = 0, src_x = 0; dest_x < w; dest_x++, src_x += src_px_size) {
dest_buf_u16[dest_x] = lv_color_24_16_mix(&src_buf_u8[src_x], dest_buf_u16[dest_x], LV_OPA_MIX2(mask_buf[dest_x], opa));
}
dest_buf_u16 += dest_stride;
dest_buf_u16 += dest_stride_px;
src_buf_u8 += src_stride;
mask_buf += mask_stride;
}
@@ -420,7 +420,7 @@ LV_ATTRIBUTE_FAST_MEM static void rgb888_image_blend(_lv_draw_sw_blend_image_dsc
}
}
dest_buf_u16 += dest_stride;
dest_buf_u16 += dest_stride_px;
src_buf_u8 += src_stride;
if(mask_buf) mask_buf += mask_stride;
}
@@ -432,7 +432,7 @@ LV_ATTRIBUTE_FAST_MEM static void argb8888_image_blend(_lv_draw_sw_blend_image_d
int32_t h = dsc->dest_h;
lv_opa_t opa = dsc->opa;
uint16_t * dest_buf_u16 = dsc->dest_buf;
int32_t dest_stride = dsc->dest_stride;
int32_t dest_stride_px = dsc->dest_stride / 2;
const uint8_t * src_buf_u8 = dsc->src_buf;
int32_t src_stride = dsc->src_stride * 4;
const lv_opa_t * mask_buf = dsc->mask_buf;
@@ -448,7 +448,7 @@ LV_ATTRIBUTE_FAST_MEM static void argb8888_image_blend(_lv_draw_sw_blend_image_d
for(dest_x = 0, src_x = 0; dest_x < w; dest_x++, src_x += 4) {
dest_buf_u16[dest_x] = lv_color_24_16_mix(&src_buf_u8[src_x], dest_buf_u16[dest_x], src_buf_u8[src_x + 3]);
}
dest_buf_u16 += dest_stride;
dest_buf_u16 += dest_stride_px;
src_buf_u8 += src_stride;
}
}
@@ -458,7 +458,7 @@ LV_ATTRIBUTE_FAST_MEM static void argb8888_image_blend(_lv_draw_sw_blend_image_d
dest_buf_u16[dest_x] = lv_color_24_16_mix(&src_buf_u8[src_x], dest_buf_u16[dest_x], LV_OPA_MIX2(src_buf_u8[src_x + 3],
opa));
}
dest_buf_u16 += dest_stride;
dest_buf_u16 += dest_stride_px;
src_buf_u8 += src_stride;
}
}
@@ -468,7 +468,7 @@ LV_ATTRIBUTE_FAST_MEM static void argb8888_image_blend(_lv_draw_sw_blend_image_d
dest_buf_u16[dest_x] = lv_color_24_16_mix(&src_buf_u8[src_x], dest_buf_u16[dest_x],
LV_OPA_MIX2(src_buf_u8[src_x + 3], mask_buf[dest_x]));
}
dest_buf_u16 += dest_stride;
dest_buf_u16 += dest_stride_px;
src_buf_u8 += src_stride;
mask_buf += mask_stride;
}
@@ -479,7 +479,7 @@ LV_ATTRIBUTE_FAST_MEM static void argb8888_image_blend(_lv_draw_sw_blend_image_d
dest_buf_u16[dest_x] = lv_color_24_16_mix(&src_buf_u8[src_x], dest_buf_u16[dest_x],
LV_OPA_MIX3(src_buf_u8[src_x + 3], mask_buf[dest_x], opa));
}
dest_buf_u16 += dest_stride;
dest_buf_u16 += dest_stride_px;
src_buf_u8 += src_stride;
mask_buf += mask_stride;
}
@@ -524,7 +524,7 @@ LV_ATTRIBUTE_FAST_MEM static void argb8888_image_blend(_lv_draw_sw_blend_image_d
}
}
dest_buf_u16 += dest_stride;
dest_buf_u16 += dest_stride_px;
src_buf_u8 += src_stride;
if(mask_buf) mask_buf += mask_stride;
}

View File

@@ -86,7 +86,6 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_sw_blend_color_to_rgb888(_lv_draw_sw_blend_fi
if(dest_px_size == 3) {
uint8_t * dest_buf_u8 = dsc->dest_buf;
uint8_t * dest_buf_ori = dsc->dest_buf;
dest_stride *= dest_px_size;
w *= dest_px_size;
for(x = 0; x < w; x += 3) {
@@ -105,6 +104,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_sw_blend_color_to_rgb888(_lv_draw_sw_blend_fi
if(dest_px_size == 4) {
uint32_t color32 = lv_color_to_u32(dsc->color);
uint32_t * dest_buf_u32 = dsc->dest_buf;
uint32_t dest_stride_px = dest_stride / 4;
for(y = 0; y < h; y++) {
for(x = 0; x <= w - 16; x += 16) {
dest_buf_u32[x + 0] = color32;
@@ -131,7 +131,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_sw_blend_color_to_rgb888(_lv_draw_sw_blend_fi
dest_buf_u32[x] = color32;
}
dest_buf_u32 += dest_stride;
dest_buf_u32 += dest_stride_px;
}
}
#endif
@@ -143,7 +143,6 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_sw_blend_color_to_rgb888(_lv_draw_sw_blend_fi
#else
uint32_t color32 = lv_color_to_u32(dsc->color);
uint8_t * dest_buf = dsc->dest_buf;
dest_stride *= dest_px_size;
w *= dest_px_size;
for(y = 0; y < h; y++) {
for(x = 0; x < w; x += dest_px_size) {
@@ -160,7 +159,6 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_sw_blend_color_to_rgb888(_lv_draw_sw_blend_fi
#else
uint32_t color32 = lv_color_to_u32(dsc->color);
uint8_t * dest_buf = dsc->dest_buf;
dest_stride *= dest_px_size;
w *= dest_px_size;
for(y = 0; y < h; y++) {
@@ -180,7 +178,6 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_sw_blend_color_to_rgb888(_lv_draw_sw_blend_fi
#else
uint32_t color32 = lv_color_to_u32(dsc->color);
uint8_t * dest_buf = dsc->dest_buf;
dest_stride *= dest_px_size;
w *= dest_px_size;
for(y = 0; y < h; y++) {
@@ -226,7 +223,7 @@ LV_ATTRIBUTE_FAST_MEM static void rgb565_image_blend(_lv_draw_sw_blend_image_dsc
int32_t h = dsc->dest_h;
lv_opa_t opa = dsc->opa;
uint8_t * dest_buf_u8 = dsc->dest_buf;
int32_t dest_stride = dsc->dest_stride * dest_px_size;
int32_t dest_stride = dsc->dest_stride;
const lv_color16_t * src_buf_c16 = (const lv_color16_t *) dsc->src_buf;
int32_t src_stride = dsc->src_stride;
const lv_opa_t * mask_buf = dsc->mask_buf;
@@ -315,7 +312,7 @@ LV_ATTRIBUTE_FAST_MEM static void rgb888_image_blend(_lv_draw_sw_blend_image_dsc
int32_t h = dsc->dest_h;
lv_opa_t opa = dsc->opa;
uint8_t * dest_buf = dsc->dest_buf;
int32_t dest_stride = dsc->dest_stride * dest_px_size;
int32_t dest_stride = dsc->dest_stride;
const uint8_t * src_buf = dsc->src_buf;
int32_t src_stride = dsc->src_stride * src_px_size;
const lv_opa_t * mask_buf = dsc->mask_buf;
@@ -404,7 +401,7 @@ LV_ATTRIBUTE_FAST_MEM static void argb8888_image_blend(_lv_draw_sw_blend_image_d
int32_t h = dsc->dest_h;
lv_opa_t opa = dsc->opa;
uint8_t * dest_buf = dsc->dest_buf;
int32_t dest_stride = dsc->dest_stride * dest_px_size;
int32_t dest_stride = dsc->dest_stride;
const lv_color32_t * src_buf_c32 = dsc->src_buf;
int32_t src_stride = dsc->src_stride;
const lv_opa_t * mask_buf = dsc->mask_buf;

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 9.1 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB

View File

Before

Width:  |  Height:  |  Size: 9.1 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

View File

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 48 KiB

View File

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 54 KiB

View File

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 43 KiB

View File

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 49 KiB

View File

Before

Width:  |  Height:  |  Size: 64 KiB

After

Width:  |  Height:  |  Size: 64 KiB

View File

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 60 KiB

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View File

@@ -0,0 +1,37 @@
#if LV_BUILD_TEST || 1
#include "../lvgl.h"
#include "../demos/lv_demos.h"
#include "unity/unity.h"
void setUp(void)
{
/* Function run before every test */
}
void tearDown(void)
{
/* Function run after every test */
lv_display_set_color_format(NULL, LV_COLOR_FORMAT_XRGB8888);
}
void test_render_to_rgb565(void)
{
lv_display_set_color_format(NULL, LV_COLOR_FORMAT_ARGB8888);
lv_opa_t opa_values[2] = {0xff, 0x80};
uint32_t opa;
for(opa = 0; opa < 2; opa++) {
uint32_t i;
for(i = 0; i < _LV_DEMO_RENDER_SCENE_NUM; i++) {
lv_demo_render(i, opa_values[opa]);
char buf[128];
lv_snprintf(buf, sizeof(buf), "draw/render/argb8888/demo_render_%s_opa_%d.png",
lv_demo_render_get_scene_name(i), opa_values[opa]);
TEST_ASSERT_EQUAL_SCREENSHOT(buf);
}
}
}
#endif

View File

@@ -1,4 +1,4 @@
#if LV_BUILD_TEST
#if LV_BUILD_TEST || 1
#include "../lvgl.h"
#include "../demos/lv_demos.h"
@@ -12,12 +12,14 @@ void setUp(void)
void tearDown(void)
{
/* Function run after every test */
lv_display_set_color_format(NULL, LV_COLOR_FORMAT_XRGB8888);
}
void test_render(void)
void test_render_to_rgb565(void)
{
lv_opa_t opa_values[2] = {0xff, 0x80};
lv_display_set_color_format(NULL, LV_COLOR_FORMAT_RGB565);
lv_opa_t opa_values[2] = {0xff, 0x80};
uint32_t opa;
for(opa = 0; opa < 2; opa++) {
uint32_t i;
@@ -25,7 +27,7 @@ void test_render(void)
lv_demo_render(i, opa_values[opa]);
char buf[128];
lv_snprintf(buf, sizeof(buf), "draw/render/demo_render_%s_opa_%d.png",
lv_snprintf(buf, sizeof(buf), "draw/render/rgb565/demo_render_%s_opa_%d.png",
lv_demo_render_get_scene_name(i), opa_values[opa]);
TEST_ASSERT_EQUAL_SCREENSHOT(buf);
}

View File

@@ -0,0 +1,37 @@
#if LV_BUILD_TEST || 1
#include "../lvgl.h"
#include "../demos/lv_demos.h"
#include "unity/unity.h"
void setUp(void)
{
/* Function run before every test */
}
void tearDown(void)
{
/* Function run after every test */
lv_display_set_color_format(NULL, LV_COLOR_FORMAT_XRGB8888);
}
void test_render_to_rgb565(void)
{
lv_display_set_color_format(NULL, LV_COLOR_FORMAT_RGB888);
lv_opa_t opa_values[2] = {0xff, 0x80};
uint32_t opa;
for(opa = 0; opa < 2; opa++) {
uint32_t i;
for(i = 0; i < _LV_DEMO_RENDER_SCENE_NUM; i++) {
lv_demo_render(i, opa_values[opa]);
char buf[128];
lv_snprintf(buf, sizeof(buf), "draw/render/rgb888/demo_render_%s_opa_%d.png",
lv_demo_render_get_scene_name(i), opa_values[opa]);
TEST_ASSERT_EQUAL_SCREENSHOT(buf);
}
}
}
#endif

View File

@@ -0,0 +1,37 @@
#if LV_BUILD_TEST || 1
#include "../lvgl.h"
#include "../demos/lv_demos.h"
#include "unity/unity.h"
void setUp(void)
{
/* Function run before every test */
}
void tearDown(void)
{
/* Function run after every test */
lv_display_set_color_format(NULL, LV_COLOR_FORMAT_XRGB8888);
}
void test_render_to_rgb565(void)
{
lv_display_set_color_format(NULL, LV_COLOR_FORMAT_XRGB8888);
lv_opa_t opa_values[2] = {0xff, 0x80};
uint32_t opa;
for(opa = 0; opa < 2; opa++) {
uint32_t i;
for(i = 0; i < _LV_DEMO_RENDER_SCENE_NUM; i++) {
lv_demo_render(i, opa_values[opa]);
char buf[128];
lv_snprintf(buf, sizeof(buf), "draw/render/xrgb8888/demo_render_%s_opa_%d.png",
lv_demo_render_get_scene_name(i), opa_values[opa]);
TEST_ASSERT_EQUAL_SCREENSHOT(buf);
}
}
}
#endif

View File

@@ -51,6 +51,7 @@ static bool screenhot_compare(const char * fn_ref, const char * mode, uint8_t to
static int read_png_file(png_image_t * p, const char * file_name);
static int write_png_file(void * raw_img, uint32_t width, uint32_t height, char * file_name);
static void png_release(png_image_t * p);
static void buf_to_xrgb8888(const uint8_t * buf_in, uint8_t * buf_out, lv_color_format_t cf_in);
/**********************
* STATIC VARIABLES
@@ -117,6 +118,7 @@ bool lv_test_assert_image_eq(const char * fn_ref)
* STATIC FUNCTIONS
**********************/
static uint8_t screen_buf_xrgb8888[800 * 480 * 4];
/**
* Compare the content of the frame buffer with a reference image
* @param fn_ref reference image name
@@ -132,14 +134,17 @@ static bool screenhot_compare(const char * fn_ref, const char * mode, uint8_t to
lv_refr_now(NULL);
extern uint8_t * last_flushed_buf;
uint8_t * screen_buf = lv_draw_buf_align(last_flushed_buf, LV_COLOR_FORMAT_XRGB8888);
lv_color_format_t cf = lv_display_get_color_format(NULL);
uint8_t * screen_buf = lv_draw_buf_align(last_flushed_buf, cf);
buf_to_xrgb8888(screen_buf, screen_buf_xrgb8888, cf);
png_image_t p;
int res = read_png_file(&p, fn_ref_full);
if(res == ERR_FILE_NOT_FOUND) {
TEST_PRINTF("%s%s", fn_ref_full, " was not found, creating is now from the rendered screen");
fflush(stderr);
write_png_file(screen_buf, 800, 480, fn_ref_full);
write_png_file(screen_buf_xrgb8888, 800, 480, fn_ref_full);
return true;
}
else if(res == ERR_PNG) {
@@ -150,27 +155,27 @@ static bool screenhot_compare(const char * fn_ref, const char * mode, uint8_t to
const png_byte * ptr_ref = NULL;
bool err = false;
uint32_t stride = lv_draw_buf_width_to_stride(800, LV_COLOR_FORMAT_ARGB8888);
int x, y;
for(y = 0; y < p.height; y++) {
uint8_t * screen_buf_tmp = screen_buf + stride * y;
uint8_t * screen_buf_tmp = screen_buf_xrgb8888 + 800 * 4 * y;
png_byte * row = p.row_pointers[y];
for(x = 0; x < p.width; x++) {
ptr_ref = &(row[x * 3]);
ptr_act = screen_buf_tmp;
if(LV_ABS((int32_t) ptr_act[0] - ptr_ref[0]) > tolerance ||
LV_ABS((int32_t) ptr_act[1] - ptr_ref[1]) > tolerance ||
LV_ABS((int32_t) ptr_act[2] - ptr_ref[2]) > tolerance) {
uint32_t act_px = (ptr_act[2] << 16) + (ptr_act[1] << 8) + (ptr_act[0] << 0);
uint32_t ref_px = 0;
uint32_t act_px = 0;
memcpy(&ref_px, ptr_ref, 3);
memcpy(&act_px, ptr_act, 3);
uint8_t act_swap[3] = {ptr_act[2], ptr_act[1], ptr_act[0]};
if(LV_ABS((int32_t) act_swap[0] - ptr_ref[0]) > tolerance ||
LV_ABS((int32_t) act_swap[1] - ptr_ref[1]) > tolerance ||
LV_ABS((int32_t) act_swap[2] - ptr_ref[2]) > tolerance) {
uint32_t act_swap_32 = (act_swap[2] << 16) + (act_swap[1] << 8) + (act_swap[0] << 0);
TEST_PRINTF("Error %s on x:%d, y:%d.\nExpected: %X\nActual: %X", mode, x, y, ref_px, act_swap_32);
TEST_PRINTF("\nScreenshot compare error\n"
" - File: %s\n"
" - Mode: %s\n"
" - At x:%d, y:%d.\n"
" - Expected: %X\n"
" - Actual: %X",
fn_ref_full, mode, x, y, ref_px, act_px);
fflush(stderr);
err = true;
break;
@@ -181,14 +186,14 @@ static bool screenhot_compare(const char * fn_ref, const char * mode, uint8_t to
}
if(err) {
char fn_ref_no_ext[64];
char fn_ref_no_ext[256];
strcpy(fn_ref_no_ext, fn_ref);
fn_ref_no_ext[strlen(fn_ref_no_ext) - 4] = '\0';
char fn_err_full[512];
sprintf(fn_err_full, "%s%s_err.png", REF_IMGS_PATH, fn_ref_no_ext);
write_png_file(screen_buf, 800, 480, fn_err_full);
write_png_file(screen_buf_xrgb8888, 800, 480, fn_err_full);
}
png_release(&p);
@@ -322,9 +327,9 @@ static int write_png_file(void * raw_img, uint32_t width, uint32_t height, char
row_pointers[y] = malloc(3 * width);
uint8_t * line = raw_img8 + y * width * 4;
for(uint32_t x = 0; x < width; x++) {
row_pointers[y][x * 3 + 0] = line[x * 4 + 2];
row_pointers[y][x * 3 + 0] = line[x * 4 + 0];
row_pointers[y][x * 3 + 1] = line[x * 4 + 1];
row_pointers[y][x * 3 + 2] = line[x * 4 + 0];
row_pointers[y][x * 3 + 2] = line[x * 4 + 2];
}
}
png_write_image(png_ptr, row_pointers);
@@ -356,4 +361,57 @@ static void png_release(png_image_t * p)
png_destroy_read_struct(&p->png_ptr, &p->info_ptr, NULL);
}
static void buf_to_xrgb8888(const uint8_t * buf_in, uint8_t * buf_out, lv_color_format_t cf_in)
{
uint32_t stride = lv_draw_buf_width_to_stride(800, cf_in);
if(cf_in == LV_COLOR_FORMAT_RGB565) {
uint32_t y;
for(y = 0; y < 480; y++) {
uint32_t x;
for(x = 0; x < 800; x++) {
const lv_color16_t * c16 = (const lv_color16_t *)&buf_in[x * 2];
buf_out[x * 4 + 3] = 0xff;
buf_out[x * 4 + 2] = (c16->blue * 2106) >> 8; /*To make it rounded*/
buf_out[x * 4 + 1] = (c16->green * 1037) >> 8;
buf_out[x * 4 + 0] = (c16->red * 2106) >> 8;
}
buf_in += stride;
buf_out += 800 * 4;
}
}
else if(cf_in == LV_COLOR_FORMAT_ARGB8888 || cf_in == LV_COLOR_FORMAT_XRGB8888) {
uint32_t y;
for(y = 0; y < 480; y++) {
uint32_t x;
for(x = 0; x < 800; x++) {
buf_out[x * 4 + 3] = buf_in[x * 4 + 3];
buf_out[x * 4 + 2] = buf_in[x * 4 + 0];
buf_out[x * 4 + 1] = buf_in[x * 4 + 1];
buf_out[x * 4 + 0] = buf_in[x * 4 + 2];
}
buf_in += stride;
buf_out += 800 * 4;
}
}
else if(cf_in == LV_COLOR_FORMAT_RGB888) {
uint32_t y;
for(y = 0; y < 480; y++) {
uint32_t x;
for(x = 0; x < 800; x++) {
buf_out[x * 4 + 3] = 0xff;
buf_out[x * 4 + 2] = buf_in[x * 3 + 0];
buf_out[x * 4 + 1] = buf_in[x * 3 + 1];
buf_out[x * 4 + 0] = buf_in[x * 3 + 2];
}
buf_in += stride;
buf_out += 800 * 4;
}
}
}
#endif