* edje: Add a cache for _edje_part_recalc_single.
authorcedric <cedric@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 10 Aug 2009 15:16:51 +0000 (15:16 +0000)
committercedric <cedric@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 10 Aug 2009 15:16:51 +0000 (15:16 +0000)
WARNING: THIS CAN CAUSE RENDERING GLITCH AND OTHER WEIRD BEHAVIOUR WITH
YOUR EDJE FILE. PLEASE REPORT ANY ALIEN STUFF.

Note: This patch cache the result of _edje_part_recalc_single, until
any relative part are moved, the object is resized or some property
are changed (like during text set or color class set).

Note: Be carefull when you call edje_object_size_min_restricted_calc,
it's really an inderect heavy user of _edje_part_recalc_single and
I wasn't able to bring it down.

Note: This patch use more RAM, around 480 bytes per Edje state, so I
don't recommand using it on a Desktop with a lot of CPU power.

git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/edje@41663 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

configure.ac
src/lib/edje_calc.c
src/lib/edje_callbacks.c
src/lib/edje_embryo.c
src/lib/edje_load.c
src/lib/edje_private.h
src/lib/edje_smart.c
src/lib/edje_util.c

index 0e1f26c..ede5344 100644 (file)
@@ -99,6 +99,22 @@ if test "x${want_edje_program_cache}" = "xyes" ; then
    AC_DEFINE(EDJE_PROGRAM_CACHE, 1, [Cache result of program glob matches - this uses up extra ram with the gain of faster program matching])
 fi
 
+# Optional EDJE_CALC_CACHE (use more ram, but increase speed by reducing the need to recalculate static stuff)
+want_edje_calc_cache="no"
+
+AC_ARG_ENABLE([edje-calc-cache],
+   [AC_HELP_STRING(
+       [--enable-edje-calc-cache],
+       [enable EDJE_CALC_CACHE support. [[default=disabled]]]
+    )],
+   [want_edje_calc_cache=$enableval]
+)
+AM_CONDITIONAL(EDJE_CALC_CACHE, test "x${want_edje_calc_cache}" = "xyes")
+
+if test "x${want_edje_calc_cache}" = "xyes" ; then
+   AC_DEFINE(EDJE_CALC_CACHE, 1, [Cache result of edje_part_recalc - this uses up extra ram with the gain of reducing CPU usage when edje object are not resized])
+fi
+
 install_vim="yes"
 AC_ARG_WITH([vim],
     [AC_HELP_STRING([--with-vim=DIR], [Location of Vim data files [[autodetect]]])],
@@ -284,6 +300,8 @@ echo "  Ecore IMF............: $have_ecore_imf"
 echo
 echo "  EDJE_PROGRAM_CACHE...: $want_edje_program_cache"
 echo
+echo "  EDJE_CALC_CACHE......: $want_edje_calc_cache"
+echo
 echo "  Build binaries.......: $have_edje_cc"
 echo
 echo "  Documentation........: ${build_doc}"
index b2e4031..8b91da7 100644 (file)
@@ -46,6 +46,9 @@ _edje_part_pos_set(Edje *ed, Edje_Real_Part *ep, int mode, double pos)
    ep->description_pos = npos;
 
    ed->dirty = 1;
+#ifdef EDJE_CALC_CACHE
+   ep->invalidate = 1;
+#endif
 }
 
 Edje_Part_Description *
@@ -132,6 +135,9 @@ _edje_part_description_apply(Edje *ed, Edje_Real_Part *ep, const char *d1, doubl
      ep->chosen_description = ep->param2.description;
 
    ed->dirty = 1;
+#ifdef EDJE_CALC_CACHE
+   ep->invalidate = 1;
+#endif
 }
 
 void
@@ -163,6 +169,7 @@ _edje_recalc_do(Edje *ed)
        return;
      }
    ed->dirty = 0;
+   ed->state++;
    for (i = 0; i < ed->table_parts_size; i++)
      {
        Edje_Real_Part *ep;
@@ -180,6 +187,10 @@ _edje_recalc_do(Edje *ed)
          _edje_part_recalc(ed, ep, (~ep->calculated) & FLAG_XY);
      }
    if (!ed->calc_only) ed->recalc = 0;
+#ifdef EDJE_CALC_CACHE
+   ed->all_part_change = 0;
+   ed->text_part_change = 0;
+#endif
 }
 
 int
@@ -252,6 +263,9 @@ _edje_dragable_pos_set(Edje *ed, Edje_Real_Part *ep, double x, double y)
        ed->dirty = 1;
      }
 
+#ifdef EDJE_CALC_CACHE
+   ep->invalidate = 1;
+#endif
    _edje_recalc(ed); /* won't do anything if dirty flag isn't set */
 }
 
