zmike pushed a commit to branch master.

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

commit 789900d49adb6d3c0b29b831514b621431108b0b
Author: Ali Alzyod <[email protected]>
Date:   Tue May 12 10:00:15 2020 -0400

    evas_object_textblock: reduce layout calculations
    
    Summary:
    This patch reduces calculations for layouting textblock when it is not 
needed.
    Exactly in **evas_object_textblock_render_pre**, layouting was done (if 
needed) regardless of object visibility.
    
    evas_object_render_pre will async called if object status is changed, for 
example show->hide
    
    In short words: **We do not layout textblock content if textblock t is 
hidden.**
    
    ```
    // suppose textblock is shown
    // and user want to hide it and set content in it
    // to be visible later on if needed
    evas_object_hide(textblock);
    evas_object_textblock_text_markup_set(textblock, "Hello World");
    //Layouting will be done on textblock regardless of its visiblity, becase 
render_pre
    //will be called and will make it relayout
    ```
    
    Reviewers: woohyun, zmike, tasn, raster, bu5hm4n
    
    Reviewed By: zmike
    
    Subscribers: cedric, #reviewers, #committers
    
    Tags: #efl
    
    Differential Revision: https://phab.enlightenment.org/D11508
---
 src/lib/evas/canvas/evas_object_textblock.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/src/lib/evas/canvas/evas_object_textblock.c 
b/src/lib/evas/canvas/evas_object_textblock.c
index 937cc60263..e92b55ba68 100644
--- a/src/lib/evas/canvas/evas_object_textblock.c
+++ b/src/lib/evas/canvas/evas_object_textblock.c
@@ -15830,13 +15830,13 @@ evas_object_textblock_render_pre(Evas_Object *eo_obj,
      }
 
    //evas_object_textblock_coords_recalc(eo_obj, obj, obj->private_data);
-   if (!_relayout_if_needed(eo_obj, o))
+   is_v = evas_object_is_visible(obj);
+   was_v = evas_object_was_visible(obj);
+   if (is_v && !_relayout_if_needed(eo_obj, o))
      {
         o->redraw = 0;
         evas_object_render_pre_prev_cur_add(&obj->layer->evas->clip_changes,
                                             eo_obj, obj);
-        is_v = evas_object_is_visible(obj);
-        was_v = evas_object_was_visible(obj);
         goto done;
      }
    if (o->changed)
@@ -15845,8 +15845,6 @@ evas_object_textblock_render_pre(Evas_Object *eo_obj,
         o->redraw = 0;
         evas_object_render_pre_prev_cur_add(&obj->layer->evas->clip_changes,
                                             eo_obj, obj);
-        is_v = evas_object_is_visible(obj);
-        was_v = evas_object_was_visible(obj);
         goto done;
      }
 
@@ -15855,14 +15853,10 @@ evas_object_textblock_render_pre(Evas_Object *eo_obj,
         o->redraw = 0;
         evas_object_render_pre_prev_cur_add(&obj->layer->evas->clip_changes,
                                             eo_obj, obj);
-        is_v = evas_object_is_visible(obj);
-        was_v = evas_object_was_visible(obj);
         goto done;
      }
    /* now figure what changed and add draw rects */
    /* if it just became visible or invisible */
-   is_v = evas_object_is_visible(obj);
-   was_v = evas_object_was_visible(obj);
    if (is_v != was_v)
      {
         evas_object_render_pre_visible_change(&obj->layer->evas->clip_changes,

-- 


Reply via email to