Cedric BAIL [2007-03-29 17:58]:
>       Another little patch that potentially break every thing and need 
> review. To 
> make the story short, when you have a lot of image on the screen with many 
> cliping, you are creating and destroying many time Cutout_Rect object. So I 
> changed the code to do less allocation/destruction. It also break the API 
> used by the engine, so a patch for them is needed.

Looks good in general.

I attached a modified version of your patch where I removed some
oddities:

In evas_common_draw_context_cutouts_del(), I renamed "delta" to "index".
"delta" implies (for me) that it's the difference between two values,
but it really is an index ;)

I also removed some unrelated changes that crept into the patch, like
that "error_data" enum that wasn't referenced anywhere, and a few
whitespace-only changes.

Not sure whether I'm brave enough to commit this :)

Regards,
Tilman

-- 
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Index: src/lib/engines/common/evas_draw_main.c
===================================================================
RCS file: /cvs/e/e17/libs/evas/src/lib/engines/common/evas_draw_main.c,v
retrieving revision 1.20
diff -u -p -r1.20 evas_draw_main.c
--- src/lib/engines/common/evas_draw_main.c     15 Nov 2006 16:44:34 -0000      
1.20
+++ src/lib/engines/common/evas_draw_main.c     29 Mar 2007 18:32:06 -0000
@@ -1,5 +1,57 @@
 #include "evas_common.h"
 