@@ -1381,7 +1395,14 @@ _edje_image_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *p3, Edj
 static void
 _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags)
 {
-   Edje_Calc_Params p1, p3, *pf;
+#ifdef EDJE_CALC_CACHE
+   int state1 = -1;
+   int state2 = -1;
+   int statec = -1;
+#else
+   Edje_Calc_Params lp1, lp2;
+#endif
+   Edje_Calc_Params *p1, *pf;
    Edje_Part_Description *chosen_desc;
    double pos = 0.0;
 
@@ -1421,20 +1442,80 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags)
    if (flags & FLAG_X)
      {
        ep->calculating |= flags & FLAG_X;
-       if (ep->param1.rel1_to_x)  _edje_part_recalc(ed, ep->param1.rel1_to_x, FLAG_X);
-       if (ep->param1.rel2_to_x)  _edje_part_recalc(ed, ep->param1.rel2_to_x, FLAG_X);
-       if (ep->param2.rel1_to_x)  _edje_part_recalc(ed, ep->param2.rel1_to_x, FLAG_X);
-       if (ep->param2.rel2_to_x)  _edje_part_recalc(ed, ep->param2.rel2_to_x, FLAG_X);
+       if (ep->param1.rel1_to_x)
+         {
+            _edje_part_recalc(ed, ep->param1.rel1_to_x, FLAG_X);
+#ifdef EDJE_CALC_CACHE
+            state1 = ep->param1.rel1_to_x->state;
+#endif
+         }
+       if (ep->param1.rel2_to_x)
+         {
+            _edje_part_recalc(ed, ep->param1.rel2_to_x, FLAG_X);
+#ifdef EDJE_CALC_CACHE
+            if (state1 < ep->param1.rel2_to_x->state)
+              state1 = ep->param1.rel2_to_x->state;
+#endif
+         }
+       if (ep->param2.rel1_to_x)
+         {
+            _edje_part_recalc(ed, ep->param2.rel1_to_x, FLAG_X);
+#ifdef EDJE_CALC_CACHE
+            state2 = ep->param2.rel1_to_x->state;
+#endif
+         }
+       if (ep->param2.rel2_to_x)
+         {
+            _edje_part_recalc(ed, ep->param2.rel2_to_x, FLAG_X);
+#ifdef EDJE_CALC_CACHE
+            if (state2 < ep->param2.rel2_to_x->state)
+              state2 = ep->param2.rel2_to_x->state;
+#endif
+         }
      }
    if (flags & FLAG_Y)
      {
        ep->calculating |= flags & FLAG_Y;
-       if (ep->param1.rel1_to_y)  _edje_part_recalc(ed, ep->param1.rel1_to_y, FLAG_Y);
-       if (ep->param1.rel2_to_y)  _edje_part_recalc(ed, ep->param1.rel2_to_y, FLAG_Y);
-       if (ep->param2.rel1_to_y)  _edje_part_recalc(ed, ep->param2.rel1_to_y, FLAG_Y);
-       if (ep->param2.rel2_to_y)  _edje_part_recalc(ed, ep->param2.rel2_to_y, FLAG_Y);
+       if (ep->param1.rel1_to_y)
+         {
+            _edje_part_recalc(ed, ep->param1.rel1_to_y, FLAG_Y);
+#ifdef EDJE_CALC_CACHE
+            if (state1 < ep->param1.rel1_to_y->state)
+              state1 = ep->param1.rel1_to_y->state;
+#endif
+         }
+       if (ep->param1.rel2_to_y)
+         {
+            _edje_part_recalc(ed, ep->param1.rel2_to_y, FLAG_Y);
+#ifdef EDJE_CALC_CACHE
+            if (state1 < ep->param1.rel2_to_y->state)
+              state1 = ep->param1.rel2_to_y->state;
+#endif
+         }
+       if (ep->param2.rel1_to_y)
+         {
+            _edje_part_recalc(ed, ep->param2.rel1_to_y, FLAG_Y);
+#ifdef EDJE_CALC_CACHE
+            if (state2 < ep->param2.rel1_to_y->state)
+              state2 = ep->param2.rel1_to_y->state;
+#endif
+         }
+       if (ep->param2.rel2_to_y)
+         {
+            _edje_part_recalc(ed, ep->param2.rel2_to_y, FLAG_Y);
+#ifdef EDJE_CALC_CACHE
+            if (state2 < ep->param2.rel2_to_y->state)
+              state2 = ep->param2.rel2_to_y->state;
+#endif
+         }
+     }
+   if (ep->confine_to)
+     {
+       _edje_part_recalc(ed, ep->confine_to, flags);
+#ifdef EDJE_CALC_CACHE
+       statec = ep->confine_to->state;
+#endif
      }
-   if (ep->confine_to)        _edje_part_recalc(ed, ep->confine_to, flags);
 //   if (ep->text.source)       _edje_part_recalc(ed, ep->text.source, flags);
 //   if (ep->text.text_source)  _edje_part_recalc(ed, ep->text.text_source, flags);
 
@@ -1446,113 +1527,162 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags)
        ep->calculated |= flags;
        return;
      }
+
+#ifndef EDJE_CALC_CACHE
+   p1 = &lp1;
+#else
+   p1 = ep->param2.description ? &ep->param1.p : &ep->p;
+#endif
+
    if (ep->param1.description)
