forked from enlightenment/efl
evas/common: improve evas_common_convert_argb_unpremul() computation.
prev logic increased the alpha channel by 1 so the unpremul resulted in the color got too diff from the origin. We can't avoid losing the rest values while dividing values in premul/unpremul() but this will recover the value better closed to origin value.
This commit is contained in:
parent
f419555cd8
commit
7a6eb2ea42
|
@ -52,18 +52,18 @@ evas_common_convert_argb_unpremul(DATA32 *data, unsigned int len)
|
|||
|
||||
while (data < de)
|
||||
{
|
||||
DATA32 a = (*data >> 24) + 1;
|
||||
DATA32 a = (*data >> 24);
|
||||
|
||||
if (p_val == *data) *data = p_res;
|
||||
else
|
||||
{
|
||||
p_val = *data;
|
||||
if ((a > 1) && (a < 256))
|
||||
if ((a > 0) && (a < 255))
|
||||
*data = ARGB_JOIN(a,
|
||||
(R_VAL(data) * 255) / a,
|
||||
(G_VAL(data) * 255) / a,
|
||||
(B_VAL(data) * 255) / a);
|
||||
else if (a == 1)
|
||||
else if (a == 0)
|
||||
*data = 0x00000000;
|
||||
p_res = *data;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue