summaryrefslogtreecommitdiff
path: root/legacy/evas/src/lib
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2007-04-04 09:55:40 +0000
committerCarsten Haitzler <raster@rasterman.com>2007-04-04 09:55:40 +0000
commit5ac7b84136b2e13b975aa65483d9ba42db7ab399 (patch)
tree30a135780e8ccb512ec9df0bd14832923929535a /legacy/evas/src/lib
parent7827e2c598f0de8dbd215b02da2adbb17f31ab3b (diff)
pager urgent popup patch - good
evas clipouts less allocs patch - definite spedusp for when it's used heavily! SVN revision: 29331
Diffstat (limited to '')
-rw-r--r--legacy/evas/src/lib/engines/common/evas_draw_main.c383
-rw-r--r--legacy/evas/src/lib/engines/common/evas_pipe.c19
-rw-r--r--legacy/evas/src/lib/engines/common/evas_rectangle_main.c13
-rw-r--r--legacy/evas/src/lib/engines/common/evas_scale_sample.c13
-rw-r--r--legacy/evas/src/lib/engines/common/evas_scale_smooth.c13
-rw-r--r--legacy/evas/src/lib/include/evas_common.h30
6 files changed, 228 insertions, 243 deletions
diff --git a/legacy/evas/src/lib/engines/common/evas_draw_main.c b/legacy/evas/src/lib/engines/common/evas_draw_main.c
index e67ddd02b0..9a6e9141bd 100644
--- a/legacy/evas/src/lib/engines/common/evas_draw_main.c
+++ b/legacy/evas/src/lib/engines/common/evas_draw_main.c
@@ -1,5 +1,57 @@
1#include "evas_common.h" 1#include "evas_common.h"
2 2
3EAPI Cutout_Rects*
4evas_common_draw_context_cutouts_new()
5{
6 Cutout_Rects *rects;
7
8 rects = malloc(sizeof(Cutout_Rects));
9 rects->rects = NULL;
10 rects->active = 0;
11 rects->max = 0;
12
13 return rects;
14}
15
16EAPI void
17evas_common_draw_context_cutouts_free(Cutout_Rects* rects)
18{
19 rects->active = 0;
20}
21
22EAPI Cutout_Rect*
23evas_common_draw_context_cutouts_add(Cutout_Rects* rects,
24 int x, int y, int w, int h)
25{
26 Cutout_Rect* rect;
27
28 if (rects->max < rects->active + 1) {
29 rects->max += 8;
30 rects->rects = realloc(rects->rects, sizeof(Cutout_Rect) * rects->max);
31 }
32
33 rect = rects->rects + rects->active++;
34 rect->x = x;
35 rect->y = y;
36 rect->w = w;
37 rect->h = h;
38
39 return rect;
40}
41
42EAPI void
43evas_common_draw_context_cutouts_del(Cutout_Rects* rects,
44 int index)
45{
46 if (index >= 0 && index < rects->active)
47 {
48 Cutout_Rect* rect = rects->rects + index;
49
50 memmove(rect, rect + 1, sizeof (Cutout_Rect) * (rects->active - index - 1));
51 rects->active--;
52 }
53}
54
3void 55void
4evas_common_init(void) 56evas_common_init(void)
5{ 57{
@@ -43,10 +95,17 @@ evas_common_draw_context_new(void)
43EAPI void 95EAPI void
44evas_common_draw_context_free(RGBA_Draw_Context *dc) 96evas_common_draw_context_free(RGBA_Draw_Context *dc)
45{ 97{
98 evas_common_draw_context_apply_clean_cutouts(&dc->cutout);
46 free(dc); 99 free(dc);
47} 100}
48 101
49EAPI void 102EAPI void
103evas_common_draw_context_clear_cutouts(RGBA_Draw_Context *dc)
104{
105 evas_common_draw_context_apply_clean_cutouts(&dc->cutout);
106}
107
108EAPI void
50evas_common_draw_context_font_ext_set(RGBA_Draw_Context *dc, 109evas_common_draw_context_font_ext_set(RGBA_Draw_Context *dc,
51 void *data, 110 void *data,
52 void *(*gl_new) (void *data, RGBA_Font_Glyph *fg), 111 void *(*gl_new) (void *data, RGBA_Font_Glyph *fg),
@@ -115,113 +174,34 @@ evas_common_draw_context_unset_multiplier(RGBA_Draw_Context *dc)
115EAPI void 174EAPI void
116evas_common_draw_context_add_cutout(RGBA_Draw_Context *dc, int x, int y, int w, int h) 175evas_common_draw_context_add_cutout(RGBA_Draw_Context *dc, int x, int y, int w, int h)
117{ 176{
118 Cutout_Rect *r; 177 evas_common_draw_context_cutouts_add(&dc->cutout, x, y, w, h);
119
120 r = calloc(1, sizeof(Cutout_Rect));
121 r->x = x;
122 r->y = y;
123 r->w = w;
124 r->h = h;
125 dc->cutout.rects = evas_object_list_append(dc->cutout.rects, r);
126}
127
128EAPI void
129evas_common_draw_context_clear_cutouts(RGBA_Draw_Context *dc)
130{
131 evas_common_draw_context_apply_free_cutouts(dc->cutout.rects);
132 dc->cutout.rects = NULL;
133}
134
135EAPI Cutout_Rect *
136evas_common_draw_context_apply_cutouts(RGBA_Draw_Context *dc)
137{
138 Cutout_Rect *r, *rects;
139 Evas_Object_List *l;
140
141 if (!dc->clip.use) return NULL;
142 if ((dc->clip.w <= 0) || (dc->clip.h <= 0)) return NULL;
143 r = calloc(1, sizeof(Cutout_Rect));
144 r->x = dc->clip.x;
145 r->y = dc->clip.y;
146 r->w = dc->clip.w;
147 r->h = dc->clip.h;
148 rects = r;
149 for (l = (Evas_Object_List *)dc->cutout.rects; l; l = l->next)
150 {
151 r = (Cutout_Rect *)l;
152 rects = evas_common_draw_context_cutouts_split(rects, r);
153 }
154 return rects;
155}
156
157EAPI void
158evas_common_draw_context_apply_free_cutouts(Cutout_Rect *rects)
159{
160 while (rects)
161 {
162 Cutout_Rect *r;
163
164 r = rects;
165 rects = evas_object_list_remove(rects, rects);
166 free(r);
167 }
168}
169
170EAPI Cutout_Rect *
171evas_common_draw_context_cutouts_split(Cutout_Rect *in, Cutout_Rect *split)
172{
173 /* multiple rect in, multiple out */
174 Cutout_Rect *out;
175 Evas_Object_List *l;
176
177 out = NULL;
178 for (l = (Evas_Object_List *)in; l; l = l->next)
179 {
180 Cutout_Rect *r;
181
182 r = (Cutout_Rect *)l;
183 r = evas_common_draw_context_cutout_split(r, split);
184 while (r)
185 {
186 Cutout_Rect *r2;
187
188 r2 = r;
189 r = evas_object_list_remove(r, r);
190 out = evas_object_list_append(out, r2);
191 }
192 }
193 evas_common_draw_context_apply_free_cutouts(in);
194 return out;
195} 178}
196 179
197EAPI Cutout_Rect * 180int
198evas_common_draw_context_cutout_split(Cutout_Rect *in, Cutout_Rect *split) 181evas_common_draw_context_cutout_split(Cutout_Rects* res, int index, Cutout_Rect *split)
199{ 182{
200 /* 1 input rect, multiple out */ 183 /* 1 input rect, multiple out */
201 Cutout_Rect *out; 184 Cutout_Rect in = res->rects[index];
202 Cutout_Rect *r;
203 185
204 /* this is to save me a LOT of typing */ 186 /* this is to save me a LOT of typing */
205#define INX1 (in->x) 187#define INX1 (in.x)
206#define INX2 (in->x + in->w) 188#define INX2 (in.x + in.w)
207#define SPX1 (split->x) 189#define SPX1 (split->x)
208#define SPX2 (split->x + split->w) 190#define SPX2 (split->x + split->w)
209#define INY1 (in->y) 191#define INY1 (in.y)
210#define INY2 (in->y + in->h) 192#define INY2 (in.y + in.h)
211#define SPY1 (split->y) 193#define SPY1 (split->y)
212#define SPY2 (split->y + split->h) 194#define SPY2 (split->y + split->h)
213#define X1_IN (in->x < split->x) 195#define X1_IN (in.x < split->x)
214#define X2_IN ((in->x + in->w) > (split->x + split->w)) 196#define X2_IN ((in.x + in.w) > (split->x + split->w))
215#define Y1_IN (in->y < split->y) 197#define Y1_IN (in.y < split->y)
216#define Y2_IN ((in->y + in->h) > (split->y + split->h)) 198#define Y2_IN ((in.y + in.h) > (split->y + split->h))
217#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);} 199#define R_NEW(_r, _x, _y, _w, _h) { evas_common_draw_context_cutouts_add(_r, _x, _y, _w, _h); }
218 out = NULL; 200 if (!RECTS_INTERSECT(in.x, in.y, in.w, in.h,
219 if (!RECTS_INTERSECT(in->x, in->y, in->w, in->h,
220 split->x, split->y, split->w, split->h)) 201 split->x, split->y, split->w, split->h))
221 { 202 {
222 R_NEW(r, in->x, in->y, in->w, in->h); 203 /* No colision => no clipping, don't touch it. */
223 out = evas_object_list_append(out, r); 204 return 1;
224 return out;
225 } 205 }
226 206
227 /* S = split (ie cut out rect) */ 207 /* S = split (ie cut out rect) */
@@ -237,15 +217,13 @@ evas_common_draw_context_cutout_split(Cutout_Rect *in, Cutout_Rect *split)
237 */ 217 */
238 if (X1_IN && X2_IN && Y1_IN && Y2_IN) 218 if (X1_IN && X2_IN && Y1_IN && Y2_IN)
239 { 219 {
240 R_NEW(r, in->x, in->y, in->w, SPY1 - in->y); 220 R_NEW(res, in.x, in.y, in.w, SPY1 - in.y);
241 out = evas_object_list_append(out, r); 221 R_NEW(res, in.x, SPY1, SPX1 - in.x, SPY2 - SPY1);
242 R_NEW(r, in->x, SPY1, SPX1 - in->x, SPY2 - SPY1); 222 R_NEW(res, SPX2, SPY1, INX2 - SPX2, SPY2 - SPY1);
243 out = evas_object_list_append(out, r); 223 /* out => (in.x, SPY2, in.w, INY2 - SPY2) */
244 R_NEW(r, SPX2, SPY1, INX2 - SPX2, SPY2 - SPY1); 224 res->rects[index].h = INY2 - SPY2;
245 out = evas_object_list_append(out, r); 225 res->rects[index].y = SPY2;
246 R_NEW(r, in->x, SPY2, in->w, INY2 - SPY2); 226 return 1;
247 out = evas_object_list_append(out, r);
248 return out;
249 } 227 }
250 /* SSSSSSS 228 /* SSSSSSS
251 * S+---+S 229 * S+---+S
@@ -257,7 +235,8 @@ evas_common_draw_context_cutout_split(Cutout_Rect *in, Cutout_Rect *split)
257 */ 235 */
258 if (!X1_IN && !X2_IN && !Y1_IN && !Y2_IN) 236 if (!X1_IN && !X2_IN && !Y1_IN && !Y2_IN)
259 { 237 {
260 return NULL; 238 evas_common_draw_context_cutouts_del(res, index);
239 return 0;
261 } 240 }
262 /* SSS 241 /* SSS
263 * S+---+ 242 * S+---+
@@ -269,9 +248,10 @@ evas_common_draw_context_cutout_split(Cutout_Rect *in, Cutout_Rect *split)
269 */ 248 */
270 if (!X1_IN && X2_IN && !Y1_IN && !Y2_IN) 249 if (!X1_IN && X2_IN && !Y1_IN && !Y2_IN)
271 { 250 {
272 R_NEW(r, SPX2, in->y, INX2 - SPX2, in->h); 251 /* in => (SPX2, in.y, INX2 - SPX2, in.h) */
273 out = evas_object_list_append(out, r); 252 res->rects[index].w = INX2 - SPX2;
274 return out; 253 res->rects[index].x = SPX2;
254 return 1;
275 } 255 }
276 /* S 256 /* S
277 * +---+ 257 * +---+
@@ -283,11 +263,11 @@ evas_common_draw_context_cutout_split(Cutout_Rect *in, Cutout_Rect *split)
283 */ 263 */
284 if (X1_IN && X2_IN && !Y1_IN && !Y2_IN) 264 if (X1_IN && X2_IN && !Y1_IN && !Y2_IN)
285 { 265 {
286 R_NEW(r, in->x, in->y, SPX1 - in->x, in->h); 266 R_NEW(res, in.x, in.y, SPX1 - in.x, in.h);
287 out = evas_object_list_append(out, r); 267 /* in => (SPX2, in.y, INX2 - SPX2, in.h) */
288 R_NEW(r, SPX2, in->y, INX2 - SPX2, in->h); 268 res->rects[index].w = INX2 - SPX2;
289 out = evas_object_list_append(out, r); 269 res->rects[index].x = SPX2;
290 return out; 270 return 1;
291 } 271 }
292 /* SSS 272 /* SSS
293 * +---+S 273 * +---+S
@@ -299,9 +279,9 @@ evas_common_draw_context_cutout_split(Cutout_Rect *in, Cutout_Rect *split)
299 */ 279 */
300 if (X1_IN && !X2_IN && !Y1_IN && !Y2_IN) 280 if (X1_IN && !X2_IN && !Y1_IN && !Y2_IN)
301 { 281 {
302 R_NEW(r, in->x, in->y, SPX1 - in->x, in->h); 282 /* in => (in.x, in.y, SPX1 - in.x, in.h) */
303 out = evas_object_list_append(out, r); 283 res->rects[index].w = SPX1 - in.x;
304 return out; 284 return 1;
305 } 285 }
306 /* SSSSSSS 286 /* SSSSSSS
307 * S+---+S 287 * S+---+S
@@ -313,9 +293,10 @@ evas_common_draw_context_cutout_split(Cutout_Rect *in, Cutout_Rect *split)
313 */ 293 */
314 if (!X1_IN && !X2_IN && !Y1_IN && Y2_IN) 294 if (!X1_IN && !X2_IN && !Y1_IN && Y2_IN)
315 { 295 {
316 R_NEW(r, in->x, SPY2, in->w, INY2 - SPY2); 296 /* in => (in.x, SPY2, in.w, INY2 - SPY2) */
317 out = evas_object_list_append(out, r); 297 res->rects[index].h = INY2 - SPY2;
318 return out; 298 res->rects[index].y = SPY2;
299 return 1;
319 } 300 }
320 /* 301 /*
321 * +---+ 302 * +---+
@@ -327,11 +308,10 @@ evas_common_draw_context_cutout_split(Cutout_Rect *in, Cutout_Rect *split)
327 */ 308 */
328 if (!X1_IN && !X2_IN && Y1_IN && Y2_IN) 309 if (!X1_IN && !X2_IN && Y1_IN && Y2_IN)
329 { 310 {
330 R_NEW(r, in->x, in->y, in->w, SPY1 - in->y); 311 R_NEW(res, in.x, SPY2, in.w, INY2 - SPY2);
331 out = evas_object_list_append(out, r); 312 /* in => (in.x, in.y, in.w, SPY1 - in.y) */
332 R_NEW(r, in->x, SPY2, in->w, INY2 - SPY2); 313 res->rects[index].h = SPY1 - in.y;
333 out = evas_object_list_append(out, r); 314 return 1;
334 return out;
335 } 315 }
336 /* 316 /*
337 * +---+ 317 * +---+
@@ -343,9 +323,9 @@ evas_common_draw_context_cutout_split(Cutout_Rect *in, Cutout_Rect *split)
343 */ 323 */
344 if (!X1_IN && !X2_IN && Y1_IN && !Y2_IN) 324 if (!X1_IN && !X2_IN && Y1_IN && !Y2_IN)
345 { 325 {
346 R_NEW(r, in->x, in->y, in->w, SPY1 - in->y); 326 /* in => (in.x, in.y, in.w, SPY1 - in.y) */
347 out = evas_object_list_append(out, r); 327 res->rects[index].h = SPY1 - in.y;
348 return out; 328 return 1;
349 } 329 }
350 /* SSS 330 /* SSS
351 * S+---+ 331 * S+---+
@@ -357,11 +337,11 @@ evas_common_draw_context_cutout_split(Cutout_Rect *in, Cutout_Rect *split)
357 */ 337 */
358 if (!X1_IN && X2_IN && !Y1_IN && Y2_IN) 338 if (!X1_IN && X2_IN && !Y1_IN && Y2_IN)
359 { 339 {
360 R_NEW(r, SPX2, in->y, INX2 - SPX2, SPY2 - in->y); 340 R_NEW(res, SPX2, in.y, INX2 - SPX2, SPY2 - in.y);
361 out = evas_object_list_append(out, r); 341 /* in => (in.x, SPY2, in.w, INY2 - SPY2) */
362 R_NEW(r, in->x, SPY2, in->w, INY2 - SPY2); 342 res->rects[index].h = INY2 - SPY2;
363 out = evas_object_list_append(out, r); 343 res->rects[index].y = SPY2;
364 return out; 344 return 1;
365 } 345 }
366 /* S 346 /* S
367 * +---+ 347 * +---+
@@ -373,13 +353,12 @@ evas_common_draw_context_cutout_split(Cutout_Rect *in, Cutout_Rect *split)
373 */ 353 */
374 if (X1_IN && X2_IN && !Y1_IN && Y2_IN) 354 if (X1_IN && X2_IN && !Y1_IN && Y2_IN)
375 { 355 {
376 R_NEW(r, in->x, in->y, SPX1 - in->x, SPY2 - in->y); 356 R_NEW(res, in.x, in.y, SPX1 - in.x, SPY2 - in.y);
377 out = evas_object_list_append(out, r); 357 R_NEW(res, SPX2, in.y, INX2 - SPX2, SPY2 - in.y);
378 R_NEW(r, SPX2, in->y, INX2 - SPX2, SPY2 - in->y); 358 /* in => (in.x, SPY2, in.w, INY2 - SPY2) */
379 out = evas_object_list_append(out, r); 359 res->rects[index].h = INY2 - SPY2;
380 R_NEW(r, in->x, SPY2, in->w, INY2 - SPY2); 360 res->rects[index].y = SPY2;
381 out = evas_object_list_append(out, r); 361 return 1;
382 return out;
383 } 362 }
384 /* SSS 363 /* SSS
385 * +---+S 364 * +---+S
@@ -391,11 +370,11 @@ evas_common_draw_context_cutout_split(Cutout_Rect *in, Cutout_Rect *split)
391 */ 370 */
392 if (X1_IN && !X2_IN && !Y1_IN && Y2_IN) 371 if (X1_IN && !X2_IN && !Y1_IN && Y2_IN)
393 { 372 {
394 R_NEW(r, in->x, in->y, SPX1 - in->x, SPY2 - in->y); 373 R_NEW(res, in.x, in.y, SPX1 - in.x, SPY2 - in.y);
395 out = evas_object_list_append(out, r); 374 /* in => (in.x, SPY2, in.w, INY2 - SPY2) */
396 R_NEW(r, in->x, SPY2, in->w, INY2 - SPY2); 375 res->rects[index].h = INY2 - SPY2;
397 out = evas_object_list_append(out, r); 376 res->rects[index].y = SPY2;
398 return out; 377 return 1;
399 } 378 }
400 /* 379 /*
401 * +---+ 380 * +---+
@@ -407,13 +386,11 @@ evas_common_draw_context_cutout_split(Cutout_Rect *in, Cutout_Rect *split)
407 */ 386 */
408 if (!X1_IN && X2_IN && Y1_IN && Y2_IN) 387 if (!X1_IN && X2_IN && Y1_IN && Y2_IN)
409 { 388 {
410 R_NEW(r, in->x, in->y, in->w, SPY1 - in->y); 389 R_NEW(res, in.x, SPY2, in.w, INY2 - SPY2);
411 out = evas_object_list_append(out, r); 390 R_NEW(res, SPX2, SPY1, INX2 - SPX2, SPY2 - SPY1);
412 R_NEW(r, SPX2, SPY1, INX2 - SPX2, SPY2 - SPY1); 391 /* in => (in.x, SPY2, in.w, INY2 - SPY2) */
413 out = evas_object_list_append(out, r); 392 res->rects[index].h = SPY1 - in.y;
414 R_NEW(r, in->x, SPY2, in->w, INY2 - SPY2); 393 return 1;
415 out = evas_object_list_append(out, r);
416 return out;
417 } 394 }
418 /* 395 /*
419 * +---+ 396 * +---+
@@ -425,13 +402,11 @@ evas_common_draw_context_cutout_split(Cutout_Rect *in, Cutout_Rect *split)
425 */ 402 */
426 if (X1_IN && !X2_IN && Y1_IN && Y2_IN) 403 if (X1_IN && !X2_IN && Y1_IN && Y2_IN)
427 { 404 {
428 R_NEW(r, in->x, in->y, in->w, SPY1 - in->y); 405 R_NEW(res, in.x, SPY2, in.w, INY2 - SPY2);
429 out = evas_object_list_append(out, r); 406 R_NEW(res, in.x, SPY1, SPX1 - in.x, SPY2 - SPY1);
430 R_NEW(r, in->x, SPY1, SPX1 - in->x, SPY2 - SPY1); 407 /* in => (in.x, in.y, in.w, SPY1 - in.y) */
431 out = evas_object_list_append(out, r); 408 res->rects[index].h = SPY1 - in.y;
432 R_NEW(r, in->x, SPY2, in->w, INY2 - SPY2); 409 return 1;
433 out = evas_object_list_append(out, r);
434 return out;
435 } 410 }
436 /* 411 /*
437 * +---+ 412 * +---+
@@ -443,11 +418,10 @@ evas_common_draw_context_cutout_split(Cutout_Rect *in, Cutout_Rect *split)
443 */ 418 */
444 if (!X1_IN && X2_IN && Y1_IN && !Y2_IN) 419 if (!X1_IN && X2_IN && Y1_IN && !Y2_IN)
445 { 420 {
446 R_NEW(r, in->x, in->y, in->w, SPY1 - in->y); 421 R_NEW(res, SPX2, SPY1, INX2 - SPX2, INY2 - SPY1);
447 out = evas_object_list_append(out, r); 422 /* in => (in.x, in.y, in.w, SPY1 - in.y) */
448 R_NEW(r, SPX2, SPY1, INX2 - SPX2, INY2 - SPY1); 423 res->rects[index].h = SPY1 - in.y;
449 out = evas_object_list_append(out, r); 424 return 1;
450 return out;
451 } 425 }
452 /* 426 /*
453 * +---+ 427 * +---+
@@ -459,13 +433,11 @@ evas_common_draw_context_cutout_split(Cutout_Rect *in, Cutout_Rect *split)
459 */ 433 */
460 if (X1_IN && X2_IN && Y1_IN && !Y2_IN) 434 if (X1_IN && X2_IN && Y1_IN && !Y2_IN)
461 { 435 {
462 R_NEW(r, in->x, in->y, in->w, SPY1 - in->y); 436 R_NEW(res, in.x, SPY1, SPX1 - in.x, INY2 - SPY1);
463 out = evas_object_list_append(out, r); 437 R_NEW(res, SPX2, SPY1, INX2 - SPX2, INY2 - SPY1);
464 R_NEW(r, in->x, SPY1, SPX1 - in->x, INY2 - SPY1); 438 /* in => (in.x, in.y, in.w, SPY1 - in.y) */
465 out = evas_object_list_append(out, r); 439 res->rects[index].h = SPY1 - in.y;
466 R_NEW(r, SPX2, SPY1, INX2 - SPX2, INY2 - SPY1); 440 return 1;
467 out = evas_object_list_append(out, r);
468 return out;
469 } 441 }
470 /* 442 /*
471 * +---+ 443 * +---+
@@ -477,13 +449,13 @@ evas_common_draw_context_cutout_split(Cutout_Rect *in, Cutout_Rect *split)
477 */ 449 */
478 if (X1_IN && !X2_IN && Y1_IN && !Y2_IN) 450 if (X1_IN && !X2_IN && Y1_IN && !Y2_IN)
479 { 451 {
480 R_NEW(r, in->x, in->y, in->w, SPY1 - in->y); 452 R_NEW(res, in.x, SPY1, SPX1 - in.x, INY2 - SPY1);
481 out = evas_object_list_append(out, r); 453 /* in => (in.x, in.y, in.w, SPY1 - in.y) */
482 R_NEW(r, in->x, SPY1, SPX1 - in->x, INY2 - SPY1); 454 res->rects[index].h = SPY1 - in.y;
483 out = evas_object_list_append(out, r); 455 return 1;
484 return out;
485 } 456 }
486 return NULL; 457 evas_common_draw_context_cutouts_del(res, index);
458 return 0;
487#undef INX1 459#undef INX1
488#undef INX2 460#undef INX2
489#undef SPX1 461#undef SPX1
@@ -499,32 +471,49 @@ evas_common_draw_context_cutout_split(Cutout_Rect *in, Cutout_Rect *split)
499#undef R_NEW 471#undef R_NEW
500} 472}
501 473
502EAPI Cutout_Rect * 474EAPI Cutout_Rects*
503evas_common_draw_context_cutout_merge(Cutout_Rect *in, Cutout_Rect *merge) 475evas_common_draw_context_apply_cutouts(RGBA_Draw_Context *dc)
504{ 476{
505 /* 1 input rect, multiple out */ 477 Cutout_Rects* res;
506 Cutout_Rect *out; 478 int i;
507 Cutout_Rect *r; 479 int j;
508 Evas_Object_List *l;
509 480
510 for (l = (Evas_Object_List *)in; l; l = l->next) 481 if (!dc->clip.use) return NULL;
511 { 482 if ((dc->clip.w <= 0) || (dc->clip.h <= 0)) return NULL;
512 r = (Cutout_Rect *)l;
513 483
514 merge = evas_common_draw_context_cutouts_split(merge, r); 484 res = evas_common_draw_context_cutouts_new();
515 if (!merge) return in; 485 evas_common_draw_context_cutouts_add(res, dc->clip.x, dc->clip.y, dc->clip.w, dc->clip.h);
516 }
517 r = merge;
518 out = in;
519 while (r)
520 {
521 Cutout_Rect *r2;
522 486
523 r2 = r; 487 for (i = 0; i < dc->cutout.active; ++i)
524 r = evas_object_list_remove(r, r); 488 {
525 out = evas_object_list_append(out, r2); 489 /* Don't loop on the element just added to the list as they are already correctly clipped. */
490 int active = res->active;
491
492 for (j = 0; j < active; )
493 {
494 if (evas_common_draw_context_cutout_split(res, j, dc->cutout.rects + i))
495 ++j;
496 else
497 active--;
498 }
526 } 499 }
527 return out; 500 return res;
501}
502
503EAPI void
504evas_common_draw_context_apply_clear_cutouts(Cutout_Rects* rects)
505{
506 evas_common_draw_context_apply_clean_cutouts(rects);
507 free(rects);
508}
509
510EAPI void
511evas_common_draw_context_apply_clean_cutouts(Cutout_Rects* rects)
512{
513 free(rects->rects);
514 rects->rects = NULL;
515 rects->active = 0;
516 rects->max = 0;
528} 517}
529 518
530EAPI void 519EAPI void
diff --git a/legacy/evas/src/lib/engines/common/evas_pipe.c b/legacy/evas/src/lib/engines/common/evas_pipe.c
index a05a57ee4e..74735ae795 100644
--- a/legacy/evas/src/lib/engines/common/evas_pipe.c
+++ b/legacy/evas/src/lib/engines/common/evas_pipe.c
@@ -38,27 +38,16 @@ static void
38evas_common_pipe_draw_context_copy(RGBA_Draw_Context *dc, RGBA_Pipe_Op *op) 38evas_common_pipe_draw_context_copy(RGBA_Draw_Context *dc, RGBA_Pipe_Op *op)
39{ 39{
40 Cutout_Rect *r, *r2; 40 Cutout_Rect *r, *r2;
41 41
42 memcpy(&(op->context), dc, sizeof(RGBA_Draw_Context)); 42 memcpy(&(op->context), dc, sizeof(RGBA_Draw_Context));
43 op->context.cutout.rects = NULL; 43 op->context.cutout.rects = malloc(sizeof(Cutout_Rect) * op->context.cutout.active);
44 for (r = dc->cutout.rects; r; r = (Cutout_Rect *)((Evas_Object_List *)r)->next) 44 memcpy(op->context.cutout.rects, dc->cutout.rects, sizeof(Cutout_Rect) * op->context.cutout.active);
45 {
46 r2 = calloc(1, sizeof(Cutout_Rect));
47 if (r2)
48 {
49 r2->x = r->x;
50 r2->y = r->y;
51 r2->w = r->w;
52 r2->h = r->h;
53 op->context.cutout.rects = evas_object_list_append(op->context.cutout.rects, r2);
54 }
55 }
56} 45}
57 46
58static void 47static void
59evas_common_pipe_op_free(RGBA_Pipe_Op *op) 48evas_common_pipe_op_free(RGBA_Pipe_Op *op)
60{ 49{
61 evas_common_draw_context_apply_free_cutouts(op->context.cutout.rects); 50 evas_common_draw_context_apply_clean_cutouts(&op->context.cutout);
62} 51}
63 52
64/* main api calls */ 53/* main api calls */
diff --git a/legacy/evas/src/lib/engines/common/evas_rectangle_main.c b/legacy/evas/src/lib/engines/common/evas_rectangle_main.c
index f9fae5ad73..17c5f878f3 100644
--- a/legacy/evas/src/lib/engines/common/evas_rectangle_main.c
+++ b/legacy/evas/src/lib/engines/common/evas_rectangle_main.c
@@ -10,9 +10,10 @@ evas_common_rectangle_init(void)
10EAPI void 10EAPI void
11evas_common_rectangle_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, int w, int h) 11evas_common_rectangle_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, int w, int h)
12{ 12{
13 int c, cx, cy, cw, ch; 13 Cutout_Rects *rects;
14 Cutout_Rect *rects, *r; 14 Cutout_Rect *r;
15 Evas_Object_List *l; 15 int c, cx, cy, cw, ch;
16 int i;
16 /* handle cutouts here! */ 17 /* handle cutouts here! */
17 18
18 if ((w <= 0) || (h <= 0)) return; 19 if ((w <= 0) || (h <= 0)) return;
@@ -35,13 +36,13 @@ evas_common_rectangle_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y,
35 return; 36 return;
36 } 37 }
37 rects = evas_common_draw_context_apply_cutouts(dc); 38 rects = evas_common_draw_context_apply_cutouts(dc);
38 for (l = (Evas_Object_List *)rects; l; l = l->next) 39 for (i = 0; i < rects->active; ++i)
39 { 40 {
40 r = (Cutout_Rect *)l; 41 r = rects->rects + i;
41 evas_common_draw_context_set_clip(dc, r->x, r->y, r->w, r->h); 42 evas_common_draw_context_set_clip(dc, r->x, r->y, r->w, r->h);
42 rectangle_draw_internal(dst, dc, x, y, w, h); 43 rectangle_draw_internal(dst, dc, x, y, w, h);
43 } 44 }
44 evas_common_draw_context_apply_free_cutouts(rects); 45 evas_common_draw_context_apply_clear_cutouts(rects);
45 /* restore clip info */ 46 /* restore clip info */
46 dc->clip.use = c; dc->clip.x = cx; dc->clip.y = cy; dc->clip.w = cw; dc->clip.h = ch; 47 dc->clip.use = c; dc->clip.x = cx; dc->clip.y = cy; dc->clip.w = cw; dc->clip.h = ch;
47} 48}
diff --git a/legacy/evas/src/lib/engines/common/evas_scale_sample.c b/legacy/evas/src/lib/engines/common/evas_scale_sample.c
index 54d255f31c..c8aef859a6 100644
--- a/legacy/evas/src/lib/engines/common/evas_scale_sample.c
+++ b/legacy/evas/src/lib/engines/common/evas_scale_sample.c
@@ -30,9 +30,10 @@ evas_common_scale_rgba_in_to_out_clip_sample(RGBA_Image *src, RGBA_Image *dst,
30 int dst_region_x, int dst_region_y, 30 int dst_region_x, int dst_region_y,
31 int dst_region_w, int dst_region_h) 31 int dst_region_w, int dst_region_h)
32{ 32{
33 int c, cx, cy, cw, ch; 33 Cutout_Rects *rects;
34 Cutout_Rect *rects, *r; 34 Cutout_Rect *r;
35 Evas_Object_List *l; 35 int c, cx, cy, cw, ch;
36 int i;
36 /* handle cutouts here! */ 37 /* handle cutouts here! */
37 38
38 if ((dst_region_w <= 0) || (dst_region_h <= 0)) return; 39 if ((dst_region_w <= 0) || (dst_region_h <= 0)) return;
@@ -59,9 +60,9 @@ evas_common_scale_rgba_in_to_out_clip_sample(RGBA_Image *src, RGBA_Image *dst,
59 return; 60 return;
60 } 61 }
61 rects = evas_common_draw_context_apply_cutouts(dc); 62 rects = evas_common_draw_context_apply_cutouts(dc);
62 for (l = (Evas_Object_List *)rects; l; l = l->next) 63 for (i = 0; i < rects->active; ++i)
63 { 64 {
64 r = (Cutout_Rect *)l; 65 r = rects->rects + i;
65 evas_common_draw_context_set_clip(dc, r->x, r->y, r->w, r->h); 66 evas_common_draw_context_set_clip(dc, r->x, r->y, r->w, r->h);
66 scale_rgba_in_to_out_clip_sample_internal(src, dst, dc, 67 scale_rgba_in_to_out_clip_sample_internal(src, dst, dc,
67 src_region_x, src_region_y, 68 src_region_x, src_region_y,
@@ -70,7 +71,7 @@ evas_common_scale_rgba_in_to_out_clip_sample(RGBA_Image *src, RGBA_Image *dst,
70 dst_region_w, dst_region_h); 71 dst_region_w, dst_region_h);
71 72
72 } 73 }
73 evas_common_draw_context_apply_free_cutouts(rects); 74 evas_common_draw_context_apply_clear_cutouts(rects);
74 /* restore clip info */ 75 /* restore clip info */
75 dc->clip.use = c; dc->clip.x = cx; dc->clip.y = cy; dc->clip.w = cw; dc->clip.h = ch; 76 dc->clip.use = c; dc->clip.x = cx; dc->clip.y = cy; dc->clip.w = cw; dc->clip.h = ch;
76} 77}
diff --git a/legacy/evas/src/lib/engines/common/evas_scale_smooth.c b/legacy/evas/src/lib/engines/common/evas_scale_smooth.c
index 67bef6e5dd..4244b05eae 100644
--- a/legacy/evas/src/lib/engines/common/evas_scale_smooth.c
+++ b/legacy/evas/src/lib/engines/common/evas_scale_smooth.c
@@ -447,9 +447,10 @@ evas_common_scale_rgba_in_to_out_clip_smooth(RGBA_Image *src, RGBA_Image *dst,
447# ifdef BUILD_MMX 447# ifdef BUILD_MMX
448 int mmx, sse, sse2; 448 int mmx, sse, sse2;
449# endif 449# endif
450 int c, cx, cy, cw, ch; 450 Cutout_Rects *rects;
451 Cutout_Rect *rects, *r; 451 Cutout_Rect *r;
452 Evas_Object_List *l; 452 int c, cx, cy, cw, ch;
453 int i;
453 /* handle cutouts here! */ 454 /* handle cutouts here! */
454 455
455 if ((dst_region_w <= 0) || (dst_region_h <= 0)) return; 456 if ((dst_region_w <= 0) || (dst_region_h <= 0)) return;
@@ -490,9 +491,9 @@ evas_common_scale_rgba_in_to_out_clip_smooth(RGBA_Image *src, RGBA_Image *dst,
490 return; 491 return;
491 } 492 }
492 rects = evas_common_draw_context_apply_cutouts(dc); 493 rects = evas_common_draw_context_apply_cutouts(dc);
493 for (l = (Evas_Object_List *)rects; l; l = l->next) 494 for (i = 0; i < rects->active; ++i)
494 { 495 {
495 r = (Cutout_Rect *)l; 496 r = rects->rects + i;
496 evas_common_draw_context_set_clip(dc, r->x, r->y, r->w, r->h); 497 evas_common_draw_context_set_clip(dc, r->x, r->y, r->w, r->h);
497# ifdef BUILD_MMX 498# ifdef BUILD_MMX
498 if (mmx) 499 if (mmx)
@@ -511,7 +512,7 @@ evas_common_scale_rgba_in_to_out_clip_smooth(RGBA_Image *src, RGBA_Image *dst,
511 dst_region_w, dst_region_h); 512 dst_region_w, dst_region_h);
512# endif 513# endif
513 } 514 }
514 evas_common_draw_context_apply_free_cutouts(rects); 515 evas_common_draw_context_apply_clear_cutouts(rects);
515 /* restore clip info */ 516 /* restore clip info */
516 dc->clip.use = c; dc->clip.x = cx; dc->clip.y = cy; dc->clip.w = cw; dc->clip.h = ch; 517 dc->clip.use = c; dc->clip.x = cx; dc->clip.y = cy; dc->clip.w = cw; dc->clip.h = ch;
517} 518}
diff --git a/legacy/evas/src/lib/include/evas_common.h b/legacy/evas/src/lib/include/evas_common.h
index 3321145c18..f00fdcbfc9 100644
--- a/legacy/evas/src/lib/include/evas_common.h
+++ b/legacy/evas/src/lib/include/evas_common.h
@@ -140,6 +140,7 @@ typedef struct _RGBA_Font_Glyph RGBA_Font_Glyph;
140typedef struct _RGBA_Gfx_Compositor RGBA_Gfx_Compositor; 140typedef struct _RGBA_Gfx_Compositor RGBA_Gfx_Compositor;
141 141
142typedef struct _Cutout_Rect Cutout_Rect; 142typedef struct _Cutout_Rect Cutout_Rect;
143typedef struct _Cutout_Rects Cutout_Rects;
143 144
144typedef struct _Convert_Pal Convert_Pal; 145typedef struct _Convert_Pal Convert_Pal;
145 146
@@ -235,6 +236,18 @@ struct _Evas_Hash_El
235 void *data; 236 void *data;
236}; 237};
237 238
239struct _Cutout_Rect
240{
241 int x, y, w, h;
242};
243
244struct _Cutout_Rects
245{
246 Cutout_Rect* rects;
247 int active;
248 int max;
249};
250
238struct _RGBA_Draw_Context 251struct _RGBA_Draw_Context
239{ 252{
240 struct { 253 struct {
@@ -248,9 +261,7 @@ struct _RGBA_Draw_Context
248 char use : 1; 261 char use : 1;
249 int x, y, w, h; 262 int x, y, w, h;
250 } clip; 263 } clip;
251 struct { 264 Cutout_Rects cutout;
252 Cutout_Rect *rects;
253 } cutout;
254 struct { 265 struct {
255 struct { 266 struct {
256 void *(*gl_new) (void *data, RGBA_Font_Glyph *fg); 267 void *(*gl_new) (void *data, RGBA_Font_Glyph *fg);
@@ -572,11 +583,6 @@ struct _Regionspan
572 int x1, x2; 583 int x1, x2;
573}; 584};
574*/ 585*/
575struct _Cutout_Rect
576{
577 Evas_Object_List _list_data;
578 int x, y, w, h;
579};
580 586
581struct _Convert_Pal 587struct _Convert_Pal
582{ 588{
@@ -1012,11 +1018,9 @@ EAPI void evas_common_draw_context_set_multiplier (RGBA_Draw_Co
1012EAPI void evas_common_draw_context_unset_multiplier (RGBA_Draw_Context *dc); 1018EAPI void evas_common_draw_context_unset_multiplier (RGBA_Draw_Context *dc);
1013EAPI void evas_common_draw_context_add_cutout (RGBA_Draw_Context *dc, int x, int y, int w, int h); 1019EAPI void evas_common_draw_context_add_cutout (RGBA_Draw_Context *dc, int x, int y, int w, int h);
1014EAPI void evas_common_draw_context_clear_cutouts (RGBA_Draw_Context *dc); 1020EAPI void evas_common_draw_context_clear_cutouts (RGBA_Draw_Context *dc);
1015EAPI Cutout_Rect *evas_common_draw_context_apply_cutouts (RGBA_Draw_Context *dc); 1021EAPI Cutout_Rects *evas_common_draw_context_apply_cutouts (RGBA_Draw_Context *dc);
1016EAPI void evas_common_draw_context_apply_free_cutouts(Cutout_Rect *rects); 1022EAPI void evas_common_draw_context_apply_clear_cutouts(Cutout_Rects* rects);
1017EAPI Cutout_Rect *evas_common_draw_context_cutouts_split (Cutout_Rect *in, Cutout_Rect *split); 1023EAPI void evas_common_draw_context_apply_clean_cutouts(Cutout_Rects* rects);
1018EAPI Cutout_Rect *evas_common_draw_context_cutout_split (Cutout_Rect *in, Cutout_Rect *split);
1019EAPI Cutout_Rect *evas_common_draw_context_cutout_merge (Cutout_Rect *in, Cutout_Rect *merge);
1020EAPI void evas_common_draw_context_set_anti_alias (RGBA_Draw_Context *dc, unsigned char aa); 1024EAPI void evas_common_draw_context_set_anti_alias (RGBA_Draw_Context *dc, unsigned char aa);
1021EAPI void evas_common_draw_context_set_color_interpolation(RGBA_Draw_Context *dc, int color_space); 1025EAPI void evas_common_draw_context_set_color_interpolation(RGBA_Draw_Context *dc, int color_space);
1022EAPI void evas_common_draw_context_set_render_op (RGBA_Draw_Context *dc, int op); 1026EAPI void evas_common_draw_context_set_render_op (RGBA_Draw_Context *dc, int op);