summaryrefslogtreecommitdiff
path: root/src/lib/evas/common
diff options
context:
space:
mode:
authorChunEon Park <chuneon.park@samsung.com>2015-04-06 21:58:07 +0900
committerChunEon Park <chuneon.park@samsung.com>2015-04-06 22:02:49 +0900
commit7a6eb2ea428b6dd7b02ae9cfbe4275f9a6fe612a (patch)
treeb9c1d801c2f2ab35e2b164229462c5a6a2797ec6 /src/lib/evas/common
parentf419555cd82d324d19ad81bee4f03fcbe87d4f49 (diff)
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.
Diffstat (limited to 'src/lib/evas/common')
-rw-r--r--src/lib/evas/common/evas_convert_color.c6
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 e8a6b72..0f7975b 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)
52 52
53 while (data < de) 53 while (data < de)
54 { 54 {
55 DATA32 a = (*data >> 24) + 1; 55 DATA32 a = (*data >> 24);
56 56
57 if (p_val == *data) *data = p_res; 57 if (p_val == *data) *data = p_res;
58 else 58 else
59 { 59 {
60 p_val = *data; 60 p_val = *data;
61 if ((a > 1) && (a < 256)) 61 if ((a > 0) && (a < 255))
62 *data = ARGB_JOIN(a, 62 *data = ARGB_JOIN(a,
63 (R_VAL(data) * 255) / a, 63 (R_VAL(data) * 255) / a,
64 (G_VAL(data) * 255) / a, 64 (G_VAL(data) * 255) / a,
65 (B_VAL(data) * 255) / a); 65 (B_VAL(data) * 255) / a);
66 else if (a == 1) 66 else if (a == 0)
67 *data = 0x00000000; 67 *data = 0x00000000;
68 p_res = *data; 68 p_res = *data;
69 } 69 }