evas/wayland: Remove framespace clipper.
authorRafael Antognolli <rafael.antognolli@intel.com>
Mon, 22 Apr 2013 19:29:50 +0000 (16:29 -0300)
committerRafael Antognolli <rafael.antognolli@intel.com>
Tue, 23 Apr 2013 21:52:35 +0000 (18:52 -0300)
This clipper caused several bugs already, and there are some bugs still
not fixed. Let's remove it and try to fix any remaining with some other
kind of solution that does not depend on adding or clipping objects
during the evas render phase, which causes unexpected behavior.

src/lib/evas/canvas/evas_main.c
src/lib/evas/canvas/evas_render.c
src/lib/evas/include/evas_private.h

index 79babed..beebbb3 100644 (file)
@@ -164,7 +164,6 @@ _constructor(Eo *eo_obj, void *class_data, va_list *list EINA_UNUSED)
    EVAS_ARRAY_SET(e, obscuring_objects);
    EVAS_ARRAY_SET(e, temporary_objects);
    EVAS_ARRAY_SET(e, calculate_objects);
-   EVAS_ARRAY_SET(e, clipped_objects);
    EVAS_ARRAY_SET(e, clip_changes);
    EVAS_ARRAY_SET(e, scie_unref_queue);
    EVAS_ARRAY_SET(e, image_unref_queue);
@@ -277,7 +276,6 @@ _destructor(Eo *eo_e, void *_pd, va_list *list EINA_UNUSED)
    eina_array_flush(&e->obscuring_objects);
    eina_array_flush(&e->temporary_objects);
    eina_array_flush(&e->calculate_objects);
-   eina_array_flush(&e->clipped_objects);
    eina_array_flush(&e->clip_changes);
    eina_array_flush(&e->scie_unref_queue);
    eina_array_flush(&e->image_unref_queue);
index 23c081d..80f1a79 100644 (file)
@@ -1431,103 +1431,6 @@ _drop_image_cache_ref(const void *container EINA_UNUSED, void *data, void *fdata
    return EINA_TRUE;
 }
 
-static void
-_framespace_clipper_add(Evas *eo_e, Evas_Public_Data *e)
-{
-   Eina_Rectangle clip_rect;
-   unsigned int i;
-   Evas_Object *eo_obj;
-   Evas_Object_Protected_Data *obj;
-
-   if (strncmp(e->engine.module->definition->name, "wayland", 7))
-     return;
-
-   /* see if the master clip has been added yet, if not, then create */
-   if (!e->framespace.clip)
-     {
-        e->framespace.clip = evas_object_rectangle_add(eo_e);
-        evas_object_color_set(e->framespace.clip, 255, 255, 255, 255);
-        evas_object_move(e->framespace.clip,
-                         e->framespace.x, e->framespace.y);
-        evas_object_resize(e->framespace.clip,
-                           e->viewport.w - e->framespace.w,
-                           e->viewport.h - e->framespace.h);
-     }
-   else
-     {
-        /* master clip is already present. check for size changes in the
-         * viewport, and update master clip size if needed */
-        if ((e->viewport.changed) || (e->output.changed) ||
-            (e->framespace.changed))
-          {
-             evas_object_move(e->framespace.clip,
-                              e->framespace.x, e->framespace.y);
-             evas_object_resize(e->framespace.clip,
-                                e->viewport.w - e->framespace.w,
-                                e->viewport.h - e->framespace.h);
-          }
-     }
-
-   Evas_Object_Protected_Data *framespace_clip =
-      eo_data_get(e->framespace.clip, EVAS_OBJ_CLASS);
-
-   EINA_RECTANGLE_SET(&clip_rect,
-                      framespace_clip->cur->geometry.x,
-                      framespace_clip->cur->geometry.y,
-                      framespace_clip->cur->geometry.w,
-                      framespace_clip->cur->geometry.h);
-
-   evas_object_show(e->framespace.clip);
-   /* With the master clip all setup, we need to loop the objects on this
-    * canvas and determine if the object is in the viewport space. If it
-    * is in the viewport space (and not in framespace), then we need to
-    * clip the object to the master clip so that it does not draw on top
-    * of the frame (eg: elm 3d test) */
-   for (i = 0; i < e->render_objects.count; ++i)
-     {
-        Eina_Rectangle obj_rect;
-        Evas_Object *pclip;
-
-        obj = eina_array_data_get(&e->render_objects, i);
-        if (obj->is_frame) continue;
-
-        if (obj->delete_me) continue;
-
-        eo_obj = obj->object;
-
-        /* skip clipping if the object is itself the
-         * framespace clip */
-        if (eo_obj == framespace_clip->object) continue;
-
-        EINA_RECTANGLE_SET(&obj_rect,
-                           obj->cur->geometry.x, obj->cur->geometry.y,
-                           obj->cur->geometry.w, obj->cur->geometry.h);
-
-        /* if the object does not intersect our clip rect, ignore it */
-        if (!eina_rectangles_intersect(&clip_rect, &obj_rect))
-          continue;
-
-        if (!(pclip = evas_object_clip_get(eo_obj)))
-          {
-             /* clip this object so it does not draw on the window frame */
-             evas_object_clip_set(eo_obj, framespace_clip->object);
-             eina_array_push(&e->clipped_objects, eo_obj);
-          }
-     }
-}
-
-static void
-_framespace_clipper_del(Evas_Public_Data *e)
-{
-   Evas_Object *eo_obj;
-
-   while ((eo_obj = eina_array_pop(&e->clipped_objects)))
-     evas_object_clip_unset(eo_obj);
-
-   if (e->framespace.clip)
-     evas_object_hide(e->framespace.clip);
-}
-
 static Eina_Bool
 evas_render_updates_internal(Evas *eo_e,
                              unsigned char make_updates,
@@ -1665,14 +1568,6 @@ evas_render_updates_internal(Evas *eo_e,
                                                 fx, fy, fw, fh);
      }
 
-   /* phase 4.5: check if object is not in framespace. if not, we need to clip 
-    * it to the 'master' clip.
-    * 
-    * NB: This is for the wayland engine(s). If we do not do this, then 
-    * objects will draw outside the viewport and potentially onto the frame 
-    * itself */
-   _framespace_clipper_add(eo_e, e);
-
    if (redraw_all)
      {
         e->engine.func->output_redraws_rect_add(e->engine.data.output, 0, 0,
@@ -1960,8 +1855,6 @@ evas_render_updates_internal(Evas *eo_e,
         e->invalidate = EINA_TRUE;
      }
 
-   _framespace_clipper_del(e);
-
    evas_module_clean();
 
    if (!do_async)
index fcf8128..9defa26 100644 (file)
@@ -388,7 +388,6 @@ struct _Evas_Public_Data
    Eina_Array     obscuring_objects;
    Eina_Array     temporary_objects;
    Eina_Array     calculate_objects;
-   Eina_Array     clipped_objects; // to the framespace clipper
    Eina_Array     clip_changes;
    Eina_Array     scie_unref_queue;
    Eina_Array     image_unref_queue;