cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=264ccb13ede2b90bf4f760a88c0eafc8b3ff954a

commit 264ccb13ede2b90bf4f760a88c0eafc8b3ff954a
Author: Hosang Kim <hosang12....@samsung.com>
Date:   Thu Mar 17 11:12:34 2016 -0700

    edje: add fixed automatically for optimizing edje calc speed.
    
    Summary:
    Applications usually use edje syntax like as,
    
    ```
     part { name :"bg";
         type: SWALLOW;
         description {
              state: "default" 0.0;
              rel1.relative: 0.0 0.0;
              rel2.relative: 0.0 0.0;
              align: 0.0 0.0;
              min: 100 100;
         }
     }
    
    ```
    But edje does not calculate it exactly without "fixed: 1 1".
    So edje calculation is repeated until 4000 x 4000, it is waste of time.
    
    Reviewers: woohyun, raster, Hermet, id213sin, cedric
    
    Reviewed By: cedric
    
    Subscribers: cedric, jpeg
    
    Differential Revision: https://phab.enlightenment.org/D3801
    
    Signed-off-by: Cedric BAIL <ced...@osg.samsung.com>
---
 src/lib/edje/edje_calc.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/src/lib/edje/edje_calc.c b/src/lib/edje/edje_calc.c
index d8c607f..57de6a4 100644
--- a/src/lib/edje/edje_calc.c
+++ b/src/lib/edje/edje_calc.c
@@ -2725,6 +2725,7 @@ _edje_part_recalc_single(Edje *ed,
    Edje_Color_Class *cc = NULL;
    Edje_Internal_Aspect apref;
    int minw = 0, minh = 0, maxw = 0, maxh = 0;
+   Eina_Bool fixedw = EINA_FALSE, fixedh = EINA_FALSE;
    FLOAT_T sc;
 
    sc = DIV(ed->scale, ed->file->base_scale);
@@ -2742,6 +2743,26 @@ _edje_part_recalc_single(Edje *ed,
    /* size step */
    _edje_part_recalc_single_step(desc, params);
 
+   /* check whether this part has fixed value or not*/
+   if ((rel1_to_x == rel2_to_x) &&
+       (desc->rel1.relative_x == desc->rel2.relative_x) &&
+       (!chosen_desc->fixed.w))
+     {
+        chosen_desc->fixed.w = 1;
+        fixedw = EINA_TRUE;
+     }
+
+   if ((rel1_to_y == rel2_to_y) &&
+       (desc->rel1.relative_y == desc->rel2.relative_y) &&
+       (!chosen_desc->fixed.h))
+     {
+        chosen_desc->fixed.h = 1;
+        fixedh = EINA_TRUE;
+     }
+   if (fixedw || fixedh)
+     ERR("file %s, group %s has a non-fixed part '%s'. You should add 'fixed: 
%d %d'. But in order to optimize the edje calc, we add it 
automatically.",ed->path, ed->group, ep->part->name, fixedw, fixedh);
+
+
    /* colors */
    if (ep->part->type != EDJE_PART_TYPE_SPACER)
      {

-- 


Reply via email to