+EAPI Cutout_Rects*
+evas_common_draw_context_cutouts_new()
+{
+   Cutout_Rects *rects;
+
+   rects = malloc(sizeof(Cutout_Rects));
+   rects->rects = NULL;
+   rects->active = 0;
+   rects->max = 0;
+
+   return rects;
+}
+
+EAPI void
+evas_common_draw_context_cutouts_free(Cutout_Rects* rects)
+{
+   rects->active = 0;
+}
+
+EAPI Cutout_Rect*
+evas_common_draw_context_cutouts_add(Cutout_Rects* rects,
+                                     int x, int y, int w, int h)
+{
+   Cutout_Rect* rect;
+
+   if (rects->max < rects->active + 1) {
+      rects->max += 8;
+      rects->rects = realloc(rects->rects, sizeof(Cutout_Rect) * rects->max);
+   }
+
+   rect = rects->rects + rects->active++;
+   rect->x = x;
+   rect->y = y;
+   rect->w = w;
+   rect->h = h;
+
+   return rect;
+}
+
+EAPI void
+evas_common_draw_context_cutouts_del(Cutout_Rects* rects,
+                                     int index)
+{
+   if (index >= 0 && index < rects->active)
+     {
+        Cutout_Rect*    rect = rects->rects + index;
+
+        memmove(rect, rect + 1, sizeof (Cutout_Rect) * (rects->active - index 
- 1));
+        rects->active--;
+     }
+}
+
 void
 evas_common_init(void)
 {
@@ -43,10 +95,17 @@ evas_common_draw_context_new(void)
 EAPI void
 evas_common_draw_context_free(RGBA_Draw_Context *dc)
 {
+   evas_common_draw_context_apply_clean_cutouts(&dc->cutout);
    free(dc);
 }
 
 EAPI void
+evas_common_draw_context_clear_cutouts(RGBA_Draw_Context *dc)
+{
+   evas_common_draw_context_apply_clean_cutouts(&dc->cutout);
+}
+
+EAPI void
 evas_common_draw_context_font_ext_set(RGBA_Draw_Context *dc,
                                      void *data,
                                      void *(*gl_new)  (void *data, 
RGBA_Font_Glyph *fg),
@@ -115,113 +174,34 @@ evas_common_draw_context_unset_multiplie
 EAPI void
 evas_common_draw_context_add_cutout(RGBA_Draw_Context *dc, int x, int y, int 
w, int h)
 {
-   Cutout_Rect *r;
-
-   r = calloc(1, sizeof(Cutout_Rect));
-   r->x = x;
-   r->y = y;
-   r->w = w;
-   r->h = h;
-   dc->cutout.rects = evas_object_list_append(dc->cutout.rects, r);
-}
-
-EAPI void
-evas_common_draw_context_clear_cutouts(RGBA_Draw_Context *dc)
-{
-   evas_common_draw_context_apply_free_cutouts(dc->cutout.rects);
-   dc->cutout.rects = NULL;
-}
-
-EAPI Cutout_Rect *
-evas_common_draw_context_apply_cutouts(RGBA_Draw_Context *dc)
-{
-   Cutout_Rect *r, *rects;
-   Evas_Object_List *l;
-
-   if (!dc->clip.use) return NULL;
-   if ((dc->clip.w <= 0) || (dc->clip.h <= 0)) return NULL;
-   r = calloc(1, sizeof(Cutout_Rect));
-   r->x = dc->clip.x;
-   r->y = dc->clip.y;
-   r->w = dc->clip.w;
-   r->h = dc->clip.h;
-   rects = r;
-   for (l = (Evas_Object_List *)dc->cutout.rects; l; l = l->next)
-     {
-       r = (Cutout_Rect *)l;
-       rects = evas_common_draw_context_cutouts_split(rects, r);
-     }
-   return rects;
+   evas_common_draw_context_cutouts_add(&dc->cutout, x, y, w, h);
 }
 
-EAPI void
-evas_common_draw_context_apply_free_cutouts(Cutout_Rect *rects)
-{
-   while (rects)
-     {
-       Cutout_Rect *r;
-
-       r = rects;
-       rects = evas_object_list_remove(rects, rects);
-       free(r);
-     }
-}
-
-EAPI Cutout_Rect *
-evas_common_draw_context_cutouts_split(Cutout_Rect *in, Cutout_Rect *split)
-{
-   /* multiple rect in, multiple out */
-   Cutout_Rect *out;
-   Evas_Object_List *l;
-
-   out = NULL;
-   for (l = (Evas_Object_List *)in; l; l = l->next)
-     {
-       Cutout_Rect *r;
-
-       r = (Cutout_Rect *)l;
-       r = evas_common_draw_context_cutout_split(r, split);
-       while (r)
-         {
-            Cutout_Rect *r2;
-
-            r2 = r;
-            r = evas_object_list_remove(r, r);
-            out = evas_object_list_append(out, r2);
-         }
-     }
-   evas_common_draw_context_apply_free_cutouts(in);
-   return out;
-}
-
-EAPI Cutout_Rect *
-evas_common_draw_context_cutout_split(Cutout_Rect *in, Cutout_Rect *split)
+int
+evas_common_draw_context_cutout_split(Cutout_Rects* res, int index, 
Cutout_Rect *split)
 {
    /* 1 input rect, multiple out */
-   Cutout_Rect *out;
-   Cutout_Rect *r;
+   Cutout_Rect  in = res->rects[index];
 
    /* this is to save me a LOT of typing */
-#define INX1 (in->x)
-#define INX2 (in->x + in->w)
+#define INX1 (in.x)
+#define INX2 (in.x + in.w)
 #define SPX1 (split->x)
 #define SPX2 (split->x + split->w)
-#define INY1 (in->y)
-#define INY2 (in->y + in->h)
+#define INY1 (in.y)
+#define INY2 (in.y + in.h)
 #define SPY1 (split->y)
 #define SPY2 (split->y + split->h)
-#define X1_IN (in->x < split->x)
-#define X2_IN ((in->x + in->w) > (split->x + split->w))
-#define Y1_IN (in->y < split->y)
-#define Y2_IN ((in->y + in->h) > (split->y + split->h))
-#define R_NEW(_r, _x, _y, _w, _h) {(_r) = calloc(1, sizeof(Cutout_Rect)); 
(_r)->x = (_x); (_r)->y = (_y); (_r)->w = (_w); (_r)->h = (_h);}
-   out = NULL;
-   if (!RECTS_INTERSECT(in->x, in->y, in->w, in->h,
+#define X1_IN (in.x < split->x)
+#define X2_IN ((in.x + in.w) > (split->x + split->w))
+#define Y1_IN (in.y < split->y)
+#define Y2_IN ((in.y + in.h) > (split->y + split->h))
+#define R_NEW(_r, _x, _y, _w, _h) { evas_common_draw_context_cutouts_add(_r, 
_x, _y, _w, _h); }
+   if (!RECTS_INTERSECT(in.x, in.y, in.w, in.h,
                        split->x, split->y, split->w, split->h))
      {
-       R_NEW(r, in->x, in->y, in->w, in->h);
-       out = evas_object_list_append(out, r);
-       return out;
+        /* No colision => no clipping, don't touch it. */
+       return 1;
      }
 
    /* S    = split (ie cut out rect) */
@@ -237,15 +217,13 @@ evas_common_draw_context_cutout_split(Cu
     */
    if (X1_IN && X2_IN && Y1_IN && Y2_IN)
      {
-       R_NEW(r, in->x, in->y, in->w, SPY1 - in->y);
-       out = evas_object_list_append(out, r);
-       R_NEW(r, in->x, SPY1, SPX1 - in->x, SPY2 - SPY1);
-       out = evas_object_list_append(out, r);
-       R_NEW(r, SPX2, SPY1, INX2 - SPX2, SPY2 - SPY1);
-       out = evas_object_list_append(out, r);
-       R_NEW(r, in->x, SPY2, in->w, INY2 - SPY2);
-       out = evas_object_list_append(out, r);
-       return out;
+        R_NEW(res, in.x, in.y, in.w, SPY1 - in.y);
+       R_NEW(res, in.x, SPY1, SPX1 - in.x, SPY2 - SPY1);
+       R_NEW(res, SPX2, SPY1, INX2 - SPX2, SPY2 - SPY1);
+        /* out => (in.x, SPY2, in.w, INY2 - SPY2) */
+        res->rects[index].h = INY2 - SPY2;
+        res->rects[index].y = SPY2;
+       return 1;
      }
    /* SSSSSSS
     * S+---+S
@@ -257,7 +235,8 @@ evas_common_draw_context_cutout_split(Cu
     */
    if (!X1_IN && !X2_IN && !Y1_IN && !Y2_IN)
      {
-       return NULL;
+        evas_common_draw_context_cutouts_del(res, index);
+       return 0;
      }
    /* SSS
     * S+---+
@@ -269,9 +248,10 @@ evas_common_draw_context_cutout_split(Cu
     */
    if (!X1_IN && X2_IN && !Y1_IN && !Y2_IN)
      {
-       R_NEW(r, SPX2, in->y, INX2 - SPX2, in->h);
-       out = evas_object_list_append(out, r);
-       return out;
+        /* in => (SPX2, in.y, INX2 - SPX2, in.h) */
+        res->rects[index].w = INX2 - SPX2;
+        res->rects[index].x = SPX2;
+       return 1;
      }
    /*    S
     *  +---+
@@ -283,11 +263,11 @@ evas_common_draw_context_cutout_split(Cu
     */
    if (X1_IN && X2_IN && !Y1_IN && !Y2_IN)
      {
-       R_NEW(r, in->x, in->y, SPX1 - in->x, in->h);
-       out = evas_object_list_append(out, r);
-       R_NEW(r, SPX2, in->y, INX2 - SPX2, in->h);
-       out = evas_object_list_append(out, r);
-       return out;
+        R_NEW(res, in.x, in.y, SPX1 - in.x, in.h);
+        /* in => (SPX2, in.y, INX2 - SPX2, in.h) */
+        res->rects[index].w = INX2 - SPX2;
+        res->rects[index].x = SPX2;
+       return 1;
      }
    /*     SSS
     *  +---+S
@@ -299,9 +279,9 @@ evas_common_draw_context_cutout_split(Cu
     */
    if (X1_IN && !X2_IN && !Y1_IN && !Y2_IN)
      {
-       R_NEW(r, in->x, in->y, SPX1 - in->x, in->h);
-       out = evas_object_list_append(out, r);
-       return out;
+        /* in => (in.x, in.y, SPX1 - in.x, in.h) */
+        res->rects[index].w = SPX1 - in.x;
+       return 1;
      }
    /* SSSSSSS
     * S+---+S
@@ -313,9 +293,10 @@ evas_common_draw_context_cutout_split(Cu
     */
    if (!X1_IN && !X2_IN && !Y1_IN && Y2_IN)
      {
-       R_NEW(r, in->x, SPY2, in->w, INY2 - SPY2);
-       out = evas_object_list_append(out, r);
-       return out;
+        /* in => (in.x, SPY2, in.w, INY2 - SPY2) */
+        res->rects[index].h = INY2 - SPY2;
+        res->rects[index].y = SPY2;
+       return 1;
      }
    /*
     *  +---+
@@ -327,11 +308,10 @@ evas_common_draw_context_cutout_split(Cu
     */
    if (!X1_IN && !X2_IN && Y1_IN && Y2_IN)
      {
-       R_NEW(r, in->x, in->y, in->w, SPY1 - in->y);
-       out = evas_object_list_append(out, r);
-       R_NEW(r, in->x, SPY2, in->w, INY2 - SPY2);
-       out = evas_object_list_append(out, r);
-       return out;
+        R_NEW(res, in.x, SPY2, in.w, INY2 - SPY2);
+        /* in => (in.x, in.y, in.w, SPY1 - in.y) */
+        res->rects[index].h = SPY1 - in.y;
+       return 1;
      }
    /*
     *  +---+
@@ -343,9 +323,9 @@ evas_common_draw_context_cutout_split(Cu
     */
    if (!X1_IN && !X2_IN && Y1_IN && !Y2_IN)
      {
-       R_NEW(r, in->x, in->y, in->w, SPY1 - in->y);
-       out = evas_object_list_append(out, r);
-       return out;
+        /* in => (in.x, in.y, in.w, SPY1 - in.y) */
+        res->rects[index].h = SPY1 - in.y;
+       return 1;
      }
    /* SSS
     * S+---+
@@ -357,11 +337,11 @@ evas_common_draw_context_cutout_split(Cu
     */
    if (!X1_IN && X2_IN && !Y1_IN && Y2_IN)
      {
-       R_NEW(r, SPX2, in->y, INX2 - SPX2, SPY2 - in->y);
-       out = evas_object_list_append(out, r);
-       R_NEW(r, in->x, SPY2, in->w, INY2 - SPY2);
-       out = evas_object_list_append(out, r);
-       return out;
+       R_NEW(res, SPX2, in.y, INX2 - SPX2, SPY2 - in.y);
+        /* in => (in.x, SPY2, in.w, INY2 - SPY2) */
+        res->rects[index].h = INY2 - SPY2;
+        res->rects[index].y = SPY2;
+       return 1;
      }
    /*    S
     *  +---+
@@ -373,13 +353,12 @@ evas_common_draw_context_cutout_split(Cu
     */
    if (X1_IN && X2_IN && !Y1_IN && Y2_IN)
      {
-       R_NEW(r, in->x, in->y, SPX1 - in->x, SPY2 - in->y);
-       out = evas_object_list_append(out, r);
-       R_NEW(r, SPX2, in->y, INX2 - SPX2, SPY2 - in->y);
-       out = evas_object_list_append(out, r);
-       R_NEW(r, in->x, SPY2, in->w, INY2 - SPY2);
-       out = evas_object_list_append(out, r);
-       return out;
+       R_NEW(res, in.x, in.y, SPX1 - in.x, SPY2 - in.y);
+       R_NEW(res, SPX2, in.y, INX2 - SPX2, SPY2 - in.y);
+        /* in => (in.x, SPY2, in.w, INY2 - SPY2) */
+        res->rects[index].h = INY2 - SPY2;
+        res->rects[index].y = SPY2;
+       return 1;
      }
    /*     SSS
     *  +---+S
@@ -391,11 +370,11 @@ evas_common_draw_context_cutout_split(Cu
     */
    if (X1_IN && !X2_IN && !Y1_IN && Y2_IN)
      {
-       R_NEW(r, in->x, in->y, SPX1 - in->x, SPY2 - in->y);
-       out = evas_object_list_append(out, r);
-       R_NEW(r, in->x, SPY2, in->w, INY2 - SPY2);
-       out = evas_object_list_append(out, r);
-       return out;
+       R_NEW(res, in.x, in.y, SPX1 - in.x, SPY2 - in.y);
+        /* in => (in.x, SPY2, in.w, INY2 - SPY2) */
+        res->rects[index].h = INY2 - SPY2;
+        res->rects[index].y = SPY2;
+       return 1;
      }
    /*
     *  +---+
@@ -407,13 +386,11 @@ evas_common_draw_context_cutout_split(Cu
     */
    if (!X1_IN && X2_IN && Y1_IN && Y2_IN)
      {
-       R_NEW(r, in->x, in->y, in->w, SPY1 - in->y);
-       out = evas_object_list_append(out, r);
-       R_NEW(r, SPX2, SPY1, INX2 - SPX2, SPY2 - SPY1);
-       out = evas_object_list_append(out, r);
-       R_NEW(r, in->x, SPY2, in->w, INY2 - SPY2);
-       out = evas_object_list_append(out, r);
-       return out;
+       R_NEW(res, in.x, SPY2, in.w, INY2 - SPY2);
+       R_NEW(res, SPX2, SPY1, INX2 - SPX2, SPY2 - SPY1);
+        /* in => (in.x, SPY2, in.w, INY2 - SPY2) */
+        res->rects[index].h = SPY1 - in.y;
+       return 1;
      }
    /*
     *  +---+
@@ -425,13 +402,11 @@ evas_common_draw_context_cutout_split(Cu
     */
    if (X1_IN && !X2_IN && Y1_IN && Y2_IN)
      {
-       R_NEW(r, in->x, in->y, in->w, SPY1 - in->y);
-       out = evas_object_list_append(out, r);
-       R_NEW(r, in->x, SPY1, SPX1 - in->x, SPY2 - SPY1);
-       out = evas_object_list_append(out, r);
-       R_NEW(r, in->x, SPY2, in->w, INY2 - SPY2);
-       out = evas_object_list_append(out, r);
-       return out;
+       R_NEW(res, in.x, SPY2, in.w, INY2 - SPY2);
+       R_NEW(res, in.x, SPY1, SPX1 - in.x, SPY2 - SPY1);
+        /* in => (in.x, in.y, in.w, SPY1 - in.y) */
+        res->rects[index].h = SPY1 - in.y;
+       return 1;
      }
    /*
     *  +---+
@@ -443,11 +418,10 @@ evas_common_draw_context_cutout_split(Cu
     */
    if (!X1_IN && X2_IN && Y1_IN && !Y2_IN)
      {
-       R_NEW(r, in->x, in->y, in->w, SPY1 - in->y);
-       out = evas_object_list_append(out, r);
-       R_NEW(r, SPX2, SPY1, INX2 - SPX2, INY2 - SPY1);
-       out = evas_object_list_append(out, r);
-       return out;
+        R_NEW(res, SPX2, SPY1, INX2 - SPX2, INY2 - SPY1);
+        /* in => (in.x, in.y, in.w, SPY1 - in.y) */
+        res->rects[index].h = SPY1 - in.y;
+       return 1;
      }
    /*
     *  +---+
@@ -459,13 +433,11 @@ evas_common_draw_context_cutout_split(Cu
     */
    if (X1_IN && X2_IN && Y1_IN && !Y2_IN)
      {
-       R_NEW(r, in->x, in->y, in->w, SPY1 - in->y);
-       out = evas_object_list_append(out, r);
-       R_NEW(r, in->x, SPY1, SPX1 - in->x, INY2 - SPY1);
-       out = evas_object_list_append(out, r);
-       R_NEW(r, SPX2, SPY1, INX2 - SPX2, INY2 - SPY1);
-       out = evas_object_list_append(out, r);
-       return out;
+       R_NEW(res, in.x, SPY1, SPX1 - in.x, INY2 - SPY1);
+        R_NEW(res, SPX2, SPY1, INX2 - SPX2, INY2 - SPY1);
+        /* in => (in.x, in.y, in.w, SPY1 - in.y) */
+        res->rects[index].h = SPY1 - in.y;
+       return 1;
      }
    /*
     *  +---+
@@ -477,13 +449,13 @@ evas_common_draw_context_cutout_split(Cu
     */
    if (X1_IN && !X2_IN && Y1_IN && !Y2_IN)
      {
-       R_NEW(r, in->x, in->y, in->w, SPY1 - in->y);
-       out = evas_object_list_append(out, r);
-       R_NEW(r, in->x, SPY1, SPX1 - in->x, INY2 - SPY1);
-       out = evas_object_list_append(out, r);
-       return out;
+        R_NEW(res, in.x, SPY1, SPX1 - in.x, INY2 - SPY1);
+        /* in => (in.x, in.y, in.w, SPY1 - in.y) */
+        res->rects[index].h = SPY1 - in.y;
+       return 1;
      }
-   return NULL;
+   evas_common_draw_context_cutouts_del(res, index);
+   return 0;
 #undef INX1
 #undef INX2
 #undef SPX1
@@ -499,32 +471,49 @@ evas_common_draw_context_cutout_split(Cu
 #undef R_NEW
 }
 
-EAPI Cutout_Rect *
-evas_common_draw_context_cutout_merge(Cutout_Rect *in, Cutout_Rect *merge)
+EAPI Cutout_Rects*
+evas_common_draw_context_apply_cutouts(RGBA_Draw_Context *dc)
 {
-   /* 1 input rect, multiple out */
-   Cutout_Rect *out;
-   Cutout_Rect *r;
-   Evas_Object_List *l;
+   Cutout_Rects*        res;
+   int                  i;
+   int                  j;
 
-   for (l = (Evas_Object_List *)in; l; l = l->next)
-     {
-       r = (Cutout_Rect *)l;
+   if (!dc->clip.use) return NULL;
+   if ((dc->clip.w <= 0) || (dc->clip.h <= 0)) return NULL;
 
-       merge = evas_common_draw_context_cutouts_split(merge, r);
-       if (!merge) return in;
-     }
-   r = merge;
-   out = in;
-   while (r)
+   res = evas_common_draw_context_cutouts_new();
+   evas_common_draw_context_cutouts_add(res, dc->clip.x, dc->clip.y, 
dc->clip.w, dc->clip.h);
+
+   for (i = 0; i < dc->cutout.active; ++i)
      {
-       Cutout_Rect *r2;
+        /* Don't loop on the element just added to the list as they are 
already correctly clipped. */
+        int active = res->active;
 
-       r2 = r;
-       r = evas_object_list_remove(r, r);
-       out = evas_object_list_append(out, r2);
+        for (j = 0; j < active; )
+          {
+             if (evas_common_draw_context_cutout_split(res, j, 
dc->cutout.rects + i))
+               ++j;
+             else
+               active--;
+          }
      }
-   return out;
+   return res;
+}
+
+EAPI void
+evas_common_draw_context_apply_clear_cutouts(Cutout_Rects* rects)
+{
+   evas_common_draw_context_apply_clean_cutouts(rects);
+   free(rects);
+}
+
+EAPI void
+evas_common_draw_context_apply_clean_cutouts(Cutout_Rects* rects)
+{
+   free(rects->rects);
+   rects->rects = NULL;
+   rects->active = 0;
+   rects->max = 0;
 }
 
 EAPI void
Index: src/lib/engines/common/evas_pipe.c
===================================================================
RCS file: /cvs/e/e17/libs/evas/src/lib/engines/common/evas_pipe.c,v
retrieving revision 1.6
diff -u -p -r1.6 evas_pipe.c
--- src/lib/engines/common/evas_pipe.c  28 Dec 2006 12:40:42 -0000      1.6
+++ src/lib/engines/common/evas_pipe.c  29 Mar 2007 18:32:07 -0000
@@ -38,27 +38,16 @@ static void
 evas_common_pipe_draw_context_copy(RGBA_Draw_Context *dc, RGBA_Pipe_Op *op)
 {
    Cutout_Rect *r, *r2;
-   
+
    memcpy(&(op->context), dc, sizeof(RGBA_Draw_Context));
-   op->context.cutout.rects = NULL;
-   for (r = dc->cutout.rects; r; r = (Cutout_Rect *)((Evas_Object_List 
*)r)->next)
-     {
-       r2 = calloc(1, sizeof(Cutout_Rect));
-       if (r2)
-         {
-            r2->x = r->x;
-            r2->y = r->y;
-            r2->w = r->w;
-            r2->h = r->h;
-            op->context.cutout.rects = 
evas_object_list_append(op->context.cutout.rects, r2);
-         }
-     }
+   op->context.cutout.rects = malloc(sizeof(Cutout_Rect) * 
op->context.cutout.active);
+   memcpy(op->context.cutout.rects, dc->cutout.rects, sizeof(Cutout_Rect) * 
op->context.cutout.active);
 }
 
 static void
 evas_common_pipe_op_free(RGBA_Pipe_Op *op)
 {
-   evas_common_draw_context_apply_free_cutouts(op->context.cutout.rects);
+   evas_common_draw_context_apply_clean_cutouts(&op->context.cutout);
 }
 
 /* main api calls */
Index: src/lib/engines/common/evas_rectangle_main.c
===================================================================
RCS file: /cvs/e/e17/libs/evas/src/lib/engines/common/evas_rectangle_main.c,v
retrieving revision 1.6
diff -u -p -r1.6 evas_rectangle_main.c
--- src/lib/engines/common/evas_rectangle_main.c        15 Nov 2006 16:44:34 
-0000      1.6
+++ src/lib/engines/common/evas_rectangle_main.c        29 Mar 2007 18:32:07 
-0000
@@ -10,9 +10,10 @@ evas_common_rectangle_init(void)
 EAPI void
 evas_common_rectangle_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int 
y, int w, int h)
 {
-   int c, cx, cy, cw, ch;
-   Cutout_Rect *rects, *r;
-   Evas_Object_List *l;
+   Cutout_Rects *rects;
+   Cutout_Rect  *r;
+   int          c, cx, cy, cw, ch;
+   int          i;
    /* handle cutouts here! */
 
    if ((w <= 0) || (h <= 0)) return;
@@ -35,13 +36,13 @@ evas_common_rectangle_draw(RGBA_Image *d
        return;
      }
    rects = evas_common_draw_context_apply_cutouts(dc);
-   for (l = (Evas_Object_List *)rects; l; l = l->next)
+   for (i = 0; i < rects->active; ++i)
      {
-       r = (Cutout_Rect *)l;
+       r = rects->rects + i;
        evas_common_draw_context_set_clip(dc, r->x, r->y, r->w, r->h);
        rectangle_draw_internal(dst, dc, x, y, w, h);
      }
-   evas_common_draw_context_apply_free_cutouts(rects);
+   evas_common_draw_context_apply_clear_cutouts(rects);
    /* restore clip info */
    dc->clip.use = c; dc->clip.x = cx; dc->clip.y = cy; dc->clip.w = cw; 
dc->clip.h = ch;
 }
Index: src/lib/engines/common/evas_scale_sample.c
===================================================================
RCS file: /cvs/e/e17/libs/evas/src/lib/engines/common/evas_scale_sample.c,v
retrieving revision 1.8
diff -u -p -r1.8 evas_scale_sample.c
--- src/lib/engines/common/evas_scale_sample.c  15 Nov 2006 16:44:34 -0000      
1.8
+++ src/lib/engines/common/evas_scale_sample.c  29 Mar 2007 18:32:07 -0000
@@ -30,9 +30,10 @@ evas_common_scale_rgba_in_to_out_clip_sa
                                 int dst_region_x, int dst_region_y,
                                 int dst_region_w, int dst_region_h)
 {
-   int c, cx, cy, cw, ch;
-   Cutout_Rect *rects, *r;
-   Evas_Object_List *l;
+   Cutout_Rects *rects;
+   Cutout_Rect  *r;
+   int          c, cx, cy, cw, ch;
+   int          i;
    /* handle cutouts here! */
 
    if ((dst_region_w <= 0) || (dst_region_h <= 0)) return;
@@ -59,9 +60,9 @@ evas_common_scale_rgba_in_to_out_clip_sa
        return;
      }
    rects = evas_common_draw_context_apply_cutouts(dc);
-   for (l = (Evas_Object_List *)rects; l; l = l->next)
+   for (i = 0; i < rects->active; ++i)
      {
-       r = (Cutout_Rect *)l;
+       r = rects->rects + i;
        evas_common_draw_context_set_clip(dc, r->x, r->y, r->w, r->h);
        scale_rgba_in_to_out_clip_sample_internal(src, dst, dc,
                                                  src_region_x, src_region_y,
@@ -70,7 +71,7 @@ evas_common_scale_rgba_in_to_out_clip_sa
                                                  dst_region_w, dst_region_h);
 
      }
-   evas_common_draw_context_apply_free_cutouts(rects);
+   evas_common_draw_context_apply_clear_cutouts(rects);
    /* restore clip info */
    dc->clip.use = c; dc->clip.x = cx; dc->clip.y = cy; dc->clip.w = cw; 
dc->clip.h = ch;
 }
