Canvas text: move obstacles logic to proper place

Will likely reduce number of update requests.
This commit is contained in:
Daniel Hirt 2017-08-21 12:43:19 +03:00
parent c017ab2dc0
commit f696cc8893
1 changed files with 8 additions and 11 deletions

View File

@ -2868,6 +2868,7 @@ struct _Ctxt
Textblock_Position position;
Evas_Textblock_Align_Auto align_auto : 2;
Eina_Bool width_changed : 1;
Eina_Bool handle_obstacles : 1;
};
static void _layout_text_add_logical_item(Ctxt *c, Evas_Object_Textblock_Text_Item *ti, Eina_List *rel);
@ -5461,9 +5462,6 @@ _layout_par(Ctxt *c)
char *line_breaks = NULL;
char *word_breaks = NULL;
/* Obstacles logic */
Eina_Bool handle_obstacles = EINA_FALSE;
if (!c->par->logical_items)
return 2;
@ -5507,13 +5505,6 @@ _layout_par(Ctxt *c)
return 0;
}
/* Update all obstacles */
if (c->o->obstacle_changed || c->width_changed)
{
_layout_obstacles_update(c);
handle_obstacles = EINA_TRUE;
}
c->par->text_node->dirty = EINA_FALSE;
c->par->text_node->is_new = EINA_FALSE;
c->par->rendered = EINA_FALSE;
@ -5618,7 +5609,7 @@ _layout_par(Ctxt *c)
}
}
if (handle_obstacles && !obs)
if (c->handle_obstacles && !obs)
{
obs = _layout_item_obstacle_get(c, it);
}
@ -6349,6 +6340,12 @@ _layout(const Evas_Object *eo_obj, int w, int h, int *w_ret, int *h_ret)
c->obs_infos = NULL;
c->hyphen_ti = NULL;
/* Update all obstacles */
if (c->o->obstacle_changed || c->width_changed)
{
_layout_obstacles_update(c);
c->handle_obstacles = EINA_TRUE;
}
/* Start of logical layout creation */
/* setup default base style */
{