diff options
author | ChunEon Park <chuneon.park@samsung.com> | 2015-04-06 21:58:07 +0900 |
---|---|---|
committer | Jaehwan Kim <jae.hwan.kim@samsung.com> | 2015-04-13 06:33:21 -0700 |
commit | de4b8a5c0c6a53bdc2ee351c23418fef7ec93d33 (patch) | |
tree | 37a50968bf15c2c408c13b8c396f0e0c0a0bd3cb | |
parent | 5676fde5297287f235bd0d5da59b52272732fd50 (diff) | |
download | efl-de4b8a5c0c6a53bdc2ee351c23418fef7ec93d33.tar.gz |
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.
Change-Id: I32ab39f3efd89753a697602f53b893107bec9247
Origin: upstream
-rw-r--r-- | src/lib/evas/common/evas_convert_color.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lib/evas/common/evas_convert_color.c b/src/lib/evas/common/evas_convert_color.c index e8a6b7254a..0f7975b217 100644 --- a/src/lib/evas/common/evas_convert_color.c +++ b/src/lib/evas/common/evas_convert_color.c @@ -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; } |