forked from enlightenment/efl
Revert "evas: improve textblock rendering by walking even less in all case."
This reverts commit a69c5ba0ae
.
yes - this broke text rendering. revert it. several dialogs/uses in e
broke with shadow and glow text being heavily offset up/to the right
of the proper text.
This commit is contained in:
parent
153a744e67
commit
3367bf0aba
|
@ -373,17 +373,14 @@ typedef enum _Evas_Textblock_Item_Type
|
|||
struct _Evas_Object_Textblock_Item
|
||||
{
|
||||
EINA_INLIST;
|
||||
Evas_Textblock_Item_Type type;
|
||||
Evas_Object_Textblock_Node_Text *text_node;
|
||||
Evas_Object_Textblock_Format *format;
|
||||
Evas_Object_Textblock_Line *ln;
|
||||
size_t text_pos;
|
||||
#ifdef BIDI_SUPPORT
|
||||
size_t visual_pos;
|
||||
#endif
|
||||
Evas_Textblock_Item_Type type;
|
||||
|
||||
Evas_Coord adv, x, w, h;
|
||||
Evas_Coord yoff;
|
||||
Eina_Bool merge : 1; /* Indicates whether this
|
||||
item should merge to the
|
||||
previous item or not */
|
||||
|
@ -4442,7 +4439,6 @@ _layout_handle_ellipsis(Ctxt *c, Evas_Object_Textblock_Item *it, Eina_List *i)
|
|||
c->ln->items = (Evas_Object_Textblock_Item *)
|
||||
eina_inlist_append(EINA_INLIST_GET(c->ln->items),
|
||||
EINA_INLIST_GET(it));
|
||||
it->ln = c->ln;
|
||||
if (it->type == EVAS_TEXTBLOCK_ITEM_FORMAT)
|
||||
{
|
||||
Evas_Object_Textblock_Format_Item *fi;
|
||||
|
@ -4453,7 +4449,6 @@ _layout_handle_ellipsis(Ctxt *c, Evas_Object_Textblock_Item *it, Eina_List *i)
|
|||
c->ln->items = (Evas_Object_Textblock_Item *)
|
||||
eina_inlist_append(EINA_INLIST_GET(c->ln->items),
|
||||
EINA_INLIST_GET(_ITEM(ellip_ti)));
|
||||
_ITEM(ellip_ti)->ln = c->ln;
|
||||
|
||||
c->position = (c->position == TEXTBLOCK_POSITION_START) ?
|
||||
TEXTBLOCK_POSITION_SINGLE : TEXTBLOCK_POSITION_END;
|
||||
|
@ -4473,7 +4468,7 @@ _layout_paragraph_reorder_lines(Evas_Object_Textblock_Paragraph *par)
|
|||
}
|
||||
#endif
|
||||
|
||||
static inline void
|
||||
static void
|
||||
_layout_paragraph_render(Evas_Object_Textblock *o,
|
||||
Evas_Object_Textblock_Paragraph *par)
|
||||
{
|
||||
|
@ -4705,7 +4700,6 @@ _layout_par(Ctxt *c)
|
|||
eina_inlist_remove(
|
||||
EINA_INLIST_GET(c->ln->items),
|
||||
EINA_INLIST_GET(it)));
|
||||
it->ln = c->ln;
|
||||
i = eina_list_prev(i);
|
||||
it = eina_list_data_get(i);
|
||||
}
|
||||
|
@ -4775,7 +4769,6 @@ _layout_par(Ctxt *c)
|
|||
c->ln->items = (Evas_Object_Textblock_Item *)
|
||||
eina_inlist_append(EINA_INLIST_GET(c->ln->items),
|
||||
EINA_INLIST_GET(it));
|
||||
it->ln = c->ln;
|
||||
if (it->type == EVAS_TEXTBLOCK_ITEM_FORMAT)
|
||||
{
|
||||
Evas_Object_Textblock_Format_Item *fi;
|
||||
|
@ -10713,16 +10706,10 @@ evas_object_textblock_render(Evas_Object *eo_obj EINA_UNUSED,
|
|||
int x, int y, Eina_Bool do_async)
|
||||
{
|
||||
Evas_Object_Textblock_Paragraph *par, *start = NULL;
|
||||
Evas_Object_Textblock_Item *itr;
|
||||
Evas_Object_Textblock_Line *ln;
|
||||
Evas_Object_Textblock *o = type_private_data;
|
||||
Eina_List *shadows = NULL;
|
||||
Eina_List *glows = NULL;
|
||||
Eina_List *outlines = NULL;
|
||||
int i, j;
|
||||
int cx, cy, cw, ch, clip;
|
||||
int ca, cr, cg, cb;
|
||||
int na, nr, ng, nb;
|
||||
const char vals[5][5] =
|
||||
{
|
||||
{0, 1, 2, 1, 0},
|
||||
|
@ -10731,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,
|
||||
|
@ -10747,9 +10737,6 @@ evas_object_textblock_render(Evas_Object *eo_obj EINA_UNUSED,
|
|||
* there's nothing left to do. */
|
||||
if (!o->paragraphs) return;
|
||||
|
||||
ENFN->context_color_set(output, context, 0, 0, 0, 0);
|
||||
ca = cr = cg = cb = 0;
|
||||
|
||||
#define ITEM_WALK() \
|
||||
EINA_INLIST_FOREACH(start, par) \
|
||||
{ \
|
||||
|
@ -10764,6 +10751,8 @@ evas_object_textblock_render(Evas_Object *eo_obj EINA_UNUSED,
|
|||
_layout_paragraph_render(o, par); \
|
||||
EINA_INLIST_FOREACH(par->lines, ln) \
|
||||
{ \
|
||||
Evas_Object_Textblock_Item *itr; \
|
||||
\
|
||||
if (clip) \
|
||||
{ \
|
||||
if ((obj->cur->geometry.y + y + par->y + ln->y + ln->h) < (cy - 20)) \
|
||||
|
@ -10778,7 +10767,6 @@ evas_object_textblock_render(Evas_Object *eo_obj EINA_UNUSED,
|
|||
if (itr->format->valign != -1.0) \
|
||||
{ \
|
||||
yoff += itr->format->valign * (ln->h - itr->h); \
|
||||
itr->yoff = yoff; \
|
||||
} \
|
||||
if (clip) \
|
||||
{ \
|
||||
|
@ -10798,27 +10786,17 @@ evas_object_textblock_render(Evas_Object *eo_obj EINA_UNUSED,
|
|||
} \
|
||||
do {} while(0)
|
||||
#define COLOR_SET(col) \
|
||||
nr = obj->cur->cache.clip.r * ti->parent.format->color.col.r; \
|
||||
ng = obj->cur->cache.clip.g * ti->parent.format->color.col.g; \
|
||||
nb = obj->cur->cache.clip.b * ti->parent.format->color.col.b; \
|
||||
na = obj->cur->cache.clip.a * ti->parent.format->color.col.a; \
|
||||
if (na != ca || nb != cb || ng != cg || nr != cr) \
|
||||
{ \
|
||||
ENFN->context_color_set(output, context, \
|
||||
nr / 255, ng / 255, nb / 255, na / 255); \
|
||||
cr = nr; cg = ng; cb = nb; ca = na; \
|
||||
}
|
||||
(obj->cur->cache.clip.r * ti->parent.format->color.col.r) / 255, \
|
||||
(obj->cur->cache.clip.g * ti->parent.format->color.col.g) / 255, \
|
||||
(obj->cur->cache.clip.b * ti->parent.format->color.col.b) / 255, \
|
||||
(obj->cur->cache.clip.a * ti->parent.format->color.col.a) / 255);
|
||||
#define COLOR_SET_AMUL(col, amul) \
|
||||
nr = obj->cur->cache.clip.r * ti->parent.format->color.col.r * (amul); \
|
||||
ng = obj->cur->cache.clip.g * ti->parent.format->color.col.g * (amul); \
|
||||
nb = obj->cur->cache.clip.b * ti->parent.format->color.col.b * (amul); \
|
||||
na = obj->cur->cache.clip.a * ti->parent.format->color.col.a * (amul); \
|
||||
if (na != ca || nb != cb || ng != cg || nr != cr) \
|
||||
{ \
|
||||
ENFN->context_color_set(output, context, \
|
||||
nr / 65025, ng / 65025, nb / 65025, na / 65025); \
|
||||
cr = nr; cg = ng; cb = nb; ca = na; \
|
||||
}
|
||||
(obj->cur->cache.clip.r * ti->parent.format->color.col.r * (amul)) / 65025, \
|
||||
(obj->cur->cache.clip.g * ti->parent.format->color.col.g * (amul)) / 65025, \
|
||||
(obj->cur->cache.clip.b * ti->parent.format->color.col.b * (amul)) / 65025, \
|
||||
(obj->cur->cache.clip.a * ti->parent.format->color.col.a * (amul)) / 65025);
|
||||
#define DRAW_TEXT(ox, oy) \
|
||||
if (ti->parent.format->font.font) \
|
||||
evas_font_draw_async_check(obj, output, context, surface, \
|
||||
|
@ -10832,16 +10810,12 @@ evas_object_textblock_render(Evas_Object *eo_obj EINA_UNUSED,
|
|||
#define DRAW_RECT(ox, oy, ow, oh, or, og, ob, oa) \
|
||||
do \
|
||||
{ \
|
||||
nr = obj->cur->cache.clip.r * or; \
|
||||
ng = obj->cur->cache.clip.g * og; \
|
||||
nb = obj->cur->cache.clip.b * ob; \
|
||||
na = obj->cur->cache.clip.a * oa; \
|
||||
if (na != ca || nb != cb || ng != cg || nr != cr) \
|
||||
{ \
|
||||
ENFN->context_color_set(output, context, \
|
||||
cr / 255, cg / 255, cb / 255, ca / 255); \
|
||||
cr = nr; cg = ng; cb = nb; ca = na; \
|
||||
} \
|
||||
ENFN->context_color_set(output, \
|
||||
context, \
|
||||
(obj->cur->cache.clip.r * or) / 255, \
|
||||
(obj->cur->cache.clip.g * og) / 255, \
|
||||
(obj->cur->cache.clip.b * ob) / 255, \
|
||||
(obj->cur->cache.clip.a * oa) / 255); \
|
||||
ENFN->rectangle_draw(output, \
|
||||
context, \
|
||||
surface, \
|
||||
|
@ -10919,6 +10893,8 @@ 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;
|
||||
|
@ -10931,23 +10907,24 @@ evas_object_textblock_render(Evas_Object *eo_obj EINA_UNUSED,
|
|||
EVAS_TEXT_STYLE_FAR_SOFT_SHADOW |
|
||||
EVAS_TEXT_STYLE_SOFT_SHADOW))
|
||||
{
|
||||
shadows = eina_list_append(shadows, itr);
|
||||
have_shadow = EINA_TRUE;
|
||||
}
|
||||
if ((ti->parent.format->style & EVAS_TEXT_STYLE_MASK_BASIC) ==
|
||||
EVAS_TEXT_STYLE_GLOW)
|
||||
{
|
||||
glows = eina_list_append(glows, itr);
|
||||
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))
|
||||
{
|
||||
outlines = eina_list_append(outlines, itr);
|
||||
have_outline = EINA_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/* Draw background */
|
||||
}
|
||||
|
||||
DRAW_FORMAT(backing, 0, ln->h);
|
||||
}
|
||||
ITEM_WALK_END();
|
||||
|
@ -10958,18 +10935,15 @@ evas_object_textblock_render(Evas_Object *eo_obj EINA_UNUSED,
|
|||
/* prepare everything for text draw */
|
||||
|
||||
/* shadows */
|
||||
EINA_LIST_FREE(shadows, itr)
|
||||
if (have_shadow)
|
||||
{
|
||||
ITEM_WALK()
|
||||
{
|
||||
int shad_dst, shad_sz, dx, dy, haveshad;
|
||||
Evas_Object_Textblock_Text_Item *ti;
|
||||
Evas_Coord yoff;
|
||||
|
||||
ti = (itr->type == EVAS_TEXTBLOCK_ITEM_TEXT) ? _ITEM_TEXT(itr) : NULL;
|
||||
if (!ti) continue;
|
||||
|
||||
yoff = itr->yoff;
|
||||
ln = itr->ln;
|
||||
|
||||
shad_dst = shad_sz = dx = dy = haveshad = 0;
|
||||
switch (ti->parent.format->style & EVAS_TEXT_STYLE_MASK_BASIC)
|
||||
{
|
||||
|
@ -11067,19 +11041,18 @@ evas_object_textblock_render(Evas_Object *eo_obj EINA_UNUSED,
|
|||
}
|
||||
}
|
||||
}
|
||||
ITEM_WALK_END();
|
||||
}
|
||||
|
||||
/* glows */
|
||||
EINA_LIST_FREE(glows, itr)
|
||||
if (have_glow)
|
||||
{
|
||||
ITEM_WALK()
|
||||
{
|
||||
Evas_Object_Textblock_Text_Item *ti;
|
||||
Evas_Coord yoff;
|
||||
|
||||
ti = (itr->type == EVAS_TEXTBLOCK_ITEM_TEXT) ? _ITEM_TEXT(itr) : NULL;
|
||||
if (!ti) continue;
|
||||
|
||||
yoff = itr->yoff;
|
||||
ln = itr->ln;
|
||||
|
||||
if ((ti->parent.format->style & EVAS_TEXT_STYLE_MASK_BASIC) == EVAS_TEXT_STYLE_GLOW)
|
||||
{
|
||||
for (j = 0; j < 5; j++)
|
||||
|
@ -11100,19 +11073,18 @@ evas_object_textblock_render(Evas_Object *eo_obj EINA_UNUSED,
|
|||
DRAW_TEXT(0, 1);
|
||||
}
|
||||
}
|
||||
ITEM_WALK_END();
|
||||
}
|
||||
|
||||
/* outlines */
|
||||
EINA_LIST_FREE(outlines, itr)
|
||||
if (have_outline)
|
||||
{
|
||||
ITEM_WALK()
|
||||
{
|
||||
Evas_Object_Textblock_Text_Item *ti;
|
||||
Evas_Coord yoff;
|
||||
|
||||
ti = (itr->type == EVAS_TEXTBLOCK_ITEM_TEXT) ? _ITEM_TEXT(itr) : NULL;
|
||||
if (!ti) continue;
|
||||
|
||||
yoff = itr->yoff;
|
||||
ln = itr->ln;
|
||||
|
||||
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))
|
||||
|
@ -11138,6 +11110,8 @@ 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. */
|
||||
|
|
Loading…
Reference in New Issue