On Thursday 29 March 2007 17:58:58 Cedric BAIL wrote:
> 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.
Hum, a little bit too short :) I forgot the patch ! I think I can sleep now :)
Cedric
diff -X exclude.cvs -Nrau e17-main/libs/evas/src/modules/engines/directfb/evas_engine_dfb.c e17-dev/libs/evas/src/modules/engines/directfb/evas_engine_dfb.c
--- e17-main/libs/evas/src/modules/engines/directfb/evas_engine_dfb.c 2007-03-19 23:50:01.000000000 +0100
+++ e17-dev/libs/evas/src/modules/engines/directfb/evas_engine_dfb.c 2007-03-28 16:22:57.000000000 +0200
@@ -596,10 +596,11 @@
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 @@
return;
}
rects = evas_common_draw_context_apply_cutouts(dc);
- for (l = (Evas_Object_List *) rects; l; l = l->next)
+ for (i = 0; i < rects->activ; ++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;
iff -X exclude.cvs -Nrau e17-main/libs/evas/src/modules/engines/xrender_x11/evas_engine_xrender.c e17-dev/libs/evas/src/modules/engines/xrender_x11/evas_engine_xrender.c
--- e17-main/libs/evas/src/modules/engines/xrender_x11/evas_engine_xrender.c 2006-12-26 11:57:39.000000000 +0100
+++ e17-dev/libs/evas/src/modules/engines/xrender_x11/evas_engine_xrender.c 2007-03-28 17:19:33.000000000 +0200
@@ -283,23 +283,23 @@
}
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->activ;
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);
diff -X exclude.cvs -Nrau e17-main/libs/evas/src/modules/engines/xrender_xcb/evas_engine_xrender.c e17-dev/libs/evas/src/modules/engines/xrender_xcb/evas_engine_xrender.c
--- e17-main/libs/evas/src/modules/engines/xrender_xcb/evas_engine_xrender.c 2006-12-26 11:57:39.000000000 +0100
+++ e17-dev/libs/evas/src/modules/engines/xrender_xcb/evas_engine_xrender.c 2007-03-28 17:19:37.000000000 +0200
@@ -413,23 +413,23 @@
}
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->activ;
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);
diff -X exclude.cvs -Nrau e17-main/libs/evas/src/lib/engines/common/evas_draw_main.c e17-dev/libs/evas/src/lib/engines/common/evas_draw_main.c
--- e17-main/libs/evas/src/lib/engines/common/evas_draw_main.c 2006-12-26 11:57:37.000000000 +0100
+++ e17-dev/libs/evas/src/lib/engines/common/evas_draw_main.c 2007-03-28 18:27:39.000000000 +0200
@@ -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->activ = 0;
+ rects->max = 0;
+
+ return rects;
+}
+
+EAPI void
+evas_common_draw_context_cutouts_free(Cutout_Rects* rects)
+{
+ rects->activ = 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->activ + 1) {
+ rects->max += 8;
+ rects->rects = realloc(rects->rects, sizeof(Cutout_Rect) * rects->max);
+ }
+
+ rect = rects->rects + rects->activ++;
+ 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 delta)
+{
+ if (delta >= 0 && delta < rects->activ)
+ {
+ Cutout_Rect* rect = rects->rects + delta;
+
+ memmove(rect, rect + 1, sizeof (Cutout_Rect) * (rects->activ - delta - 1));
+ rects->activ--;
+ }
+}
+
void
evas_common_init(void)
{
@@ -43,10 +95,17 @@
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 @@
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 @@
*/
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 @@
*/
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 @@
*/
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 @@
*/
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 @@
*/
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 @@
*/
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 @@
*/
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 @@
*/
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 @@
*/
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 @@
*/
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 @@
*/
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 @@
*/
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 @@
*/
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 @@
*/
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 @@
*/
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 @@
*/
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 @@
#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.activ; ++i)
{
- Cutout_Rect *r2;
+ /* Don't loop on the element just added to the list as they are already correctly clipped. */
+ int activ = res->activ;
- r2 = r;
- r = evas_object_list_remove(r, r);
- out = evas_object_list_append(out, r2);
+ for (j = 0; j < activ; )
+ {
+ if (evas_common_draw_context_cutout_split(res, j, dc->cutout.rects + i))
+ ++j;
+ else
+ activ--;
+ }
}
- 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->activ = 0;
+ rects->max = 0;
}
EAPI void
diff -X exclude.cvs -Nrau e17-main/libs/evas/src/lib/engines/common/evas_pipe.c e17-dev/libs/evas/src/lib/engines/common/evas_pipe.c
--- e17-main/libs/evas/src/lib/engines/common/evas_pipe.c 2007-03-19 23:50:00.000000000 +0100
+++ e17-dev/libs/evas/src/lib/engines/common/evas_pipe.c 2007-03-28 17:21:06.000000000 +0200
@@ -38,27 +38,16 @@
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.activ);
+ memcpy(op->context.cutout.rects, dc->cutout.rects, sizeof(Cutout_Rect) * op->context.cutout.activ);
}
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 */
diff -X exclude.cvs -Nrau e17-main/libs/evas/src/lib/engines/common/evas_rectangle_main.c e17-dev/libs/evas/src/lib/engines/common/evas_rectangle_main.c
--- e17-main/libs/evas/src/lib/engines/common/evas_rectangle_main.c 2006-12-26 11:57:38.000000000 +0100
+++ e17-dev/libs/evas/src/lib/engines/common/evas_rectangle_main.c 2007-03-28 16:54:30.000000000 +0200
@@ -10,9 +10,10 @@
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 @@
return;
}
rects = evas_common_draw_context_apply_cutouts(dc);
- for (l = (Evas_Object_List *)rects; l; l = l->next)
+ for (i = 0; i < rects->activ; ++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;
}
diff -X exclude.cvs -Nrau e17-main/libs/evas/src/lib/engines/common/evas_scale_sample.c e17-dev/libs/evas/src/lib/engines/common/evas_scale_sample.c
--- e17-main/libs/evas/src/lib/engines/common/evas_scale_sample.c 2006-12-26 11:57:38.000000000 +0100
+++ e17-dev/libs/evas/src/lib/engines/common/evas_scale_sample.c 2007-03-28 16:54:45.000000000 +0200
@@ -30,9 +30,10 @@
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 @@
return;
}
rects = evas_common_draw_context_apply_cutouts(dc);
- for (l = (Evas_Object_List *)rects; l; l = l->next)
+ for (i = 0; i < rects->activ; ++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 @@
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;
}
diff -X exclude.cvs -Nrau e17-main/libs/evas/src/lib/engines/common/evas_scale_smooth.c e17-dev/libs/evas/src/lib/engines/common/evas_scale_smooth.c
--- e17-main/libs/evas/src/lib/engines/common/evas_scale_smooth.c 2006-12-26 11:57:38.000000000 +0100
+++ e17-dev/libs/evas/src/lib/engines/common/evas_scale_smooth.c 2007-03-28 16:54:55.000000000 +0200
@@ -447,9 +447,10 @@
# 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 @@
return;
}
rects = evas_common_draw_context_apply_cutouts(dc);
- for (l = (Evas_Object_List *)rects; l; l = l->next)
+ for (i = 0; i < rects->activ; ++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 @@
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;
}
diff -X exclude.cvs -Nrau e17-main/libs/evas/src/lib/Evas.h e17-dev/libs/evas/src/lib/Evas.h
--- e17-main/libs/evas/src/lib/Evas.h 2007-03-28 21:58:35.000000000 +0200
+++ e17-dev/libs/evas/src/lib/Evas.h 2007-03-19 19:00:39.000000000 +0100
@@ -344,6 +344,16 @@
unsigned int timestamp;
};
+typedef enum _Evas_Data_Error
+{
+ EVAS_DATA_NONE = 0,
+ EVAS_DATA_NOT_FOUND,
+ EVAS_DATA_FULL,
+ EVAS_DATA_NULL,
+ EVAS_DATA_CONFLICT,
+ EVAS_DATA_REFERENCE
+} Evas_Data_Error;
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -386,10 +396,9 @@
EAPI void evas_hash_free (Evas_Hash *hash);
EAPI void evas_hash_foreach (Evas_Hash *hash, Evas_Bool (*func) (Evas_Hash *hash, const char *key, void *data, void *fdata), const void *fdata);
EAPI int evas_hash_alloc_error (void);
-
+
EAPI const char *evas_stringshare_add (const char *str);
EAPI void evas_stringshare_del (const char *str);
-
EAPI int evas_alloc_error (void);
diff -X exclude.cvs -Nrau e17-main/libs/evas/src/lib/include/evas_common.h e17-dev/libs/evas/src/lib/include/evas_common.h
--- e17-main/libs/evas/src/lib/include/evas_common.h 2007-03-28 22:12:50.000000000 +0200
+++ e17-dev/libs/evas/src/lib/include/evas_common.h 2007-03-28 16:57:25.000000000 +0200
@@ -140,6 +140,7 @@
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;
@@ -238,6 +240,18 @@
void *data;
};
+struct _Cutout_Rect
+{
+ int x, y, w, h;
+};
+
+struct _Cutout_Rects
+{
+ Cutout_Rect* rects;
+ int activ;
+ int max;
+};
+
struct _RGBA_Draw_Context
{
struct {
@@ -251,9 +265,7 @@
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);
@@ -586,11 +598,6 @@
int x1, x2;
};
*/
-struct _Cutout_Rect
-{
- Evas_Object_List _list_data;
- int x, y, w, h;
-};
struct _Convert_Pal
{
@@ -1043,7 +1050,7 @@
void evas_common_regionbuf_span_del (Regionbuf *rb, int x1, int x2, int y);
Tilebuf_Rect *evas_common_regionbuf_rects_get (Regionbuf *rb);
*/
-
+
/****/
EAPI void evas_common_draw_init (void);
@@ -1062,11 +1069,9 @@
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);
-------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel