Hi guys,

As you can see from CVS log, I did some repacking of Evas_Object and
managed to save more than 80 bytes, almost 1/3 of it is gone.

While some aggressive packing went in, like "layer" number being a
short now, I'm a bit unsure if applying the attached patch is a good
thing. It will save 4 bytes from cur,prev, so it's 8 bytes in the end,
but the solution is a bit ugly, as the members
cache.clip.{visible,dirty} now are cache_clip_{visible,dirty} so it
can be packed with the other bitfields. On one hand it saves memory,
on the other it's ugly as hell :-P

Apply or not? that's the question...

PS: please test Evas on as many
machines/architectures/compilers/operating systems as possible to see
nothing is broken by these patches! It relies on compilers working
fine with bitfields.

-- 
Gustavo Sverzut Barbieri
http://profusion.mobi
Embedded Systems
--------------------------------------
MSN: [EMAIL PROTECTED]
Skype: gsbarbieri
Mobile: +55 (81) 9927 0010
? lib/engines/common_16/libevas_engine_common_16.la
Index: lib/canvas/evas_clip.c
===================================================================
RCS file: /cvs/e/e17/libs/evas/src/lib/canvas/evas_clip.c,v
retrieving revision 1.30
diff -u -p -r1.30 evas_clip.c
--- lib/canvas/evas_clip.c      8 Feb 2008 22:35:19 -0000       1.30
+++ lib/canvas/evas_clip.c      1 May 2008 06:49:57 -0000
@@ -8,7 +8,7 @@ evas_object_clip_recalc(Evas_Object *obj
    int nx, ny, nw, nh, nvis, nr, ng, nb, na;
 
    if (obj->layer->evas->events_frozen > 0) return;
-//   if (!obj->cur.clipper->cur.cache.clip.dirty) return;
+//   if (!obj->cur.clipper->cur.cache_clip_dirty) return;
    evas_object_coords_recalc(obj);
    cx = obj->cur.geometry.x; cy = obj->cur.geometry.y;
    cw = obj->cur.geometry.w; ch = obj->cur.geometry.h;
@@ -21,13 +21,13 @@ evas_object_clip_recalc(Evas_Object *obj
    if (obj->cur.clipper)
      {
 // this causes problems... hmmm
-//     if (obj->cur.clipper->cur.cache.clip.dirty)
+//     if (obj->cur.clipper->cur.cache_clip_dirty)
          evas_object_clip_recalc(obj->cur.clipper);
        nx = obj->cur.clipper->cur.cache.clip.x;
        ny = obj->cur.clipper->cur.cache.clip.y;
        nw = obj->cur.clipper->cur.cache.clip.w;
        nh = obj->cur.clipper->cur.cache.clip.h;
-       nvis = obj->cur.clipper->cur.cache.clip.visible;
+       nvis = obj->cur.clipper->cur.cache_clip_visible;
        nr = obj->cur.clipper->cur.cache.clip.r;
        ng = obj->cur.clipper->cur.cache.clip.g;
        nb = obj->cur.clipper->cur.cache.clip.b;
@@ -44,12 +44,12 @@ evas_object_clip_recalc(Evas_Object *obj
    obj->cur.cache.clip.y = cy;
    obj->cur.cache.clip.w = cw;
    obj->cur.cache.clip.h = ch;
-   obj->cur.cache.clip.visible = cvis;
+   obj->cur.cache_clip_visible = cvis;
    obj->cur.cache.clip.r = cr;
    obj->cur.cache.clip.g = cg;
    obj->cur.cache.clip.b = cb;
    obj->cur.cache.clip.a = ca;
-   obj->cur.cache.clip.dirty = 0;
+   obj->cur.cache_clip_dirty = 0;
 }
 
 void
@@ -57,7 +57,7 @@ evas_object_clip_dirty(Evas_Object *obj)
 {
    Evas_List *l;
 
-   obj->cur.cache.clip.dirty = 1;
+   obj->cur.cache_clip_dirty = 1;
    for (l = obj->clip.clipees; l; l = l->next)
      evas_object_clip_dirty(l->data);
 }
@@ -67,7 +67,7 @@ evas_object_recalc_clippees(Evas_Object 
 {
    Evas_List *l;
 
-   if (obj->cur.cache.clip.dirty)
+   if (obj->cur.cache_clip_dirty)
      {
        evas_object_clip_recalc(obj);
        for (l = obj->clip.clipees; l; l = l->next)
Index: lib/canvas/evas_object_gradient.c
===================================================================
RCS file: /cvs/e/e17/libs/evas/src/lib/canvas/evas_object_gradient.c,v
retrieving revision 1.21
diff -u -p -r1.21 evas_object_gradient.c
--- lib/canvas/evas_object_gradient.c   1 May 2008 04:14:08 -0000       1.21
+++ lib/canvas/evas_object_gradient.c   1 May 2008 06:49:59 -0000
@@ -918,7 +918,7 @@ evas_object_gradient_render_pre(Evas_Obj
    /* if someone is clipping this obj - go calculate the clipper */
    if (obj->cur.clipper)
      {
-       if (obj->cur.cache.clip.dirty)
+       if (obj->cur.cache_clip_dirty)
          evas_object_clip_recalc(obj->cur.clipper);
        obj->cur.clipper->func->render_pre(obj->cur.clipper);
      }
Index: lib/canvas/evas_object_image.c
===================================================================
RCS file: /cvs/e/e17/libs/evas/src/lib/canvas/evas_object_image.c,v
retrieving revision 1.63
diff -u -p -r1.63 evas_object_image.c
--- lib/canvas/evas_object_image.c      1 May 2008 00:09:39 -0000       1.63
+++ lib/canvas/evas_object_image.c      1 May 2008 06:49:59 -0000
@@ -2036,7 +2036,7 @@ evas_object_image_render_pre(Evas_Object
    /* if someone is clipping this obj - go calculate the clipper */
    if (obj->cur.clipper)
      {
-       if (obj->cur.cache.clip.dirty)
+       if (obj->cur.cache_clip_dirty)
          evas_object_clip_recalc(obj->cur.clipper);
        obj->cur.clipper->func->render_pre(obj->cur.clipper);
      }
Index: lib/canvas/evas_object_line.c
===================================================================
RCS file: /cvs/e/e17/libs/evas/src/lib/canvas/evas_object_line.c,v
retrieving revision 1.24
diff -u -p -r1.24 evas_object_line.c
--- lib/canvas/evas_object_line.c       8 Feb 2008 22:35:19 -0000       1.24
+++ lib/canvas/evas_object_line.c       1 May 2008 06:49:59 -0000
@@ -314,7 +314,7 @@ evas_object_line_render_pre(Evas_Object 
    /* if someone is clipping this obj - go calculate the clipper */
    if (obj->cur.clipper)
      {
-       if (obj->cur.cache.clip.dirty)
+       if (obj->cur.cache_clip_dirty)
          evas_object_clip_recalc(obj->cur.clipper);
        obj->cur.clipper->func->render_pre(obj->cur.clipper);
      }
Index: lib/canvas/evas_object_main.c
===================================================================
RCS file: /cvs/e/e17/libs/evas/src/lib/canvas/evas_object_main.c,v
retrieving revision 1.66
diff -u -p -r1.66 evas_object_main.c
--- lib/canvas/evas_object_main.c       1 May 2008 04:14:08 -0000       1.66
+++ lib/canvas/evas_object_main.c       1 May 2008 06:49:59 -0000
@@ -369,7 +369,7 @@ evas_object_is_visible(Evas_Object *obj)
 {
    if (obj->smart.smart) return 0;
    if ((obj->cur.visible) &&
-       (obj->cur.cache.clip.visible) &&
+       (obj->cur.cache_clip_visible) &&
        (obj->cur.cache.clip.a > 0))
      {
        if (obj->func->is_visible)
@@ -384,7 +384,7 @@ evas_object_was_visible(Evas_Object *obj
 {
    if (obj->smart.smart) return 0;
    if ((obj->prev.visible) &&
-       (obj->prev.cache.clip.visible) &&
+       (obj->prev.cache_clip_visible) &&
        (obj->prev.cache.clip.a > 0))
      {
        if (obj->func->was_visible)
Index: lib/canvas/evas_object_polygon.c
===================================================================
RCS file: /cvs/e/e17/libs/evas/src/lib/canvas/evas_object_polygon.c,v
retrieving revision 1.22
diff -u -p -r1.22 evas_object_polygon.c
--- lib/canvas/evas_object_polygon.c    28 Jun 2007 23:22:20 -0000      1.22
+++ lib/canvas/evas_object_polygon.c    1 May 2008 06:49:59 -0000
@@ -332,7 +332,7 @@ evas_object_polygon_render_pre(Evas_Obje
    /* if someone is clipping this obj - go calculate the clipper */
    if (obj->cur.clipper)
      {
-       if (obj->cur.cache.clip.dirty)
+       if (obj->cur.cache_clip_dirty)
          evas_object_clip_recalc(obj->cur.clipper);
        obj->cur.clipper->func->render_pre(obj->cur.clipper);
      }
Index: lib/canvas/evas_object_rectangle.c
===================================================================
RCS file: /cvs/e/e17/libs/evas/src/lib/canvas/evas_object_rectangle.c,v
retrieving revision 1.13
diff -u -p -r1.13 evas_object_rectangle.c
--- lib/canvas/evas_object_rectangle.c  5 Oct 2007 04:52:10 -0000       1.13
+++ lib/canvas/evas_object_rectangle.c  1 May 2008 06:49:59 -0000
@@ -179,7 +179,7 @@ evas_object_rectangle_render_pre(Evas_Ob
    /* if someone is clipping this obj - go calculate the clipper */
    if (obj->cur.clipper)
      {
-       if (obj->cur.cache.clip.dirty)
+       if (obj->cur.cache_clip_dirty)
          evas_object_clip_recalc(obj->cur.clipper);
        obj->cur.clipper->func->render_pre(obj->cur.clipper);
      }
Index: lib/canvas/evas_object_text.c
===================================================================
RCS file: /cvs/e/e17/libs/evas/src/lib/canvas/evas_object_text.c,v
retrieving revision 1.69
diff -u -p -r1.69 evas_object_text.c
--- lib/canvas/evas_object_text.c       1 May 2008 05:48:03 -0000       1.69
+++ lib/canvas/evas_object_text.c       1 May 2008 06:49:59 -0000
@@ -1557,7 +1557,7 @@ evas_object_text_render_pre(Evas_Object 
    /* if someone is clipping this obj - go calculate the clipper */
    if (obj->cur.clipper)
      {
-       if (obj->cur.cache.clip.dirty)
+       if (obj->cur.cache_clip_dirty)
          evas_object_clip_recalc(obj->cur.clipper);
        obj->cur.clipper->func->render_pre(obj->cur.clipper);
      }
Index: lib/canvas/evas_object_textblock.c
===================================================================
RCS file: /cvs/e/e17/libs/evas/src/lib/canvas/evas_object_textblock.c,v
retrieving revision 1.150
diff -u -p -r1.150 evas_object_textblock.c
--- lib/canvas/evas_object_textblock.c  20 Mar 2008 21:15:16 -0000      1.150
+++ lib/canvas/evas_object_textblock.c  1 May 2008 06:50:00 -0000
@@ -4515,7 +4515,7 @@ evas_object_textblock_render_pre(Evas_Ob
    /* if someone is clipping this obj - go calculate the clipper */
    if (obj->cur.clipper)
      {
-       if (obj->cur.cache.clip.dirty)
+       if (obj->cur.cache_clip_dirty)
          evas_object_clip_recalc(obj->cur.clipper);
        obj->cur.clipper->func->render_pre(obj->cur.clipper);
      }
Index: lib/canvas/evas_render.c
===================================================================
RCS file: /cvs/e/e17/libs/evas/src/lib/canvas/evas_render.c,v
retrieving revision 1.28
diff -u -p -r1.28 evas_render.c
--- lib/canvas/evas_render.c    1 May 2008 05:48:03 -0000       1.28
+++ lib/canvas/evas_render.c    1 May 2008 06:50:00 -0000
@@ -72,7 +72,7 @@ _evas_render_phase1_object_process(Evas 
 {
    int is_active;
 
-/* if (obj->cur.cache.clip.dirty) */
+/* if (obj->cur.cache_clip_dirty) */
    evas_object_clip_recalc(obj);
    /* because of clip objects - delete 2 cycles later */
    if (obj->delete_me == 2)
@@ -269,7 +269,7 @@ evas_render_updates_internal(Evas *e, un
                      (!obj->clip.clipees) &&
                      (obj->cur.visible) &&
                      (!obj->delete_me) &&
-                     (obj->cur.cache.clip.visible) &&
+                     (obj->cur.cache_clip_visible) &&
                      (!obj->smart.smart)))
          obscuring_objects = evas_list_append(obscuring_objects, obj);
      }
@@ -320,7 +320,7 @@ evas_render_updates_internal(Evas *e, un
                      (!obj->clip.clipees) &&
                      (obj->cur.visible) &&
                      (!obj->delete_me) &&
-                     (obj->cur.cache.clip.visible) &&
+                     (obj->cur.cache_clip_visible) &&
                      (!obj->smart.smart) &&
                      (obj->cur.color.a > 0))
                    {
Index: lib/include/evas_private.h
===================================================================
RCS file: /cvs/e/e17/libs/evas/src/lib/include/evas_private.h,v
retrieving revision 1.102
diff -u -p -r1.102 evas_private.h
--- lib/include/evas_private.h  1 May 2008 06:18:21 -0000       1.102
+++ lib/include/evas_private.h  1 May 2008 06:50:01 -0000
@@ -408,8 +408,6 @@ struct _Evas_Object
         struct {
            int            x, y, w, h;
            unsigned char  r, g, b, a;
-           Evas_Bool      visible : 1;
-           Evas_Bool      dirty : 1;
         } clip;
       } cache;
       Evas_Coord_Rectangle geometry;
@@ -422,6 +420,8 @@ struct _Evas_Object
       Evas_Bool         have_clipees : 1;
       Evas_Bool         anti_alias : 1;
       unsigned char     interpolation_color_space : 1;
+      Evas_Bool         cache_clip_visible : 1;
+      Evas_Bool         cache_clip_dirty : 1;
       Evas_Render_Op    render_op : 4;
    } cur, prev;
 
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to