fix regression during 1.1 dev (towards 1.2) that made evas over-render
authorraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 21 Feb 2012 07:01:39 +0000 (07:01 +0000)
committerraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 21 Feb 2012 07:01:39 +0000 (07:01 +0000)
way too much! FIXED

git-svn-id: http://svn.enlightenment.org/svn/e/trunk/evas@68204 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/canvas/evas_render.c
src/lib/engines/common/evas_draw_main.c

index cdedaec..e56c807 100644 (file)
@@ -1500,6 +1500,12 @@ evas_render_updates_internal(Evas *e,
              off_x = cx - ux;
              off_y = cy - uy;
              /* build obscuring objects list (in order from bottom to top) */
+             if (alpha)
+               {
+                  e->engine.func->context_clip_set(e->engine.data.output,
+                                                   e->engine.data.context,
+                                                   ux + off_x, uy + off_y, uw, uh);
+               }
              for (i = 0; i < e->obscuring_objects.count; ++i)
                {
                   obj = (Evas_Object *)eina_array_data_get
@@ -1515,9 +1521,6 @@ evas_render_updates_internal(Evas *e,
                }
              if (alpha)
                {
-                  e->engine.func->context_clip_set(e->engine.data.output,
-                                                   e->engine.data.context,
-                                                   ux + off_x, uy + off_y, uw, uh);
                   e->engine.func->context_color_set(e->engine.data.output,
                                                     e->engine.data.context,
                                                     0, 0, 0, 0);
@@ -1548,7 +1551,7 @@ evas_render_updates_internal(Evas *e,
                       (obj->cur.visible) &&
                       (!obj->delete_me) &&
                       (obj->cur.cache.clip.visible) &&
-                      //                     (!obj->smart.smart) &&
+//                   (!obj->smart.smart) &&
                       ((obj->cur.color.a > 0 || obj->cur.render_op != EVAS_RENDER_BLEND)))
                     {
                        int x, y, w, h;
@@ -1579,6 +1582,9 @@ evas_render_updates_internal(Evas *e,
                             else
                               e->engine.func->context_mask_unset(e->engine.data.output,
                                                                  e->engine.data.context);
+                            e->engine.func->context_clip_set(e->engine.data.output,
+                                                             e->engine.data.context,
+                                                             x, y, w, h);
 #if 1 /* FIXME: this can slow things down... figure out optimum... coverage */
                             for (j = offset; j < e->temporary_objects.count; ++j)
                               {
@@ -1589,9 +1595,6 @@ evas_render_updates_internal(Evas *e,
                                  _evas_render_cutout_add(e, obj2, off_x, off_y);
                               }
 #endif
-                            e->engine.func->context_clip_set(e->engine.data.output,
-                                                             e->engine.data.context,
-                                                             x, y, w, h);
                             clean_them |= evas_render_mapped(e, obj, e->engine.data.context,
                                                              surface, off_x, off_y, 0,
                                                              cx, cy, cw, ch
index def19a8..d08e788 100644 (file)
@@ -559,7 +559,7 @@ evas_common_draw_context_cutout_split(Cutout_Rects* res, int idx, Cutout_Rect *s
 EAPI Cutout_Rects*
 evas_common_draw_context_apply_cutouts(RGBA_Draw_Context *dc)
 {
-   Cutout_Rects*        res;
+   Cutout_Rects*        res, *res2;
    int                  i;
    int                  j;
 
@@ -583,6 +583,69 @@ evas_common_draw_context_apply_cutouts(RGBA_Draw_Context *dc)
                active--;
           }
      }
+   /* merge rects */
+#define RI res->rects[i]
+#define RJ res->rects[j]
+   if (res->active > 1)
+     {
+        int found = 1;
+        
+        while (found)
+          {
+             found = 0;
+             for (i = 0; i < res->active; i++)
+               {
+                  for (j = i + 1; j < res->active; j++)
+                    {
+                       /* skip empty rects we are removing */
+                       if (RJ.w == 0) continue;
+                       /* check if its same width, immediately above or below */
+                       if ((RJ.w == RI.w) && (RJ.x == RI.x))
+                         {
+                            if ((RJ.y + RJ.h) == RI.y) /* above */
+                              {
+                                 RI.y = RJ.y;
+                                 RI.h += RJ.h;
+                                 RJ.w = 0;
+                                 found = 1;
+                              }
+                            else if ((RI.y + RI.h) == RJ.y) /* below */
+                              {
+                                 RI.h += RJ.h;
+                                 RJ.w = 0;
+                                 found = 1;
+                              }
+                         }
+                       /* check if its same height, immediately left or right */
+                       else if ((RJ.h == RI.h) && (RJ.y == RI.y))
+                         {
+                            if ((RJ.x + RJ.w) == RI.x) /* left */
+                              {
+                                 RI.x = RJ.x;
+                                 RI.w += RJ.w;
+                                 RJ.w = 0;
+                                 found = 1;
+                              }
+                            else if ((RI.x + RI.w) == RJ.x) /* right */
+                              {
+                                 RI.w += RJ.w;
+                                 RJ.w = 0;
+                                 found = 1;
+                              }
+                         }
+                    }
+               }
+          }
+        res2 = evas_common_draw_context_cutouts_new();
+        for (i = 0; i < res->active; i++)
+          {
+             if (RI.w == 0) continue;
+             evas_common_draw_context_cutouts_add(res2, RI.x, RI.y, RI.w, RI.h);
+          }
+        free(res->rects);
+        free(res);
+        return res2;
+     }
    return res;
 }