Index: src/lib/engines/common/evas_scale_smooth.c
===================================================================
RCS file: /cvs/e/e17/libs/evas/src/lib/engines/common/evas_scale_smooth.c,v
retrieving revision 1.15
diff -u -p -r1.15 evas_scale_smooth.c
--- src/lib/engines/common/evas_scale_smooth.c  30 Sep 2006 10:18:32 -0000      
1.15
+++ src/lib/engines/common/evas_scale_smooth.c  29 Mar 2007 18:32:07 -0000
@@ -447,9 +447,10 @@ evas_common_scale_rgba_in_to_out_clip_sm
 # ifdef BUILD_MMX
    int mmx, sse, sse2;
 # endif
-   int c, cx, cy, cw, ch;
-   Cutout_Rect *rects, *r;
-   Evas_Object_List *l;
+   Cutout_Rects *rects;
+   Cutout_Rect  *r;
+   int          c, cx, cy, cw, ch;
+   int          i;
    /* handle cutouts here! */
 
    if ((dst_region_w <= 0) || (dst_region_h <= 0)) return;
@@ -490,9 +491,9 @@ evas_common_scale_rgba_in_to_out_clip_sm
        return;
      }
    rects = evas_common_draw_context_apply_cutouts(dc);
-   for (l = (Evas_Object_List *)rects; l; l = l->next)
+   for (i = 0; i < rects->active; ++i)
      {
-       r = (Cutout_Rect *)l;
+       r = rects->rects + i;
        evas_common_draw_context_set_clip(dc, r->x, r->y, r->w, r->h);
 # ifdef BUILD_MMX
        if (mmx)
@@ -511,7 +512,7 @@ evas_common_scale_rgba_in_to_out_clip_sm
                                             dst_region_w, dst_region_h);
 # endif
      }
