From de4b8a5c0c6a53bdc2ee351c23418fef7ec93d33 Mon Sep 17 00:00:00 2001 From: ChunEon Park Date: Mon, 6 Apr 2015 21:58:07 +0900 Subject: [PATCH] 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 --- src/lib/evas/common/evas_convert_color.c | 6 +++--- 1 file 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) 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; } -- 2.7.4