Evas render: Fix another bad proxy clipping issue
authorJean-Philippe Andre <jp.andre@samsung.com>
Tue, 6 Oct 2015 08:36:29 +0000 (17:36 +0900)
committerJean-Philippe Andre <jp.andre@samsung.com>
Wed, 7 Oct 2015 01:48:18 +0000 (10:48 +0900)
This is an ugly hack to fix an issue reported in D3114. I don't
understand how the proposed patch could even fix anything given
the current situation.

Test case:
 - Create edje object with textblock inside
 - Clip out edje object (--> all children become not visible)
 - Take textblock from edje and set it as source of a proxy
 - Mark proxy as source_clip

Result: Nothing visible.

Expected: Proxy should contain the textblock object, since
  source_clip means we ignore the edje object's clipper, and
  only care about the textblock's clipper (entire canvas).

Here's what was happening:
 - During a first pass, textblock is not visible, cur->cache.clip
   is calculated, marked as clip_use=1 with geom 0,0 0x0
 - In a second pass, the proxy is rendered, which needs to draw
   the textblock in a surface. But cache.clip was used and it was
   wrong.

Solution:
 - Ignore cache.clip when rendering inside a proxy. I'm pretty
   sure there are other instances where cache.clip will still
   be a problem.

Problem: textblock never called relayout since it was not
  visible.

Conclusion: cache.clip needs to die. It's a legacy optimization
  that now causes more issues than it fixes.

src/lib/evas/canvas/evas_render.c

index 3fe93a0..a47e550 100644 (file)
@@ -1234,7 +1234,7 @@ _evas_render_mapped_context_clip_set(Evas_Public_Data *evas, Evas_Object *eo_obj
 
    if (proxy_render_data) proxy_src_clip = proxy_render_data->source_clip;
 
-   if (proxy_src_clip)
+   if (proxy_src_clip && !evas->is_frozen)
      {
         x = obj->cur->cache.clip.x;
         y = obj->cur->cache.clip.y;
@@ -1249,6 +1249,10 @@ _evas_render_mapped_context_clip_set(Evas_Public_Data *evas, Evas_Object *eo_obj
 
         ENFN->context_clip_set(ENDT, ctx, x + off_x, y + off_y, w, h);
      }
+   else if (evas->is_frozen)
+     {
+        /* can't trust cache.clip here - clip should be in ctx already */
+     }
    else
      {
         //FIXME: Consider to clip by the proxy clipper.
@@ -1336,14 +1340,31 @@ evas_render_mapped(Evas_Public_Data *evas, Evas_Object *eo_obj,
           }
         else if (proxy_src_clip)
           {
-             if ((!evas_object_is_visible(eo_obj, obj)) || (obj->clip.clipees)
-                 || (obj->cur->have_clipees) || (obj->no_render))
+             if (!evas->is_frozen) /* same as "if (proxy_render_data)" */
                {
-                  IFRD(obj->no_render, level, "  proxy_src_clip + no_render\n");
-                  IFRD(obj->clip.clipees || obj->cur->have_clipees, level, "  proxy_src_clip + has clippees\n");
-                  IFRD(!evas_object_is_visible(eo_obj, obj), level, "  not visible\n");
-                  RD(level, "}\n");
-                  return clean_them;
+                  if ((!evas_object_is_visible(eo_obj, obj)) || (obj->clip.clipees)
+                      || (obj->cur->have_clipees) || (obj->no_render))
+                    {
+                       IFRD(obj->no_render, level, "  no_render\n");
+                       IFRD(obj->clip.clipees || obj->cur->have_clipees, level, "  has clippees\n");
+                       IFRD(!evas_object_is_visible(eo_obj, obj), level, "  not visible\n");
+                       RD(level, "}\n");
+                       return clean_them;
+                    }
+               }
+             else
+               {
+                  /* can not trust cache.clip - evas is frozen */
+                  if (!obj->cur->visible || obj->clip.clipees || obj->no_render ||
+                      (!obj->cur->color.a && (obj->cur->render_op == EVAS_RENDER_BLEND)))
+                    {
+                       IFRD(obj->no_render, level, "  proxy_src_clip + no_render\n");
+                       IFRD(obj->clip.clipees || obj->cur->have_clipees, level, "  proxy_src_clip + has clippees\n");
+                       IFRD(!obj->cur->visible, level, "  proxy_src_clip + not visible\n");
+                       IFRD(!obj->cur->color.a && (obj->cur->render_op == EVAS_RENDER_BLEND), level, "  proxy_src_clip + 0 alpha\n");
+                       RD(level, "}\n");
+                       return clean_them;
+                    }
                }
           }
         else if (!evas_object_is_proxy_visible(eo_obj, obj) ||