evas: limit how many times we walk over items.

This does help for some textblock benchmark with a speed increase of 12% and
the one that don't get better don't get slower either, so let's put that in.
This commit is contained in:
Cedric BAIL 2013-12-26 11:27:09 +09:00
parent 9749c8ff0b
commit 766bd42639
1 changed files with 184 additions and 139 deletions

View File

@ -10718,6 +10718,9 @@ evas_object_textblock_render(Evas_Object *eo_obj EINA_UNUSED,
{1, 3, 4, 3, 1},
{0, 1, 2, 1, 0}
};
Eina_Bool have_shadow = EINA_FALSE;
Eina_Bool have_glow = EINA_FALSE;
Eina_Bool have_outline = EINA_FALSE;
/* render object to surface with context, and offxet by x,y */
obj->layer->evas->engine.func->context_multiplier_unset(output,
@ -10889,6 +10892,39 @@ evas_object_textblock_render(Evas_Object *eo_obj EINA_UNUSED,
ITEM_WALK()
{
/* Check which other pass are necessary to avoid useless WALK */
if (!have_shadow && !have_glow && !have_outline)
{
Evas_Object_Textblock_Text_Item *ti;
ti = (itr->type == EVAS_TEXTBLOCK_ITEM_TEXT) ? _ITEM_TEXT(itr) : NULL;
if (ti)
{
if (ti->parent.format->style & (EVAS_TEXT_STYLE_SHADOW |
EVAS_TEXT_STYLE_OUTLINE_SOFT_SHADOW |
EVAS_TEXT_STYLE_OUTLINE_SHADOW |
EVAS_TEXT_STYLE_FAR_SHADOW |
EVAS_TEXT_STYLE_FAR_SOFT_SHADOW |
EVAS_TEXT_STYLE_SOFT_SHADOW))
{
have_shadow = EINA_TRUE;
}
if ((ti->parent.format->style & EVAS_TEXT_STYLE_MASK_BASIC) ==
EVAS_TEXT_STYLE_GLOW)
{
have_glow = EINA_TRUE;
}
if (((ti->parent.format->style & EVAS_TEXT_STYLE_MASK_BASIC) == EVAS_TEXT_STYLE_OUTLINE) ||
((ti->parent.format->style & EVAS_TEXT_STYLE_MASK_BASIC) == EVAS_TEXT_STYLE_OUTLINE_SHADOW) ||
((ti->parent.format->style & EVAS_TEXT_STYLE_MASK_BASIC) == EVAS_TEXT_STYLE_OUTLINE_SOFT_SHADOW) ||
(ti->parent.format->style == EVAS_TEXT_STYLE_SOFT_OUTLINE))
{
have_outline = EINA_TRUE;
}
}
}
DRAW_FORMAT(backing, 0, ln->h);
}
ITEM_WALK_END();
@ -10899,6 +10935,8 @@ evas_object_textblock_render(Evas_Object *eo_obj EINA_UNUSED,
/* prepare everything for text draw */
/* shadows */
if (have_shadow)
{
ITEM_WALK()
{
int shad_dst, shad_sz, dx, dy, haveshad;
@ -11004,8 +11042,11 @@ evas_object_textblock_render(Evas_Object *eo_obj EINA_UNUSED,
}
}
ITEM_WALK_END();
}
/* glows */
if (have_glow)
{
ITEM_WALK()
{
Evas_Object_Textblock_Text_Item *ti;
@ -11033,8 +11074,11 @@ evas_object_textblock_render(Evas_Object *eo_obj EINA_UNUSED,
}
}
ITEM_WALK_END();
}
/* outlines */
if (have_outline)
{
ITEM_WALK()
{
Evas_Object_Textblock_Text_Item *ti;
@ -11067,6 +11111,7 @@ evas_object_textblock_render(Evas_Object *eo_obj EINA_UNUSED,
}
}
ITEM_WALK_END();
}
/* normal text and lines */
/* Get the thickness and position, and save them for non-text items. */