On Thu, Jun 6, 2013 at 6:37 PM, ChunEon Park - Enlightenment Git <
no-re...@enlightenment.org> wrote:

> hermet pushed a commit to branch master.
>
> commit ffe67b804306f86d6ed383e94204a6cc566a4228
> Author: ChunEon Park <her...@hermet.pe.kr>
> Date:   Thu Jun 6 18:36:40 2013 +0900
>
>     edje - refactoring.
>
>      edje_part_calc() is too heavy. split map calcutation from
> edje_part_calc()
>

"heavy" means long in this commit?
"heavy" sounds like a performance perspective word.

Daniel Juyung Seo (SeoZ)


> ---
>  src/lib/edje/edje_calc.c | 153
> +++++++++++++++++++++++++----------------------
>  1 file changed, 80 insertions(+), 73 deletions(-)
>
> diff --git a/src/lib/edje/edje_calc.c b/src/lib/edje/edje_calc.c
> index ff06521..c9ed2d8 100644
> --- a/src/lib/edje/edje_calc.c
> +++ b/src/lib/edje/edje_calc.c
> @@ -2810,39 +2810,104 @@ map_colors_interp(Edje_Calc_Params *p1,
> Edje_Calc_Params *p2,
>  }
>
>  static void
> -_edje_map_color_update(Evas_Map *map, const  Edje_Calc_Params_Map *pmap,
> -                       Eina_Bool map_colors_free)
> +_edje_map_prop_set(Evas_Map *map, const  Edje_Calc_Params *pf,
> +                   Edje_Part_Description_Common *chosen_desc,
> +                   Edje_Real_Part *ep, Evas_Object *mo,
> +                   Eina_Bool map_colors_free)
>  {
> -   Eina_List *colors = pmap->colors;
> +   Eina_List *colors = pf->map->colors;
>     Edje_Map_Color *color;
>     Eina_List *l;
>
> +   evas_map_util_points_populate_from_object(map, ep->object);
> +
> +   if (ep->part->type == EDJE_PART_TYPE_IMAGE ||
> +       ((ep->part->type == EDJE_PART_TYPE_SWALLOW) &&
> +        (eo_isa(mo, EVAS_OBJ_IMAGE_CLASS) &&
> +         (!evas_object_image_source_get(mo))))
> +      )
> +     {
> +        int iw = 1, ih = 1;
> +
> +        evas_object_image_size_get(mo, &iw, &ih);
> +        evas_map_point_image_uv_set(map, 0, 0.0, 0.0);
> +        evas_map_point_image_uv_set(map, 1, iw , 0.0);
> +        evas_map_point_image_uv_set(map, 2, iw , ih );
> +        evas_map_point_image_uv_set(map, 3, 0.0, ih );
> +     }
> +
> +   //map color
>     if (!colors)
>       {
>          evas_map_point_color_set(map, 0, 255, 255, 255, 255);
>          evas_map_point_color_set(map, 1, 255, 255, 255, 255);
>          evas_map_point_color_set(map, 2, 255, 255, 255, 255);
>          evas_map_point_color_set(map, 3, 255, 255, 255, 255);
> -        return;
>       }
> -
> -   if (map_colors_free)
> +   else
>       {
> -        EINA_LIST_FREE(colors, color)
> +        if (map_colors_free)
>            {
> -             evas_map_point_color_set(map, color->idx, color->r, color->g,
> -                                      color->b, color->a);
> -             free(color);
> +             EINA_LIST_FREE(colors, color)
> +               {
> +                  evas_map_point_color_set(map, color->idx, color->r,
> color->g,
> +                                           color->b, color->a);
> +                  free(color);
> +               }
> +          }
> +        else
> +          {
> +             EINA_LIST_FOREACH(colors, l, color)
> +               {
> +                  evas_map_point_color_set(map, color->idx, color->r,
> color->g,
> +                                           color->b, color->a);
> +               }
>            }
>       }
> -   else
> +
> +   //rotate
> +   evas_map_util_3d_rotate(map,
> +                           TO_DOUBLE(pf->map->rotation.x),
> +                           TO_DOUBLE(pf->map->rotation.y),
> +                           TO_DOUBLE(pf->map->rotation.z),
> +                           pf->map->center.x, pf->map->center.y,
> +                           pf->map->center.z);
> +
> +   // calculate light color & position etc. if there is one
> +   if (pf->lighted)
> +     {
> +        evas_map_util_3d_lighting(map, pf->map->light.x, pf->map->light.y,
> +                                  pf->map->light.z, pf->map->light.r,
> +                                  pf->map->light.g, pf->map->light.b,
> +                                  pf->map->light.ar, pf->map->light.ag,
> +                                  pf->map->light.ab);
> +     }
> +
> +   // calculate perspective point
> +   if (chosen_desc->map.persp_on)
>       {
> -        EINA_LIST_FOREACH(colors, l, color)
> +        evas_map_util_3d_perspective(map,
> +                                     pf->map->persp.x, pf->map->persp.y,
> +                                     pf->map->persp.z,
> pf->map->persp.focal);
> +     }
> +
> +   // handle backface culling (object is facing away from view
> +   if (chosen_desc->map.backcull)
> +     {
> +        if (pf->visible)
>            {
> -             evas_map_point_color_set(map, color->idx, color->r, color->g,
> -                                      color->b, color->a);
> +             if (evas_map_util_clockwise_get(map))
> +               evas_object_show(mo);
> +             else evas_object_hide(mo);
>            }
>       }
> +
> +   // handle smooth
> +   if (chosen_desc->map.smooth) evas_map_smooth_set(map, EINA_TRUE);
> +   else evas_map_smooth_set(map, EINA_FALSE);
> +   // handle alpha
> +   if (chosen_desc->map.alpha) evas_map_alpha_set(map, EINA_TRUE);
> +   else evas_map_alpha_set(map, EINA_FALSE);
>  }
>
>  #define Rel1X 0
> @@ -3677,66 +3742,8 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int
> flags, Edje_Calc_Params *sta
>               ed->have_mapped_part = EINA_TRUE;
>               // create map and populate with part geometry
>               if (!map) map = evas_map_new(4);
> -             evas_map_util_points_populate_from_object(map, ep->object);
> -             if (ep->part->type == EDJE_PART_TYPE_IMAGE ||
> -                 ((ep->part->type == EDJE_PART_TYPE_SWALLOW) &&
> -                  (eo_isa(mo, EVAS_OBJ_IMAGE_CLASS) &&
> -                  (!evas_object_image_source_get(mo))))
> -                )
> -               {
> -                  int iw = 1, ih = 1;
> -
> -                  evas_object_image_size_get(mo, &iw, &ih);
> -                  evas_map_point_image_uv_set(map, 0, 0.0, 0.0);
> -                  evas_map_point_image_uv_set(map, 1, iw , 0.0);
> -                  evas_map_point_image_uv_set(map, 2, iw , ih );
> -                  evas_map_point_image_uv_set(map, 3, 0.0, ih );
> -               }
> -
> -             _edje_map_color_update(map, pf->map, map_colors_free);
> -
> -             evas_map_util_3d_rotate(map,
> -                                     TO_DOUBLE(pf->map->rotation.x),
> -                                     TO_DOUBLE(pf->map->rotation.y),
> -                                     TO_DOUBLE(pf->map->rotation.z),
> -                                     pf->map->center.x, pf->map->center.y,
> -                                     pf->map->center.z);
> -
> -             // calculate light color & position etc. if there is one
> -             if (pf->lighted)
> -               {
> -                  evas_map_util_3d_lighting(map,
> -                                            pf->map->light.x,
> pf->map->light.y, pf->map->light.z,
> -                                            pf->map->light.r,
> pf->map->light.g, pf->map->light.b,
> -                                            pf->map->light.ar, pf->map->
> light.ag, pf->map->light.ab);
> -               }
> -
> -             // calculate perspective point
> -             if (chosen_desc->map.persp_on)
> -               {
> -                  evas_map_util_3d_perspective(map,
> -                                               pf->map->persp.x,
> pf->map->persp.y, pf->map->persp.z,
> -                                               pf->map->persp.focal);
> -               }
> -
> -             // handle backface culling (object is facing away from view
> -             if (chosen_desc->map.backcull)
> -               {
> -                  if (pf->visible)
> -                    {
> -                       if (evas_map_util_clockwise_get(map))
> -                         evas_object_show(mo);
> -                       else evas_object_hide(mo);
> -                    }
> -               }
> -
> -             // handle smooth
> -             if (chosen_desc->map.smooth) evas_map_smooth_set(map,
> EINA_TRUE);
> -             else evas_map_smooth_set(map, EINA_FALSE);
> -             // handle alpha
> -             if (chosen_desc->map.alpha) evas_map_alpha_set(map,
> EINA_TRUE);
> -             else evas_map_alpha_set(map, EINA_FALSE);
>
> +             _edje_map_prop_set(map, pf, chosen_desc, ep, mo,
> map_colors_free);
>
>               if (ep->nested_smart)
>                 {  /* Apply map to smart obj holding nested parts */
>
> --
>
>
> ------------------------------------------------------------------------------
> How ServiceNow helps IT people transform IT departments:
> 1. A cloud service to automate IT design, transition and operations
> 2. Dashboards that offer high-level views of enterprise services
> 3. A single system of record for all IT processes
> http://p.sf.net/sfu/servicenow-d2d-j
>
------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to