From 69f49ca6cc0974614d6a48fb85ccdc34496c7097 Mon Sep 17 00:00:00 2001 From: Minkyu Kang Date: Thu, 30 Jul 2015 14:26:55 +0900 Subject: [PATCH] fix to use evas_object_color_set This patch will fix this error. ERR<4041>:evas_main lib/evas/canvas/evas_object_main.c:1418 _evas_object_efl_gfx_base_color_set() Evas only handles pre multiplied colors! Change-Id: I97259f51e587dbabb97e9292cf9bf007b1cd887e Signed-off-by: Minkyu Kang --- include/util/util.h | 1 + src/layout/gallery.c | 5 +---- src/layout/movie.c | 5 +---- src/util/util.c | 14 ++++++++++++++ 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/include/util/util.h b/include/util/util.h index 3ee45ae..01977ef 100644 --- a/include/util/util.h +++ b/include/util/util.h @@ -20,6 +20,7 @@ #include #include +void util_set_alpha_color(Evas_Object *obj, int alpha); Evas_Object *util_add_box(Evas_Object *base); Evas_Object *util_add_gengrid(Evas_Object *base, int item_size_x, int item_size_y); diff --git a/src/layout/gallery.c b/src/layout/gallery.c index d1855a2..41ec2c4 100644 --- a/src/layout/gallery.c +++ b/src/layout/gallery.c @@ -128,8 +128,6 @@ static Evas_Object *_grid_content_get(void *data, evas_object_show(image); } } else if (!strcmp(part, PART_ELM_SWALLOW_FAVORITE)) { - int r, g, b, a; - if (!info->favorite) return NULL; @@ -139,8 +137,7 @@ static Evas_Object *_grid_content_get(void *data, return NULL; } - evas_object_color_get(image, &r, &g, &b, &a); - evas_object_color_set(image, r, g, b, IMAGE_FAVORITE_ALPHA); + util_set_alpha_color(image, IMAGE_FAVORITE_ALPHA); evas_object_show(image); } diff --git a/src/layout/movie.c b/src/layout/movie.c index 49c30fd..bfab4cf 100644 --- a/src/layout/movie.c +++ b/src/layout/movie.c @@ -114,8 +114,6 @@ static Evas_Object *_grid_content_get(void *data, evas_object_show(image); } else if (!strcmp(part, PART_ELM_SWALLOW_FAVORITE)) { - int r, g, b, a; - if (!info->favorite) return NULL; @@ -125,8 +123,7 @@ static Evas_Object *_grid_content_get(void *data, return NULL; } - evas_object_color_get(image, &r, &g, &b, &a); - evas_object_color_set(image, r, g, b, IMAGE_FAVORITE_ALPHA); + util_set_alpha_color(image, IMAGE_FAVORITE_ALPHA); evas_object_show(image); } diff --git a/src/util/util.c b/src/util/util.c index c325b4d..a7c1d8e 100644 --- a/src/util/util.c +++ b/src/util/util.c @@ -20,6 +20,20 @@ #include "util/util.h" +void util_set_alpha_color(Evas_Object *obj, int alpha) +{ + int r, g, b, a; + + evas_object_color_get(obj, &r, &g, &b, &a); + + /* evas should use premultiplied alpha */ + r = r * alpha / 255; + g = g * alpha / 255; + b = b * alpha / 255; + + evas_object_color_set(obj, r, g, b, alpha); +} + Evas_Object *util_add_box(Evas_Object *base) { Evas_Object *box; -- 2.7.4