-     _edje_part_recalc_single(ed, ep, ep->param1.description, chosen_desc,
-                             ep->param1.rel1_to_x, ep->param1.rel1_to_y, ep->param1.rel2_to_x, ep->param1.rel2_to_y,
-                             ep->confine_to,
-                             &p1,
-                             flags);
+     {
+#ifdef EDJE_CALC_CACHE
+       if (ed->all_part_change ||
+           ep->invalidate ||
+           state1 >= ep->param1.state ||
+           statec >= ep->param1.state ||
+           ((ep->part->type == EDJE_PART_TYPE_TEXT || ep->part->type == EDJE_PART_TYPE_TEXTBLOCK) && ed->text_part_change))
+#endif
+         {
+            _edje_part_recalc_single(ed, ep, ep->param1.description, chosen_desc,
+                                     ep->param1.rel1_to_x, ep->param1.rel1_to_y, ep->param1.rel2_to_x, ep->param1.rel2_to_y,
+                                     ep->confine_to,
+                                     p1,
+                                     flags);
+#ifdef EDJE_CALC_CACHE
+            ep->param1.state = ed->state;
+#endif
+         }
+     }
    if (ep->param2.description)
      {
        int beginning_pos, part_type;
-       Edje_Calc_Params p2;
-
-       _edje_part_recalc_single(ed, ep, ep->param2.description, chosen_desc,
-                                ep->param2.rel1_to_x, ep->param2.rel1_to_y, ep->param2.rel2_to_x, ep->param2.rel2_to_y,
-                                ep->confine_to,
-                                &p2,
-                                flags);
-
-       pos = ep->description_pos;
-       beginning_pos = (pos < 0.5);
-       part_type = ep->part->type;
-
-       /* visible is special */
-       if ((p1.visible) && (!p2.visible))
-         p3.visible = (pos != 1.0);
-       else if ((!p1.visible) && (p2.visible))
-         p3.visible = (pos != 0.0);
-       else
-         p3.visible = p1.visible;
+       Edje_Calc_Params *p2, *p3;
+#ifndef EDJE_CALC_CACHE
+       Edje_Calc_Params lp3;
+
+       p2 = &lp2;
+       p3 = &lp3;
+#else
+       p2 = &ep->param2.p;
+       p3 = &ep->p;
+
+       if (ed->all_part_change ||
+           ep->invalidate ||
+           state2 >= ep->param2.state ||
+           statec >= ep->param2.state ||
+           ((ep->part->type == EDJE_PART_TYPE_TEXT || ep->part->type == EDJE_PART_TYPE_TEXTBLOCK) && ed->text_part_change))
+#endif
+         {
+            _edje_part_recalc_single(ed, ep, ep->param2.description, chosen_desc,
+                                     ep->param2.rel1_to_x, ep->param2.rel1_to_y, ep->param2.rel2_to_x, ep->param2.rel2_to_y,
+                                     ep->confine_to,
+                                     p2,
+                                     flags);
+#ifdef EDJE_CALC_CACHE
+            ep->param2.state = ed->state;
+#endif
+         }
 
-       p3.smooth = (beginning_pos) ? p1.smooth : p2.smooth;
+       pos = ep->description_pos;
+       beginning_pos = (pos < 0.5);
+       part_type = ep->part->type;
 
-       /* FIXME: do x and y separately base on flag */
-#define INTP(_x1, _x2, _p) (((_x1) == (_x2)) ? (_x1) : ((_x1) + (((_x2) - (_x1)) * (_p))))
-       p3.x = INTP(p1.x, p2.x, pos);
-       p3.y = INTP(p1.y, p2.y, pos);
-       p3.w = INTP(p1.w, p2.w, pos);
-       p3.h = INTP(p1.h, p2.h, pos);
+       /* visible is special */
+       if ((p1->visible) && (!p2->visible))
+         p3->visible = (pos != 1.0);
+       else if ((!p1->visible) && (p2->visible))
+         p3->visible = (pos != 0.0);
+       else
+         p3->visible = p1->visible;
 
-       p3.req.x = INTP(p1.req.x, p2.req.x, pos);
-       p3.req.y = INTP(p1.req.y, p2.req.y, pos);
-       p3.req.w = INTP(p1.req.w, p2.req.w, pos);
-       p3.req.h = INTP(p1.req.h, p2.req.h, pos);
+       p3->smooth = (beginning_pos) ? p1->smooth : p2->smooth;
 
-       if (ep->part->dragable.x)
-         {
-            p3.req_drag.x = INTP(p1.req_drag.x, p2.req_drag.x, pos);
-            p3.req_drag.w = INTP(p1.req_drag.w, p2.req_drag.w, pos);
-         }
-       if (ep->part->dragable.y)
-         {
-            p3.req_drag.y = INTP(p1.req_drag.y, p2.req_drag.y, pos);
-            p3.req_drag.h = INTP(p1.req_drag.h, p2.req_drag.h, pos);
-         }
+       /* FIXME: do x and y separately base on flag */
+#define INTP(_x1, _x2, _p) (((_x1) == (_x2)) ? (_x1) : ((_x1) + (((_x2) - (_x1)) * (_p))))
+       p3->x = INTP(p1->x, p2->x, pos);
+       p3->y = INTP(p1->y, p2->y, pos);
+       p3->w = INTP(p1->w, p2->w, pos);
+       p3->h = INTP(p1->h, p2->h, pos);
 
-       p3.color.r = INTP(p1.color.r, p2.color.r, pos);
-       p3.color.g = INTP(p1.color.g, p2.color.g, pos);
-       p3.color.b = INTP(p1.color.b, p2.color.b, pos);
-       p3.color.a = INTP(p1.color.a, p2.color.a, pos);
+       p3->req.x = INTP(p1->req.x, p2->req.x, pos);
+       p3->req.y = INTP(p1->req.y, p2->req.y, pos);
+       p3->req.w = INTP(p1->req.w, p2->req.w, pos);
+       p3->req.h = INTP(p1->req.h, p2->req.h, pos);
 
-       switch (part_type)
+       if (ep->part->dragable.x)
          {
-          case EDJE_PART_TYPE_IMAGE:
-          case EDJE_PART_TYPE_GRADIENT:
-             p3.fill.x = INTP(p1.fill.x, p2.fill.x, pos);
-             p3.fill.y = INTP(p1.fill.y, p2.fill.y, pos);
-             p3.fill.w = INTP(p1.fill.w, p2.fill.w, pos);
-             p3.fill.h = INTP(p1.fill.h, p2.fill.h, pos);
-             if (part_type == EDJE_PART_TYPE_GRADIENT)
-               {
-                  p3.fill.angle = INTP(p1.fill.angle, p2.fill.angle, pos);
-                  p3.fill.spread = (beginning_pos) ? p1.fill.spread : p2.fill.spread;
-                  p3.type.gradient = (beginning_pos) ? p1.type.gradient : p2.type.gradient;
-               }
-             else
-               {
-                  p3.type.border.l = INTP(p1.type.border.l, p2.type.border.l, pos);
-                  p3.type.border.r = INTP(p1.type.border.r, p2.type.border.r, pos);
-                  p3.type.border.t = INTP(p1.type.border.t, p2.type.border.t, pos);
-                  p3.type.border.b = INTP(p1.type.border.b, p2.type.border.b, pos);
-               }
-             break;
-          case EDJE_PART_TYPE_TEXT:
-             p3.type.text.size = INTP(p1.type.text.size, p2.type.text.size, pos);
-          case EDJE_PART_TYPE_TEXTBLOCK:
-             p3.color2.r = INTP(p1.color2.r, p2.color2.r, pos);
-             p3.color2.g = INTP(p1.color2.g, p2.color2.g, pos);
-             p3.color2.b = INTP(p1.color2.b, p2.color2.b, pos);
-             p3.color2.a = INTP(p1.color2.a, p2.color2.a, pos);
-
-             p3.color3.r = INTP(p1.color3.r, p2.color3.r, pos);
-             p3.color3.g = INTP(p1.color3.g, p2.color3.g, pos);
-             p3.color3.b = INTP(p1.color3.b, p2.color3.b, pos);
-             p3.color3.a = INTP(p1.color3.a, p2.color3.a, pos);
-
-             p3.type.text.align.x = INTP(p1.type.text.align.x, p2.type.text.align.x, pos);
-             p3.type.text.align.y = INTP(p1.type.text.align.y, p2.type.text.align.y, pos);
-             p3.type.text.elipsis = INTP(p1.type.text.elipsis, p2.type.text.elipsis, pos);
-             break;
-         }
-
-       pf = &p3;
+            p3->req_drag.x = INTP(p1->req_drag.x, p2->req_drag.x, pos);
+            p3->req_drag.w = INTP(p1->req_drag.w, p2->req_drag.w, pos);
+         }
+       if (ep->part->dragable.y)
+         {
+            p3->req_drag.y = INTP(p1->req_drag.y, p2->req_drag.y, pos);
+            p3->req_drag.h = INTP(p1->req_drag.h, p2->req_drag.h, pos);
+         }
+
+       p3->color.r = INTP(p1->color.r, p2->color.r, pos);
+       p3->color.g = INTP(p1->color.g, p2->color.g, pos);
+       p3->color.b = INTP(p1->color.b, p2->color.b, pos);
+       p3->color.a = INTP(p1->color.a, p2->color.a, pos);
+
+       switch (part_type)
+         {
+          case EDJE_PART_TYPE_IMAGE:
+          case EDJE_PART_TYPE_GRADIENT:
+             p3->fill.x = INTP(p1->fill.x, p2->fill.x, pos);
+             p3->fill.y = INTP(p1->fill.y, p2->fill.y, pos);
+             p3->fill.w = INTP(p1->fill.w, p2->fill.w, pos);
+             p3->fill.h = INTP(p1->fill.h, p2->fill.h, pos);
+             if (part_type == EDJE_PART_TYPE_GRADIENT)
+               {
+                  p3->fill.angle = INTP(p1->fill.angle, p2->fill.angle, pos);
+                  p3->fill.spread = (beginning_pos) ? p1->fill.spread : p2->fill.spread;
+                  p3->type.gradient = (beginning_pos) ? p1->type.gradient : p2->type.gradient;
+               }
+             else
+               {
+                  p3->type.border.l = INTP(p1->type.border.l, p2->type.border.l, pos);
+                  p3->type.border.r = INTP(p1->type.border.r, p2->type.border.r, pos);
+                  p3->type.border.t = INTP(p1->type.border.t, p2->type.border.t, pos);
+                  p3->type.border.b = INTP(p1->type.border.b, p2->type.border.b, pos);
+               }
+             break;
+          case EDJE_PART_TYPE_TEXT:
+             p3->type.text.size = INTP(p1->type.text.size, p2->type.text.size, pos);
+          case EDJE_PART_TYPE_TEXTBLOCK:
+             p3->color2.r = INTP(p1->color2.r, p2->color2.r, pos);
+             p3->color2.g = INTP(p1->color2.g, p2->color2.g, pos);
+             p3->color2.b = INTP(p1->color2.b, p2->color2.b, pos);
+             p3->color2.a = INTP(p1->color2.a, p2->color2.a, pos);
+
+             p3->color3.r = INTP(p1->color3.r, p2->color3.r, pos);
+             p3->color3.g = INTP(p1->color3.g, p2->color3.g, pos);
+             p3->color3.b = INTP(p1->color3.b, p2->color3.b, pos);
+             p3->color3.a = INTP(p1->color3.a, p2->color3.a, pos);
+
+             p3->type.text.align.x = INTP(p1->type.text.align.x, p2->type.text.align.x, pos);
+             p3->type.text.align.y = INTP(p1->type.text.align.y, p2->type.text.align.y, pos);
+             p3->type.text.elipsis = INTP(p1->type.text.elipsis, p2->type.text.elipsis, pos);
+             break;
+         }
+
+       pf = p3;
+#ifdef EDJE_CALC_CACHE
+       ep->state = ed->state;
+#endif
      }
    else
      {
-       pf = &p1;
+       pf = p1;
+#ifdef EDJE_CALC_CACHE
+       ep->state = ep->param1.state;
+#endif
      }
 
