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:
parent
98665755ea
commit
e467088faa
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue