now that mostly fixes this map clip issue... ugh. took a while to come up
authorraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 1 Sep 2010 21:37:10 +0000 (21:37 +0000)
committerraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 1 Sep 2010 21:37:10 +0000 (21:37 +0000)
with an elegant solution. also it does add overhead to fix. i might be
able to improve the overhead.

git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@51823 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/canvas/evas_clip.c
src/lib/canvas/evas_object_smart.c
src/lib/include/evas_inline.x
src/lib/include/evas_private.h

index 1de20bc..2bfa70f 100644 (file)
@@ -70,42 +70,64 @@ evas_object_clippers_was_visible(Evas_Object *obj)
  * 
  */
 
+#define MAP_ACROSS 1
 static void
-evas_object_child_map_across_mark(Evas_Object *obj, Eina_List *clippers, 
-                                  Eina_Bool map)
+evas_object_child_map_across_mark(Evas_Object *obj, Evas_Object *map_obj, Eina_Bool force)
 {
-#if 0
-   if (map)
-     {
-        // if obj->cur.clipper is in clippers list, then set 
-        // obj->cur.clip_across_map to 1
-     }
-   else
+#ifdef MAP_ACROSS
+   if ((obj->cur.map_parent != map_obj) || force)
      {
+        obj->cur.map_parent = map_obj;
+        obj->cur.cache.clip.dirty = 1;
+        evas_object_clip_recalc(obj);
+        if (obj->smart.smart)
+          {
+             Evas_Object *obj2;
+             
+             EINA_INLIST_FOREACH(evas_object_smart_members_get_direct(obj), obj2)
+               {
+                  // if obj has its own map - skip it. already done
+                  if ((obj2->cur.map) && (obj2->cur.usemap)) continue;
+                  evas_object_child_map_across_mark(obj2, map_obj, force);
+               }
+          }
      }
 #endif   
 }
 
+static void
+evas_object_clip_across_check(Evas_Object *obj)
+{
+   if (!obj->cur.clipper) return;
+   if (obj->cur.clipper->cur.map_parent != obj->cur.map_parent)
+      evas_object_child_map_across_mark(obj, obj->cur.map_parent, 1);
+}
+
+// this function is called on an object when map is enabled or disabled on it
+// thus creating a "map boundary" at that point.
+// 
+// FIXME: smart member add/del and clip set/unset needs to check the new
+// smart parent (if any)
 void
 evas_object_mapped_clip_across_mark(Evas_Object *obj)
 {
-   return;
-#if 0
+#ifdef MAP_ACROSS
    Eina_Bool map = 0;
    
    if ((obj->cur.map) && (obj->cur.usemap)) map = 1;
+   
    if (map)
      {
-        Eina_List *list = NULL;
-        
-        // FIXME: list = build list of all clippers that are children of obj
-        // up until any obj that has map applied to it. if map is applied
-        // tghen we must assume this has been run before o9n that obj and
-        // its children etc.
-        evas_object_child_map_across_mark(obj, list, map);
+        evas_object_child_map_across_mark(obj, obj, 0);
      }
    else
-      evas_object_child_map_across_mark(obj, NULL, map);
+     {
+        if (obj->smart.parent)
+           evas_object_child_map_across_mark
+           (obj, obj->smart.parent->cur.map_parent, 0);
+        else
+           evas_object_child_map_across_mark(obj, NULL, 0); 
+    }
 #endif   
 }
 
@@ -231,6 +253,7 @@ evas_object_clip_set(Evas_Object *obj, Evas_Object *clip)
                                     obj->layer->evas->last_timestamp,
                                     NULL);
      }
+   evas_object_clip_across_check(obj);
 }
 
 /**
@@ -332,6 +355,7 @@ evas_object_clip_unset(Evas_Object *obj)
                                      obj->layer->evas->last_timestamp,
                                     NULL);
      }
+   evas_object_clip_across_check(obj);
 }
 
 /**
index 55000aa..b0f24f9 100644 (file)
@@ -201,6 +201,7 @@ evas_object_smart_member_add(Evas_Object *obj, Evas_Object *smart_obj)
    evas_object_smart_member_cache_invalidate(obj);
    obj->restack = 1;
    evas_object_change(obj);
+   evas_object_mapped_clip_across_mark(obj);
    if (smart_obj->smart.smart->smart_class->member_add)
      smart_obj->smart.smart->smart_class->member_add(smart_obj, obj);
 }
@@ -241,6 +242,7 @@ evas_object_smart_member_del(Evas_Object *obj)
    evas_object_inject(obj, obj->layer->evas);
    obj->restack = 1;
    evas_object_change(obj);
+   evas_object_mapped_clip_across_mark(obj);
 }
 
 /**
index 5db783a..18b8e88 100644 (file)
@@ -175,9 +175,8 @@ evas_object_clip_recalc(Evas_Object *obj)
    int cx, cy, cw, ch, cvis, cr, cg, cb, ca;
    int nx, ny, nw, nh, nvis, nr, ng, nb, na;
 
-   if ((!obj->cur.cache.clip.dirty &&
-        !(!obj->cur.clipper || obj->cur.clipper->cur.cache.clip.dirty)) ||
-       (obj->cur.clip_across_map))
+   if ((!obj->cur.cache.clip.dirty) &&
+       !(!obj->cur.clipper || obj->cur.clipper->cur.cache.clip.dirty))
      return;
    if (obj->layer->evas->events_frozen > 0) return;
    evas_object_coords_recalc(obj);
@@ -201,7 +200,8 @@ evas_object_clip_recalc(Evas_Object *obj)
    else cvis = obj->cur.visible;
    cr = obj->cur.color.r; cg = obj->cur.color.g;
    cb = obj->cur.color.b; ca = obj->cur.color.a;
-   if ((obj->cur.clipper) && (!obj->cur.clip_across_map))
+   if ((obj->cur.clipper) &&
+       (obj->cur.clipper->cur.map_parent == obj->cur.map_parent))
      {
 // this causes problems... hmmm
        if (obj->cur.clipper->cur.cache.clip.dirty)
index ae2a667..08b532b 100644 (file)
@@ -430,12 +430,12 @@ struct _Evas_Object
         unsigned char  r, g, b, a;
       } color;
       Evas_Object      *clipper;
+      Evas_Object      *map_parent;
       short             layer;
       Eina_Bool         usemap : 1;
       Eina_Bool         visible : 1;
       Eina_Bool         have_clipees : 1;
       Eina_Bool         anti_alias : 1;
-      Eina_Bool         clip_across_map : 1;
       Evas_Render_Op    render_op : 4;
    } cur, prev;