+#ifdef EDJE_CALC_CACHE
+   ep->invalidate = 0;
+#endif
    ep->req = pf->req;
 
    if (ep->drag.need_reset)
index 3e584dc..ecd1153 100644 (file)
@@ -116,6 +116,9 @@ _edje_mouse_down_cb(void *data, Evas * e, Evas_Object * obj, void *event_info)
                  _edje_emit(ed, buf, events->part->name);
               }
             ed->dirty = 1;
+#ifdef EDJE_CALC_CACHE
+            rp->invalidate = 1;
+#endif
          }
        _edje_recalc_do(ed);
 /*
@@ -138,6 +141,9 @@ _edje_mouse_down_cb(void *data, Evas * e, Evas_Object * obj, void *event_info)
                  if (!ignored)
                    _edje_emit(ed, "drag", rp->part->name);
                  ed->dirty = 1;
+#ifdef EDJE_CALC_CACHE
+                 rp->invalidate = 1;
+#endif
                  rp->drag.need_reset = 1;
                  _edje_recalc_do(ed);
               }
@@ -213,6 +219,9 @@ _edje_mouse_up_cb(void *data, Evas * e, Evas_Object * obj, void *event_info)
               {
                  rp->drag.need_reset = 1;
                  ed->dirty = 1;
+#ifdef EDJE_CALC_CACHE
+                 rp->invalidate = 1;
+#endif
                  if (!ignored)
                    _edje_emit(ed, "drag,stop", rp->part->name);
               }
@@ -281,6 +290,9 @@ _edje_mouse_move_cb(void *data, Evas * e, Evas_Object * obj, void *event_info)
             if (rp->part->dragable.y)
               rp->drag.tmp.y = ev->cur.canvas.y - rp->drag.down.y;
             ed->dirty = 1;
+#ifdef EDJE_CALC_CACHE
+            rp->invalidate = 1;
+#endif
          }
        _edje_recalc_do(ed);
      }
@@ -299,6 +311,9 @@ _edje_mouse_move_cb(void *data, Evas * e, Evas_Object * obj, void *event_info)
                  if (!ignored)
                    _edje_emit(ed, "drag", rp->part->name);
                  ed->dirty = 1;
+#ifdef EDJE_CALC_CACHE
+                 rp->invalidate = 1;
+#endif
                  _edje_recalc_do(ed);
               }
          }
index d8d44b3..84753e8 100644 (file)
@@ -675,6 +675,9 @@ _edje_embryo_fn_set_min_size(Embryo_Program *ep, Embryo_Cell *params)
    ed->collection->prop.min.w = w;
    ed->collection->prop.min.h = h;
    ed->dirty = 1;
+#ifdef EDJE_CALC_CACHE
+   ed->all_part_change = 1;
+#endif
    _edje_recalc(ed);
    return 0;
 }
@@ -699,6 +702,9 @@ _edje_embryo_fn_set_max_size(Embryo_Program *ep, Embryo_Cell *params)
    ed->collection->prop.max.w = w;
    ed->collection->prop.max.h = h;
    ed->dirty = 1;
+#ifdef EDJE_CALC_CACHE
+   ed->all_part_change = 1;
+#endif
    _edje_recalc(ed);
 
    return 0;
@@ -1875,6 +1881,9 @@ _edje_embryo_fn_set_state_val(Embryo_Program *ep, Embryo_Cell *params)
         break;
      }
 
+#ifdef EDJE_CALC_CACHE
+   rp->invalidate = 1;
+#endif
    ed->dirty=1;
    return 0;
 }
index 75f8a47..91f51c5 100644 (file)
@@ -524,6 +524,9 @@ _edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *g
                  _edje_dragable_pos_set(ed, rp, rp->drag.val.x, rp->drag.val.y);
               }
             ed->dirty = 1;
+#ifdef EDJE_CALC_CACHE
+            ed->all_part_change = 1;
+#endif
             if ((evas_object_clipees_get(ed->clipper)) &&
                 (evas_object_visible_get(obj)))
               evas_object_show(ed->clipper);
index 0cb21c2..473bd4a 100644 (file)
@@ -707,6 +707,8 @@ struct _Edje
    } message;
    int                      processing_messages;
 
+   int                   state;
+
    unsigned short        dirty : 1;
    unsigned short        recalc : 1;
    unsigned short        walking_callbacks : 1;
@@ -720,8 +722,41 @@ struct _Edje
    unsigned short        block_break : 1;
    unsigned short        delete_me : 1;
    unsigned short        postponed : 1;
+#ifdef EDJE_CALC_CACHE
+   unsigned short        text_part_change : 1;
+   unsigned short        all_part_change : 1;
+#endif
 };
 
+struct _Edje_Calc_Params
+{
+   int              x, y, w, h; // 16
+   Edje_Rectangle   req; // 16
+   Edje_Rectangle   req_drag; // 16
+   struct {
+      int           x, y, w, h; // 16
+      int           angle; // 4
+      int           spread; // 4
+   } fill;
+   Edje_Color color, color2, color3; // 12
+   union {
+      struct {
+        int           l, r, t, b; // 16
+      } border; // 16
+      struct {
+        Edje_Alignment align; /* text alignment within bounds */ // 16
+        double         elipsis; // 8
+        int            size; // 4
+      } text; // 28
+      struct {
+        int             id; // 4
+        char           *type; // 4
+      } gradient; // 8
+   } type; // 28
+   unsigned char    visible : 1;
+   unsigned char    smooth : 1; // 4
+}; // 116
+
 struct _Edje_Real_Part
 {
    Edje                     *edje; // 4
@@ -781,7 +816,17 @@ struct _Edje_Real_Part
       Edje_Real_Part        *rel1_to_y; // 4
       Edje_Real_Part        *rel2_to_x; // 4
       Edje_Real_Part        *rel2_to_y; // 4
+#ifdef EDJE_CALC_CACHE
+      Edje_Calc_Params       p; // 116
+      int                    state; // 4
+#endif
    } param1, param2, custom; // 60 // FIXME: custom should be alloced on demand - 20--
