From f146ce307a298878e8a67d404f2bdddc5dcaf804 Mon Sep 17 00:00:00 2001 From: Rajeev Ranjan Date: Sun, 13 May 2012 04:24:28 +0000 Subject: [PATCH] From: Rajeev Ranjan Subject: [E-devel] [PATCH][EDJE] Patch to remove the alpha from image header while saving if the alpha is set to 1 but the image is fully opaque Attached to the mail is a patch to set the alpha information for an image header to 0 with alpha present but all the texels being opaque. Continuing to our discussion, as suggested by many people in the community it has been implemented at edje_cc level. Change description: While compiling the edc file, image data for image files is scanned to find out whether the alpha value in header is set to 1 and is not being used in the image. If this is the case, while writing to eet the alpha is set to 0 to avoid blending for such images in the graphics pipeline when used by evas. SVN revision: 70954 --- legacy/edje/AUTHORS | 1 + legacy/edje/ChangeLog | 7 +++++++ legacy/edje/src/bin/edje_cc_out.c | 17 +++++++++++++++++ 3 files changed, 25 insertions(+) diff --git a/legacy/edje/AUTHORS b/legacy/edje/AUTHORS index 3377d78d0c..34ce0fa31f 100644 --- a/legacy/edje/AUTHORS +++ b/legacy/edje/AUTHORS @@ -23,3 +23,4 @@ Prince Kumar Dubey David Seikel Mikael Sans Jérôme Pinot +Rajeev Ranjan (Rajeev) diff --git a/legacy/edje/ChangeLog b/legacy/edje/ChangeLog index 59e6842b22..5fc6a4d3d6 100644 --- a/legacy/edje/ChangeLog +++ b/legacy/edje/ChangeLog @@ -438,3 +438,10 @@ 2012-05-10 Cedric Bail * Preserve user box and table items during call of edje_object_file_set. + +2012-04-30 Rajeev Ranjan (Rajeev) + + * Add edje_cc optimization to remove alpha channel flag from images + with absolutely no alpha in them if marked as havin alpha in the + originals + diff --git a/legacy/edje/src/bin/edje_cc_out.c b/legacy/edje/src/bin/edje_cc_out.c index f3b4358e32..fe72c5e0c0 100644 --- a/legacy/edje/src/bin/edje_cc_out.c +++ b/legacy/edje/src/bin/edje_cc_out.c @@ -566,6 +566,8 @@ data_write_images(Eet_File *ef, int *image_num, int *input_bytes, int *input_raw int im_w, im_h; int im_alpha; char buf[256]; + unsigned int *start, *end; + Eina_Bool opaque = EINA_TRUE; evas_object_image_size_get(im, &im_w, &im_h); im_alpha = evas_object_image_alpha_get(im); @@ -605,6 +607,21 @@ data_write_images(Eet_File *ef, int *image_num, int *input_bytes, int *input_raw if (qual < min_quality) qual = min_quality; if (qual > max_quality) qual = max_quality; } + if (im_alpha) + { + start = (unsigned int *) im_data; + end = start + (im_w * im_h); + while (start < end) + { + if ((*start & 0xff000000) != 0xff000000) + { + opaque = EINA_FALSE; + break; + } + start++; + } + if (opaque) im_alpha = 0; + } if (mode == 0) bytes = eet_data_image_write(ef, buf, im_data, im_w, im_h,