mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-28 07:03:00 +08:00
parent
71d535defd
commit
42d9c07eeb
@ -249,6 +249,14 @@ LV_ATTRIBUTE_FAST_MEM static void fill_normal(lv_color_t * dest_buf, const lv_ar
|
|||||||
lv_color_t last_dest_color = lv_color_black();
|
lv_color_t last_dest_color = lv_color_black();
|
||||||
lv_color_t last_res_color = lv_color_mix(color, last_dest_color, opa);
|
lv_color_t last_res_color = lv_color_mix(color, last_dest_color, opa);
|
||||||
|
|
||||||
|
#if LV_COLOR_MIX_ROUND_OFS == 0 && LV_COLOR_DEPTH == 16
|
||||||
|
/*lv_color_mix work with an optimized algorithm with 16 bit color depth.
|
||||||
|
*However, it introduces some rounded error on opa.
|
||||||
|
*Introduce the same error here too to make lv_color_premult produces the same result */
|
||||||
|
opa = (uint32_t)((uint32_t)opa + 4) >> 3;
|
||||||
|
opa = opa << 3;
|
||||||
|
#endif
|
||||||
|
|
||||||
uint16_t color_premult[3];
|
uint16_t color_premult[3];
|
||||||
lv_color_premult(color, opa, color_premult);
|
lv_color_premult(color, opa, color_premult);
|
||||||
lv_opa_t opa_inv = 255 - opa;
|
lv_opa_t opa_inv = 255 - opa;
|
||||||
|
@ -442,7 +442,7 @@ LV_ATTRIBUTE_FAST_MEM static inline lv_color_t lv_color_mix(lv_color_t c1, lv_co
|
|||||||
|
|
||||||
#if LV_COLOR_DEPTH == 16 && LV_COLOR_16_SWAP == 0 && LV_COLOR_MIX_ROUND_OFS == 0
|
#if LV_COLOR_DEPTH == 16 && LV_COLOR_16_SWAP == 0 && LV_COLOR_MIX_ROUND_OFS == 0
|
||||||
/*Source: https://stackoverflow.com/a/50012418/1999969*/
|
/*Source: https://stackoverflow.com/a/50012418/1999969*/
|
||||||
mix = (mix + 4) >> 3;
|
mix = (uint32_t)((uint32_t)mix + 4) >> 3;
|
||||||
uint32_t bg = (uint32_t)((uint32_t)c2.full | ((uint32_t)c2.full << 16)) &
|
uint32_t bg = (uint32_t)((uint32_t)c2.full | ((uint32_t)c2.full << 16)) &
|
||||||
0x7E0F81F; /*0b00000111111000001111100000011111*/
|
0x7E0F81F; /*0b00000111111000001111100000011111*/
|
||||||
uint32_t fg = (uint32_t)((uint32_t)c1.full | ((uint32_t)c1.full << 16)) & 0x7E0F81F;
|
uint32_t fg = (uint32_t)((uint32_t)c1.full | ((uint32_t)c1.full << 16)) & 0x7E0F81F;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user