Evas textblock: Moved format text_node invalidation to it's own function.

SVN revision: 59273
This commit is contained in:
Tom Hacohen 2011-05-08 11:20:16 +00:00
parent 47a59417d2
commit 8214888f83
1 changed files with 71 additions and 58 deletions

View File

@ -3554,50 +3554,15 @@ end:
/**
* @internal
* Create the layout from the nodes.
* Invalidate text nodes according to format changes
* This goes through all the new format changes and marks the text nodes
* that should be invalidated because of format changes.
*
* @param obj the evas object - NOT NULL.
* @param calc_only true if should only calc sizes false if should also create the layout.. It assumes native size is being calculated, doesn't support formatted size atm.
* @param w the object's w, -1 means no wrapping (i.e infinite size)
* @param h the object's h, -1 means inifinte size.
* @param w_ret the object's calculated w.
* @param h_ret the object's calculated h.
* @param c the working context.
*/
static void
_layout(const Evas_Object *obj, int calc_only, int w, int h, int *w_ret, int *h_ret)
static inline void
_format_changes_invalidate_text_nodes(Ctxt *c)
{
Evas_Object_Textblock *o;
Ctxt ctxt, *c;
Evas_Object_Textblock_Node_Text *n;
Evas_Object_Textblock_Format *fmt = NULL;
int style_pad_l = 0, style_pad_r = 0, style_pad_t = 0, style_pad_b = 0;
/* setup context */
o = (Evas_Object_Textblock *)(obj->object_data);
c = &ctxt;
c->obj = (Evas_Object *)obj;
c->o = o;
c->paragraphs = c->par = NULL;
c->format_stack = NULL;
c->x = c->y = 0;
c->w = w;
c->h = h;
c->wmax = c->hmax = 0;
c->maxascent = c->maxdescent = 0;
c->marginl = c->marginr = 0;
c->have_underline = 0;
c->have_underline2 = 0;
c->underline_extend = 0;
c->line_no = 0;
c->align = 0.0;
c->align_auto = EINA_TRUE;
c->ln = NULL;
c->calc_only = !!calc_only;
c->width_changed = (obj->cur.geometry.w != o->last_w);
/* Mark text nodes as dirty if format have changed. */
if (c->o->format_changed)
{
Evas_Object_Textblock_Node_Format *fnode = c->o->format_nodes;
Evas_Object_Textblock_Node_Text *start_n = NULL;
int balance = 0;
@ -3655,10 +3620,58 @@ _layout(const Evas_Object *obj, int calc_only, int w, int h, int *w_ret, int *h_
start_n = _NODE_TEXT(EINA_INLIST_GET(start_n)->next);
}
}
}
/**
* @internal
* Create the layout from the nodes.
*
* @param obj the evas object - NOT NULL.
* @param calc_only true if should only calc sizes false if should also create the layout.. It assumes native size is being calculated, doesn't support formatted size atm.
* @param w the object's w, -1 means no wrapping (i.e infinite size)
* @param h the object's h, -1 means inifinte size.
* @param w_ret the object's calculated w.
* @param h_ret the object's calculated h.
*/
static void
_layout(const Evas_Object *obj, int calc_only, int w, int h, int *w_ret, int *h_ret)
{
Evas_Object_Textblock *o;
Ctxt ctxt, *c;
Evas_Object_Textblock_Node_Text *n;
Evas_Object_Textblock_Format *fmt = NULL;
int style_pad_l = 0, style_pad_r = 0, style_pad_t = 0, style_pad_b = 0;
/* setup context */
o = (Evas_Object_Textblock *)(obj->object_data);
c = &ctxt;
c->obj = (Evas_Object *)obj;
c->o = o;
c->paragraphs = c->par = NULL;
c->format_stack = NULL;
c->x = c->y = 0;
c->w = w;
c->h = h;
c->wmax = c->hmax = 0;
c->maxascent = c->maxdescent = 0;
c->marginl = c->marginr = 0;
c->have_underline = 0;
c->have_underline2 = 0;
c->underline_extend = 0;
c->line_no = 0;
c->align = 0.0;
c->align_auto = EINA_TRUE;
c->ln = NULL;
c->calc_only = !!calc_only;
c->width_changed = (obj->cur.geometry.w != o->last_w);
/* Mark text nodes as dirty if format have changed. */
if (c->o->format_changed)
{
_format_changes_invalidate_text_nodes(c);
}
/* Start of logical layout creation */
/* setup default base style */
if ((c->o->style) && (c->o->style->default_tag))
{