aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/evas/src/lib/engines/common/evas_draw_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/evas/src/lib/engines/common/evas_draw_main.c')
-rw-r--r--libraries/evas/src/lib/engines/common/evas_draw_main.c65
1 files changed, 64 insertions, 1 deletions
diff --git a/libraries/evas/src/lib/engines/common/evas_draw_main.c b/libraries/evas/src/lib/engines/common/evas_draw_main.c
index def19a8..d08e788 100644
--- a/libraries/evas/src/lib/engines/common/evas_draw_main.c
+++ b/libraries/evas/src/lib/engines/common/evas_draw_main.c
@@ -559,7 +559,7 @@ evas_common_draw_context_cutout_split(Cutout_Rects* res, int idx, Cutout_Rect *s
559EAPI Cutout_Rects* 559EAPI Cutout_Rects*
560evas_common_draw_context_apply_cutouts(RGBA_Draw_Context *dc) 560evas_common_draw_context_apply_cutouts(RGBA_Draw_Context *dc)
561{ 561{
562 Cutout_Rects* res; 562 Cutout_Rects* res, *res2;
563 int i; 563 int i;
564 int j; 564 int j;
565 565
@@ -583,6 +583,69 @@ evas_common_draw_context_apply_cutouts(RGBA_Draw_Context *dc)
583 active--; 583 active--;
584 } 584 }
585 } 585 }
586 /* merge rects */
587#define RI res->rects[i]
588#define RJ res->rects[j]
589 if (res->active > 1)
590 {
591 int found = 1;
592
593 while (found)
594 {
595 found = 0;
596 for (i = 0; i < res->active; i++)
597 {
598 for (j = i + 1; j < res->active; j++)
599 {
600 /* skip empty rects we are removing */
601 if (RJ.w == 0) continue;
602 /* check if its same width, immediately above or below */
603 if ((RJ.w == RI.w) && (RJ.x == RI.x))
604 {
605 if ((RJ.y + RJ.h) == RI.y) /* above */
606 {
607 RI.y = RJ.y;
608 RI.h += RJ.h;
609 RJ.w = 0;
610 found = 1;
611 }
612 else if ((RI.y + RI.h) == RJ.y) /* below */
613 {
614 RI.h += RJ.h;
615 RJ.w = 0;
616 found = 1;
617 }
618 }
619 /* check if its same height, immediately left or right */
620 else if ((RJ.h == RI.h) && (RJ.y == RI.y))
621 {
622 if ((RJ.x + RJ.w) == RI.x) /* left */
623 {
624 RI.x = RJ.x;
625 RI.w += RJ.w;
626 RJ.w = 0;
627 found = 1;
628 }
629 else if ((RI.x + RI.w) == RJ.x) /* right */
630 {
631 RI.w += RJ.w;
632 RJ.w = 0;
633 found = 1;
634 }
635 }
636 }
637 }
638 }
639 res2 = evas_common_draw_context_cutouts_new();
640 for (i = 0; i < res->active; i++)
641 {
642 if (RI.w == 0) continue;
643 evas_common_draw_context_cutouts_add(res2, RI.x, RI.y, RI.w, RI.h);
644 }
645 free(res->rects);
646 free(res);
647 return res2;
648 }
586 return res; 649 return res;
587} 650}
588 651