lvgl: take opacity into account

The callback used for the 32-bit color depth has a slight problem, it
doesn't take opacity into account. Correctly mix the colors by using
lv_color_mix().

Suggested-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@huawei.com>
This commit is contained in:
Bartosz Golaszewski 2022-01-03 13:41:19 +01:00 committed by Carles Cufí
parent 98665755ea
commit e467088faa
1 changed files with 8 additions and 1 deletions

View File

@ -31,6 +31,13 @@ void lvgl_set_px_cb_32bit(struct _disp_drv_t *disp_drv,
lv_color_t color, lv_opa_t opa)
{
uint32_t *buf_xy = (uint32_t *)(buf + x * 4U + y * 4U * buf_w);
*buf_xy = lv_color_to32(color);
if (opa == LV_OPA_COVER) {
/* Do not mix if not required */
*buf_xy = lv_color_to32(color);
} else {
lv_color_t bg_color = *((lv_color_t *)buf_xy);
*buf_xy = lv_color_to32(lv_color_mix(color, bg_color, opa));
}
}
#endif