hermet pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=7a6eb2ea428b6dd7b02ae9cfbe4275f9a6fe612a

commit 7a6eb2ea428b6dd7b02ae9cfbe4275f9a6fe612a
Author: ChunEon Park <chuneon.p...@samsung.com>
Date:   Mon Apr 6 21:58:07 2015 +0900

    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.
---
 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;
           }

-- 


Reply via email to