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

feat(vg_lite): add A8 and L8 dest buffer support (#6884)

Signed-off-by: yushuailong1 <yushuailong1@xiaomi.com>
Signed-off-by: FASTSHIFT <vifextech@foxmail.com>
Co-authored-by: yushuailong1 <yushuailong1@xiaomi.com>
Co-authored-by: FASTSHIFT <vifextech@foxmail.com>
This commit is contained in:
yushuailong 2024-09-20 17:11:16 +08:00 committed by GitHub
parent ff3ffb8eeb
commit 34c425dd1c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
56 changed files with 52 additions and 4 deletions

View File

@ -398,6 +398,8 @@ void lv_vg_lite_matrix_dump_info(const vg_lite_matrix_t * matrix)
bool lv_vg_lite_is_dest_cf_supported(lv_color_format_t cf)
{
switch(cf) {
case LV_COLOR_FORMAT_A8:
case LV_COLOR_FORMAT_L8:
case LV_COLOR_FORMAT_RGB565:
case LV_COLOR_FORMAT_ARGB8888:
case LV_COLOR_FORMAT_XRGB8888:
@ -419,6 +421,7 @@ bool lv_vg_lite_is_src_cf_supported(lv_color_format_t cf)
switch(cf) {
case LV_COLOR_FORMAT_A4:
case LV_COLOR_FORMAT_A8:
case LV_COLOR_FORMAT_L8:
case LV_COLOR_FORMAT_RGB565:
case LV_COLOR_FORMAT_ARGB8888:
case LV_COLOR_FORMAT_XRGB8888:

View File

@ -82,6 +82,7 @@ lv_result_t lv_snapshot_take_to_draw_buf(lv_obj_t * obj, lv_color_format_t cf, l
case LV_COLOR_FORMAT_RGB888:
case LV_COLOR_FORMAT_XRGB8888:
case LV_COLOR_FORMAT_ARGB8888:
case LV_COLOR_FORMAT_A8:
case LV_COLOR_FORMAT_L8:
case LV_COLOR_FORMAT_I1:
break;

View File

@ -422,6 +422,19 @@ static vg_lite_converter<vg_color32_t, uint8_t> conv_alpha4_to_bgra8888(
}
});
static vg_lite_converter<vg_color32_t, uint8_t> conv_l8_to_bgra8888(
[](vg_color32_t * dest, const uint8_t * src, vg_lite_uint32_t px_size, vg_lite_uint32_t /* color */)
{
while(px_size--) {
dest->alpha = 0xFF;
dest->red = *src;
dest->green = *src;
dest->blue = *src;
dest++;
src++;
}
});
/**********************
* MACROS
**********************/
@ -649,6 +662,24 @@ extern "C" {
}
}
static void picture_bgra8888_to_l8(uint8_t * dest, const vg_color32_t * src, vg_lite_uint32_t px_size)
{
while(px_size--) {
*dest = (src->red * 19595 + src->green * 38469 + src->blue * 7472) >> 16;
src++;
dest++;
}
}
static void picture_bgra8888_to_alpha8(uint8_t * dest, const vg_color32_t * src, vg_lite_uint32_t px_size)
{
while(px_size--) {
*dest = src->alpha;
src++;
dest++;
}
}
vg_lite_error_t vg_lite_finish(void)
{
vg_lite_ctx * ctx = vg_lite_ctx::get_instance();
@ -683,6 +714,18 @@ extern "C" {
(const vg_color32_t *)ctx->get_temp_target_buffer(),
ctx->target_px_size);
break;
case VG_LITE_L8:
picture_bgra8888_to_l8(
(uint8_t *)ctx->target_buffer,
(const vg_color32_t *)ctx->get_temp_target_buffer(),
ctx->target_px_size);
break;
case VG_LITE_A8:
picture_bgra8888_to_alpha8(
(uint8_t *)ctx->target_buffer,
(const vg_color32_t *)ctx->get_temp_target_buffer(),
ctx->target_px_size);
break;
case VG_LITE_BGRA8888:
case VG_LITE_BGRX8888:
/* No conversion required. */
@ -2440,6 +2483,11 @@ static Result picture_load(vg_lite_ctx * ctx, std::unique_ptr<Picture> & picture
}
break;
case VG_LITE_L8: {
conv_l8_to_bgra8888.convert(&target, source);
}
break;
case VG_LITE_BGRX8888: {
conv_bgrx8888_to_bgra8888.convert(&target, source);
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 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: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 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: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.8 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.9 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.3 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.9 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

View File

@ -18,9 +18,6 @@ void tearDown(void)
void test_render_to_l8(void)
{
#if LV_USE_DRAW_VG_LITE
TEST_PASS();
#else
lv_display_set_color_format(NULL, LV_COLOR_FORMAT_L8);
lv_opa_t opa_values[2] = {0xff, 0x80};
@ -41,7 +38,6 @@ void test_render_to_l8(void)
TEST_ASSERT_EQUAL_SCREENSHOT(buf);
}
}
#endif
}
#endif