+   // WITH EDJE_CALC_CACHE: 180
+
+#ifdef EDJE_CALC_CACHE
+   Edje_Calc_Params          p;
+   int                       state;
+#endif
 
    Edje_Real_Part           *confine_to; // 4 // fixme - make part of drag
    Edje_Real_Part           *clip_to; // 4
@@ -796,7 +841,11 @@ struct _Edje_Real_Part
    unsigned char             calculating; // 1
 
    unsigned char             still_in   : 1; // 2
+#ifdef EDJE_CALC_CACHE
+   unsigned char             invalidate : 1;
+#endif
 }; //  394
+// WITH EDJE_CALC_CACHE: 514
 
 struct _Edje_Running_Program
 {
@@ -816,35 +865,6 @@ struct _Edje_Signal_Callback
    unsigned char delete_me : 1;
 };
 
-struct _Edje_Calc_Params
-{
-   int              x, y, w, h;
-   Edje_Rectangle   req;
-   Edje_Rectangle   req_drag;
-   struct {
-      int           x, y, w, h;
-      int           angle;
-      int           spread;
-   } fill;
-   Edje_Color color, color2, color3;
-   union {
-      struct {
-        int           l, r, t, b;
-      } border;
-      struct {
-        Edje_Alignment align; /* text alignment within bounds */
-        double         elipsis;
-        int            size;
-      } text;
-      struct {
-        int             id;
-        char           *type;
-      } gradient;
-   } type;
-   unsigned char    visible : 1;
-   unsigned char    smooth : 1;
-};
-
 struct _Edje_Pending_Program
 {
    Edje         *edje;
index d4ee127..7a83ad3 100644 (file)
@@ -164,6 +164,9 @@ _edje_smart_resize(Evas_Object * obj, Evas_Coord w, Evas_Coord h)
    if ((w == ed->w) && (h == ed->h)) return;
    ed->w = w;
    ed->h = h;
+#ifdef EDJE_CALC_CACHE
+   ed->all_part_change = 1;
+#endif
    if (_edje_script_only(ed))
      {
        _edje_script_only_resize(ed);
index d04c8e5..5f07fd4 100644 (file)
@@ -359,6 +359,9 @@ edje_color_class_set(const char *color_class, int r, int g, int b, int a, int r2
 
        ed = eina_list_data_get(members);
        ed->dirty = 1;
+#ifdef EDJE_CALC_CACHE
+       ed->all_part_change = 1;
+#endif
        _edje_recalc(ed);
        members = eina_list_next(members);
      }
@@ -391,6 +394,9 @@ edje_color_class_del(const char *color_class)
 
        ed = eina_list_data_get(members);
        ed->dirty = 1;
+#ifdef EDJE_CALC_CACHE
+       ed->all_part_change = 1;
+#endif
        _edje_recalc(ed);
        members = eina_list_next(members);
      }
@@ -489,6 +495,9 @@ edje_object_color_class_set(Evas_Object *obj, const char *color_class, int r, in
             cc->b3 = b3;
             cc->a3 = a3;
             ed->dirty = 1;
+#ifdef EDJE_CALC_CACHE
+            ed->all_part_change = 1;
+#endif
             _edje_recalc(ed);
             return;
          }
@@ -515,6 +524,9 @@ edje_object_color_class_set(Evas_Object *obj, const char *color_class, int r, in
    cc->a3 = a3;
    ed->color_classes = eina_list_append(ed->color_classes, cc);
    ed->dirty = 1;
+#ifdef EDJE_CALC_CACHE
+   ed->all_part_change = 1;
+#endif
 
    for (i = 0; i < ed->table_parts_size; i++)
      {
@@ -568,6 +580,9 @@ edje_object_color_class_del(Evas_Object *obj, const char *color_class)
      }
 
    ed->dirty = 1;
+#ifdef EDJE_CALC_CACHE
+   ed->all_part_change = 1;
+#endif
    _edje_recalc(ed);
 }
 
@@ -632,6 +647,9 @@ edje_text_class_set(const char *text_class, const char *font, Evas_Font_Size siz
        ed = eina_list_data_get(members);
        ed->dirty = 1;
        _edje_textblock_style_all_update(ed);
+#ifdef EDJE_CALC_CACHE
+       ed->text_part_change = 1;
+#endif
        _edje_recalc(ed);
        members = eina_list_next(members);
      }
@@ -666,6 +684,9 @@ edje_text_class_del(const char *text_class)
        ed = eina_list_data_get(members);
        ed->dirty = 1;
        _edje_textblock_style_all_update(ed);
+#ifdef EDJE_CALC_CACHE
+       ed->text_part_change = 1;
+#endif
        _edje_recalc(ed);
        members = eina_list_next(members);
      }