-   evas_common_draw_context_apply_free_cutouts(rects);
+   evas_common_draw_context_apply_clear_cutouts(rects);
    /* restore clip info */
    dc->clip.use = c; dc->clip.x = cx; dc->clip.y = cy; dc->clip.w = cw; 
dc->clip.h = ch;
 }
Index: src/lib/include/evas_common.h
===================================================================
RCS file: /cvs/e/e17/libs/evas/src/lib/include/evas_common.h,v
retrieving revision 1.78
diff -u -p -r1.78 evas_common.h
--- src/lib/include/evas_common.h       3 Mar 2007 09:04:47 -0000       1.78
+++ src/lib/include/evas_common.h       29 Mar 2007 18:32:08 -0000
@@ -140,6 +140,7 @@ typedef struct _RGBA_Font_Glyph       RG
 typedef struct _RGBA_Gfx_Compositor   RGBA_Gfx_Compositor;
 
 typedef struct _Cutout_Rect           Cutout_Rect;
+typedef struct _Cutout_Rects            Cutout_Rects;
 
 typedef struct _Convert_Pal           Convert_Pal;
 
@@ -235,6 +236,18 @@ struct _Evas_Hash_El
    void             *data;
 };
 
+struct _Cutout_Rect
+{
+   int               x, y, w, h;
+};
+
+struct _Cutout_Rects
+{
+   Cutout_Rect*      rects;
+   int               active;
+   int               max;
+};
+
 struct _RGBA_Draw_Context
 {
    struct {
@@ -248,9 +261,7 @@ struct _RGBA_Draw_Context
       char   use : 1;
       int    x, y, w, h;
    } clip;
-   struct {
-     Cutout_Rect *rects;
-   } cutout;
+   Cutout_Rects cutout;
    struct {
       struct {
         void *(*gl_new)  (void *data, RGBA_Font_Glyph *fg);
@@ -572,11 +583,6 @@ struct _Regionspan
    int x1, x2;
 };
 */
-struct _Cutout_Rect
-{
-   Evas_Object_List  _list_data;
-   int               x, y, w, h;
-};
 
 struct _Convert_Pal
 {
@@ -1012,11 +1018,9 @@ EAPI void               evas_common_draw
 EAPI void               evas_common_draw_context_unset_multiplier  
(RGBA_Draw_Context *dc);
 EAPI void               evas_common_draw_context_add_cutout        
(RGBA_Draw_Context *dc, int x, int y, int w, int h);
 EAPI void               evas_common_draw_context_clear_cutouts     
(RGBA_Draw_Context *dc);
-EAPI Cutout_Rect       *evas_common_draw_context_apply_cutouts     
(RGBA_Draw_Context *dc);
-EAPI void               
evas_common_draw_context_apply_free_cutouts(Cutout_Rect *rects);
-EAPI Cutout_Rect       *evas_common_draw_context_cutouts_split     
(Cutout_Rect *in, Cutout_Rect *split);
-EAPI Cutout_Rect       *evas_common_draw_context_cutout_split      
(Cutout_Rect *in, Cutout_Rect *split);
-EAPI Cutout_Rect       *evas_common_draw_context_cutout_merge      
(Cutout_Rect *in, Cutout_Rect *merge);
+EAPI Cutout_Rects      *evas_common_draw_context_apply_cutouts     
(RGBA_Draw_Context *dc);
+EAPI void               
evas_common_draw_context_apply_clear_cutouts(Cutout_Rects* rects);
+EAPI void               
evas_common_draw_context_apply_clean_cutouts(Cutout_Rects* rects);
 EAPI void               evas_common_draw_context_set_anti_alias    
(RGBA_Draw_Context *dc, unsigned char aa);
 EAPI void               
evas_common_draw_context_set_color_interpolation(RGBA_Draw_Context *dc, int 
color_space);
 EAPI void               evas_common_draw_context_set_render_op     
(RGBA_Draw_Context *dc, int op);
Index: src/modules/engines/directfb/evas_engine_dfb.c
===================================================================
RCS file: /cvs/e/e17/libs/evas/src/modules/engines/directfb/evas_engine_dfb.c,v
retrieving revision 1.9
diff -u -p -r1.9 evas_engine_dfb.c
--- src/modules/engines/directfb/evas_engine_dfb.c      10 Feb 2007 17:23:06 
-0000      1.9
+++ src/modules/engines/directfb/evas_engine_dfb.c      29 Mar 2007 18:32:09 
-0000
@@ -596,10 +596,11 @@ void
 evas_engine_directfb_draw_rectangle(void *data, void *context, void *surface,
                                    int x, int y, int w, int h)
 {
+   int                 i;
    int                 c, cx, cy, cw, ch;
-   Cutout_Rect        *rects, *r;
+   Cutout_Rects       *rects;
+   Cutout_Rect        *r;
    RGBA_Draw_Context  *dc = (RGBA_Draw_Context *) context;
-   Evas_Object_List   *l;
    Render_Engine      *re = (Render_Engine *) data;
 
    /* handle cutouts here! */
@@ -629,13 +630,13 @@ evas_engine_directfb_draw_rectangle(void
        return;
      }
    rects = evas_common_draw_context_apply_cutouts(dc);
-   for (l = (Evas_Object_List *) rects; l; l = l->next)
+   for (i = 0; i < rects->active; ++i)
      {
-       r = (Cutout_Rect *) l;
+       r = rects->rects + i;
        evas_common_draw_context_set_clip(dc, r->x, r->y, r->w, r->h);
        rectangle_draw_internal(data, dc, x, y, w, h);
      }
-   evas_common_draw_context_apply_free_cutouts(rects);
+   evas_common_draw_context_clear_cutouts(rects);
    /* restore clip info */
    dc->clip.use = c;
    dc->clip.x = cx;
Index: src/modules/engines/xrender_x11/evas_engine_xrender.c
===================================================================
RCS file: 
/cvs/e/e17/libs/evas/src/modules/engines/xrender_x11/evas_engine_xrender.c,v
retrieving revision 1.28
diff -u -p -r1.28 evas_engine_xrender.c
--- src/modules/engines/xrender_x11/evas_engine_xrender.c       5 Nov 2006 
12:53:25 -0000       1.28
+++ src/modules/engines/xrender_x11/evas_engine_xrender.c       29 Mar 2007 
18:32:10 -0000
@@ -283,23 +283,23 @@ _xr_render_surface_clips_set(Xrender_Sur
      }
    else
      {
-       int i;
-       Cutout_Rect *rects, *r;
-       Evas_Object_List *l;
-       
-       rects = evas_common_draw_context_apply_cutouts(dc);
-       for (num = 0, l = (Evas_Object_List *)rects; l; l = l->next) num++;
+        Cutout_Rects    *rects;
+       Cutout_Rect     *r;
+        int i;
+
+        rects = evas_common_draw_context_apply_cutouts(dc);
+        num = rects->active;
        rect = malloc(num * sizeof(XRectangle));
        if (!rect) return;
-       for (i = 0, l = (Evas_Object_List *)rects; l; l = l->next, i++)
+       for (i = 0; i < num; i++)
          {
-            r = (Cutout_Rect *)l;
+            r = rects->rects + i;
             rect[i].x = r->x;
             rect[i].y = r->y;
             rect[i].width = r->w;
             rect[i].height = r->h;
          }
-       evas_common_draw_context_apply_free_cutouts(rects);
+       evas_common_draw_context_apply_clear_cutouts(rects);
      }
    if (!rect) return;
    XRenderSetPictureClipRectangles(rs->xinf->disp, rs->pic, 0, 0, rect, num);
Index: src/modules/engines/xrender_xcb/evas_engine_xrender.c
===================================================================
RCS file: 
/cvs/e/e17/libs/evas/src/modules/engines/xrender_xcb/evas_engine_xrender.c,v
retrieving revision 1.8
diff -u -p -r1.8 evas_engine_xrender.c
--- src/modules/engines/xrender_xcb/evas_engine_xrender.c       10 Oct 2006 
19:15:48 -0000      1.8
+++ src/modules/engines/xrender_xcb/evas_engine_xrender.c       29 Mar 2007 
18:32:10 -0000
@@ -413,23 +413,23 @@ _xr_render_surface_clips_set(Xcb_Render_
      }
    else
      {
-       int i;
-       Cutout_Rect *rects, *r;
-       Evas_Object_List *l;
+        Cutout_Rect     *rects;
+       Cutout_Rect     *r;
+       int             i;
 
        rects = evas_common_draw_context_apply_cutouts(dc);
-       for (num = 0, l = (Evas_Object_List *)rects; l; l = l->next) num++;
+       num = rects->active;
        rect = malloc(num * sizeof(xcb_rectangle_t));
        if (!rect) return;
-       for (i = 0, l = (Evas_Object_List *)rects; l; l = l->next, i++)
+       for (i = 0; i < num; i++)
          {
-            r = (Cutout_Rect *)l;
+            r = rects->rects + i;
             rect[i].x = r->x;
             rect[i].y = r->y;
             rect[i].width = r->w;
             rect[i].height = r->h;
          }
-       evas_common_draw_context_apply_free_cutouts(rects);
+       evas_common_draw_context_apply_clear_cutouts(rects);
      }
    if (!rect) return;
    xcb_render_set_picture_clip_rectangles(rs->xcbinf->conn, rs->pic, 0, 0, 
num, rect);

Attachment: pgp9RE6xBkSBr.pgp
Description: PGP signature

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to