antognolli pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=d1c6266c45b6bfbfbba4a3b61ee6e9e5cec99cc9

commit d1c6266c45b6bfbfbba4a3b61ee6e9e5cec99cc9
Author: Rafael Antognolli <rafael.antogno...@intel.com>
Date:   Tue Oct 1 15:35:09 2013 -0300

    evas/image: Delay some video overlay operations.
    
    If we are running on async render, some operations must be delayed, so
    they will happen at the same time that the canvas rendering result gets
    updated on the window/surface.
---
 src/lib/evas/canvas/evas_object_image.c | 53 ++++++++++++++++++++++++++++-----
 src/lib/evas/canvas/evas_render.c       | 10 +++++++
 src/lib/evas/include/evas_private.h     |  1 +
 3 files changed, 57 insertions(+), 7 deletions(-)

diff --git a/src/lib/evas/canvas/evas_object_image.c 
b/src/lib/evas/canvas/evas_object_image.c
index 8020466..af76f53 100644
--- a/src/lib/evas/canvas/evas_object_image.c
+++ b/src/lib/evas/canvas/evas_object_image.c
@@ -126,6 +126,13 @@ struct _Evas_Object_Image
    Eina_Bool         proxy_src_clip : 1;
    Eina_Bool         written : 1;
    Eina_Bool         direct_render : 1;
+   struct
+   {
+      Eina_Bool      video_move : 1;
+      Eina_Bool      video_resize : 1;
+      Eina_Bool      video_show : 1;
+      Eina_Bool      video_hide : 1;
+   } delayed;
 };
 
 /* private methods for image objects */
@@ -5213,21 +5220,21 @@ _evas_object_image_video_overlay_show(Evas_Object 
*eo_obj)
 {
    Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS);
    Evas_Object_Image *o = eo_data_scope_get(eo_obj, MY_CLASS);
-   Evas_Public_Data *e = obj->layer->evas;
 
    if (obj->cur->cache.clip.x != obj->prev->cache.clip.x ||
        obj->cur->cache.clip.y != obj->prev->cache.clip.y ||
        o->created || !o->video_visible)
-     o->pixels->video.move(o->pixels->video.data, eo_obj, &o->pixels->video,
-                           obj->cur->cache.clip.x + e->framespace.x,
-                           obj->cur->cache.clip.y + e->framespace.y);
+     o->delayed.video_move = EINA_TRUE;
+
    if (obj->cur->cache.clip.w != obj->prev->cache.clip.w ||
        obj->cur->cache.clip.h != obj->prev->cache.clip.h ||
        o->created || !o->video_visible)
-     o->pixels->video.resize(o->pixels->video.data, eo_obj, &o->pixels->video, 
obj->cur->cache.clip.w, obj->cur->cache.clip.h);
+     o->delayed.video_resize = EINA_TRUE;
+
    if (!o->video_visible || o->created)
      {
-        o->pixels->video.show(o->pixels->video.data, eo_obj, 
&o->pixels->video);
+        o->delayed.video_show = EINA_TRUE;
+        o->delayed.video_hide = EINA_FALSE;
      }
    else
      {
@@ -5254,13 +5261,45 @@ _evas_object_image_video_overlay_hide(Evas_Object 
*eo_obj)
    Evas_Object_Image *o = eo_data_scope_get(eo_obj, MY_CLASS);
 
    if (o->video_visible || o->created)
-     o->pixels->video.hide(o->pixels->video.data, eo_obj, &o->pixels->video);
+     {
+        o->delayed.video_hide = EINA_TRUE;
+        o->delayed.video_show = EINA_FALSE;
+     }
    if (evas_object_is_visible(eo_obj, obj))
      o->pixels->video.update_pixels(o->pixels->video.data, eo_obj, 
&o->pixels->video);
    o->video_visible = EINA_FALSE;
    o->created = EINA_FALSE;
 }
 
+void
+_evas_object_image_video_overlay_do(Evas_Object *eo_obj)
+{
+   Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS);
+   Evas_Object_Image *o = eo_data_scope_get(eo_obj, MY_CLASS);
+   Evas_Public_Data *e = obj->layer->evas;
+
+   if (o->delayed.video_move)
+     o->pixels->video.move(o->pixels->video.data, eo_obj, &o->pixels->video,
+                           obj->cur->cache.clip.x + e->framespace.x,
+                           obj->cur->cache.clip.y + e->framespace.y);
+
+   if (o->delayed.video_resize)
+     o->pixels->video.resize(o->pixels->video.data, eo_obj,
+                             &o->pixels->video,
+                             obj->cur->cache.clip.w,
+                             obj->cur->cache.clip.h);
+
+   if (o->delayed.video_show)
+     o->pixels->video.show(o->pixels->video.data, eo_obj, &o->pixels->video);
+   else if (o->delayed.video_hide)
+     o->pixels->video.hide(o->pixels->video.data, eo_obj, &o->pixels->video);
+
+   o->delayed.video_move = EINA_FALSE;
+   o->delayed.video_resize = EINA_FALSE;
+   o->delayed.video_show = EINA_FALSE;
+   o->delayed.video_hide = EINA_FALSE;
+}
+
 static void
 _class_constructor(Eo_Class *klass)
 {
diff --git a/src/lib/evas/canvas/evas_render.c 
b/src/lib/evas/canvas/evas_render.c
index 670c146..49fbefe 100644
--- a/src/lib/evas/canvas/evas_render.c
+++ b/src/lib/evas/canvas/evas_render.c
@@ -1896,6 +1896,10 @@ evas_render_updates_internal(Evas *eo_e,
           }
         else if (haveup)
           {
+             EINA_LIST_FOREACH(e->video_objects, ll, eo_obj)
+               {
+                  _evas_object_image_video_overlay_do(eo_obj);
+               }
              evas_event_callback_call(eo_e, EVAS_CALLBACK_RENDER_FLUSH_PRE, 
NULL);
              e->engine.func->output_flush(e->engine.data.output,
                                           EVAS_RENDER_MODE_SYNC);
@@ -2085,6 +2089,12 @@ evas_render_wakeup(Evas *eo_e)
    /* flush redraws */
    if (haveup)
      {
+        Eina_List *ll;
+        Evas_Object *eo_obj;
+        EINA_LIST_FOREACH(e->video_objects, ll, eo_obj)
+          {
+             _evas_object_image_video_overlay_do(eo_obj);
+          }
         evas_event_callback_call(eo_e, EVAS_CALLBACK_RENDER_FLUSH_PRE, NULL);
         e->engine.func->output_flush(e->engine.data.output,
                                      EVAS_RENDER_MODE_ASYNC_END);
diff --git a/src/lib/evas/include/evas_private.h 
b/src/lib/evas/include/evas_private.h
index 5a9867b..01658f7 100644
--- a/src/lib/evas/include/evas_private.h
+++ b/src/lib/evas/include/evas_private.h
@@ -996,6 +996,7 @@ void _evas_object_image_preloading_check(Evas_Object *obj);
 Evas_Object *_evas_object_image_video_parent_get(Evas_Object *obj);
 void _evas_object_image_video_overlay_show(Evas_Object *obj);
 void _evas_object_image_video_overlay_hide(Evas_Object *obj);
+void _evas_object_image_video_overlay_do(Evas_Object *obj);
 void _evas_object_image_free(Evas_Object *obj);
 void evas_object_smart_bounding_box_get(Evas_Object *eo_obj,
                                        Evas_Coord_Rectangle *cur_bounding_box,

-- 


Reply via email to