@@ -738,6 +759,9 @@ edje_object_text_class_set(Evas_Object *obj, const char *text_class, const char
 
             /* Update edje */
             ed->dirty = 1;
+#ifdef EDJE_CALC_CACHE
+            ed->text_part_change = 1;
+#endif
             _edje_recalc(ed);
             return;
          }
@@ -769,6 +793,9 @@ edje_object_text_class_set(Evas_Object *obj, const char *text_class, const char
    /* Add to edje's text class list */
    ed->text_classes = eina_list_append(ed->text_classes, tc);
    ed->dirty = 1;
+#ifdef EDJE_CALC_CACHE
+   ed->text_part_change = 1;
+#endif
    _edje_textblock_style_all_update(ed);
    _edje_recalc(ed);
 }
@@ -908,6 +935,9 @@ _edje_object_part_text_raw_set(Evas_Object *obj, Edje_Real_Part *rp, const char
    else
      if (text) rp->text.text = eina_stringshare_add(text);
    rp->edje->dirty = 1;
+#ifdef EDJE_CALC_CACHE
+   rp->invalidate = 1;
+#endif
    _edje_recalc(rp->edje);
    if (rp->edje->text_change.func)
      rp->edje->text_change.func(rp->edje->text_change.data, obj, part);
@@ -1256,6 +1286,9 @@ edje_object_part_text_insert(Evas_Object *obj, const char *part, const char *tex
    if (rp->part->entry_mode <= EDJE_ENTRY_EDIT_MODE_NONE) return;
    _edje_entry_text_markup_insert(rp, text);
    rp->edje->dirty = 1;
+#ifdef EDJE_CALC_CACHE
+   rp->invalidate = 1;
+#endif
    _edje_recalc(rp->edje);
    if (rp->edje->text_change.func)
      rp->edje->text_change.func(rp->edje->text_change.data, obj, part);
@@ -1748,6 +1781,9 @@ edje_object_part_unswallow(Evas_Object *obj, Evas_Object *obj_swallow)
        rp->swallow_params.max.w = 0;
        rp->swallow_params.max.h = 0;
        rp->edje->dirty = 1;
+#ifdef EDJE_CALC_CACHE
+       rp->invalidate = 1;
+#endif
        _edje_recalc_do(rp->edje);
        return;
      }
@@ -1858,7 +1894,10 @@ edje_object_calc_force(Evas_Object *obj)
    ed = _edje_fetch(obj);
    if (!ed) return;
    ed->dirty = 1;
-   
+#ifdef EDJE_CALC_CACHE
+   ed->all_part_change = 1;
+#endif
+
    pf2 = _edje_freeze_val;
    pf = ed->freeze;
    
@@ -1929,6 +1968,9 @@ edje_object_size_min_restricted_calc(Evas_Object *obj, Evas_Coord *minw, Evas_Co
 
        ok = 0;
        ed->dirty = 1;
+#ifdef EDJE_CALC_CACHE
+       ed->all_part_change = 1;
+#endif
        _edje_recalc_do(ed);
        if (reset_maxwh)
          {
@@ -2007,6 +2049,9 @@ edje_object_size_min_restricted_calc(Evas_Object *obj, Evas_Coord *minw, Evas_Co
    ed->w = pw;
    ed->h = ph;
    ed->dirty = 1;
+#ifdef EDJE_CALC_CACHE
+   ed->all_part_change = 1;
+#endif
    _edje_recalc(ed);
    ed->calc_only = 0;
 }
@@ -2122,6 +2167,9 @@ edje_object_part_drag_value_set(Evas_Object *obj, const char *part, double dx, d
    if ((rp->drag.val.x == dx) && (rp->drag.val.y == dy)) return;
    rp->drag.val.x = dx;
    rp->drag.val.y = dy;
+#ifdef EDJE_CALC_CACHE
+   rp->invalidate = 1;
+#endif
    _edje_dragable_pos_set(rp->edje, rp, dx, dy);
    _edje_emit(rp->edje, "drag,set", rp->part->name);
 }
@@ -2194,6 +2242,9 @@ edje_object_part_drag_size_set(Evas_Object *obj, const char *part, double dw, do
    rp->drag.size.x = dw;
    rp->drag.size.y = dh;
    rp->edje->dirty = 1;
+#ifdef EDJE_CALC_CACHE
+   rp->invalidate = 1;
+#endif
    _edje_recalc(rp->edje);
 }
 
@@ -2257,6 +2308,9 @@ edje_object_part_drag_step_set(Evas_Object *obj, const char *part, double dx, do
    else if (dy > 1.0) dy = 1.0;
    rp->drag.step.x = dx;
    rp->drag.step.y = dy;
+#ifdef EDJE_CALC_CACHE
+   rp->invalidate = 1;
+#endif
 }
 
 /** Gets the drag step increment values.
@@ -2319,6 +2373,9 @@ edje_object_part_drag_page_set(Evas_Object *obj, const char *part, double dx, do
    else if (dy > 1.0) dy = 1.0;
    rp->drag.page.x = dx;
    rp->drag.page.y = dy;
+#ifdef EDJE_CALC_CACHE
+   rp->invalidate = 1;
+#endif
 }
 
 /** Gets the page step increments
@@ -2385,6 +2442,9 @@ edje_object_part_drag_step(Evas_Object *obj, const char *part, double dx, double
    rp->drag.val.x = CLAMP (rp->drag.val.x, 0.0, 1.0);
    rp->drag.val.y = CLAMP (rp->drag.val.y, 0.0, 1.0);
    if ((px == rp->drag.val.x) && (py == rp->drag.val.y)) return;
+#ifdef EDJE_CALC_CACHE
+   rp->invalidate = 1;
+#endif
    _edje_dragable_pos_set(rp->edje, rp, rp->drag.val.x, rp->drag.val.y);
    _edje_emit(rp->edje, "drag,step", rp->part->name);
 }
@@ -2417,6 +2477,9 @@ edje_object_part_drag_page(Evas_Object *obj, const char *part, double dx, double
    rp->drag.val.x = CLAMP (rp->drag.val.x, 0.0, 1.0);
    rp->drag.val.y = CLAMP (rp->drag.val.y, 0.0, 1.0);
    if ((px == rp->drag.val.x) && (py == rp->drag.val.y)) return;
+#ifdef EDJE_CALC_CACHE
+   rp->invalidate = 1;
+#endif
    _edje_dragable_pos_set(rp->edje, rp, rp->drag.val.x, rp->drag.val.y);
    _edje_emit(rp->edje, "drag,page", rp->part->name);
 }
@@ -2630,6 +2693,9 @@ _edje_box_child_del_cb(void *data, Evas *e __UNUSED__, Evas_Object *child __UNUS
    Edje_Real_Part *rp = data;
 
    rp->edje->dirty = 1;
+#ifdef EDJE_CALC_CACHE
+   rp->invalidate = 1;
+#endif
    _edje_recalc(rp->edje);
 }
 
@@ -2640,6 +2706,9 @@ _edje_box_child_add(Edje_Real_Part *rp, Evas_Object *child)
      (child, EVAS_CALLBACK_DEL, _edje_box_child_del_cb, rp);
 
    rp->edje->dirty = 1;
+#ifdef EDJE_CALC_CACHE
+   rp->invalidate = 1;
+#endif
    _edje_recalc(rp->edje);
 }
 
@@ -2650,6 +2719,9 @@ _edje_box_child_remove(Edje_Real_Part *rp, Evas_Object *child)
      (child, EVAS_CALLBACK_DEL, _edje_box_child_del_cb, rp);
 
    rp->edje->dirty = 1;
+#ifdef EDJE_CALC_CACHE
+   rp->invalidate = 1;
+#endif
    _edje_recalc(rp->edje);
 }
 
@@ -2762,6 +2834,9 @@ _edje_table_child_del_cb(void *data, Evas *e __UNUSED__, Evas_Object *child __UN
    Edje_Real_Part *rp = data;
 
    rp->edje->dirty = 1;
+#ifdef EDJE_CALC_CACHE
+   rp->invalidate = 1;
+#endif
    _edje_recalc(rp->edje);
 }
 
@@ -2772,6 +2847,9 @@ _edje_table_child_add(Edje_Real_Part *rp, Evas_Object *child)
      (child, EVAS_CALLBACK_DEL, _edje_table_child_del_cb, rp);
 
    rp->edje->dirty = 1;
+#ifdef EDJE_CALC_CACHE
+   rp->invalidate = 1;
+#endif
    _edje_recalc(rp->edje);
 }
 
@@ -2782,6 +2860,9 @@ _edje_table_child_remove(Edje_Real_Part *rp, Evas_Object *child)
      (child, EVAS_CALLBACK_DEL, _edje_table_child_del_cb, rp);
 
    rp->edje->dirty = 1;
+#ifdef EDJE_CALC_CACHE
+   rp->invalidate = 1;
+#endif
    _edje_recalc(rp->edje);
 }
 
@@ -3285,6 +3366,9 @@ _edje_real_part_swallow(Edje_Real_Part *rp, Evas_Object *obj_swallow)
           _edje_callbacks_del(rp->swallowed_object);
        rp->swallowed_object = NULL;
      }
+#ifdef EDJE_CALC_CACHE
+   rp->invalidate = 1;
+#endif
    if (!obj_swallow) return;
    rp->swallowed_object = obj_swallow;
    evas_object_smart_member_add(rp->swallowed_object, rp->edje->obj);