Compare commits

...

10 Commits

Author SHA1 Message Date
Daniel Hirt bddbac31a4 Evas Textblock: Improve decoration of paragraph
It looks better to color the whole width of the textblock as the
paragraph's width. This is only for the decoration box. The real
paragraph width is passed in the debug data.
2015-08-31 17:48:16 +03:00
Daniel Hirt 71f5f6eaa9 Evas Textblock: Update bidi_level during layout and use it for decoration 2015-08-31 17:33:31 +03:00
Daniel Hirt 4b64909c45 Evas textblock: Add item debug logical index 2015-08-31 12:49:38 +03:00
Daniel Hirt 94b51a0db7 Evas Textblock: Add font to item decoration data 2015-08-31 12:49:38 +03:00
Daniel Hirt 4b7d68dae4 Evas textblock: Add paragraph debug decorations 2015-08-31 12:49:38 +03:00
Daniel Hirt 3f1fdfeb86 evas_font_draw: remove unnecessary subtraction
We had chr_y = chr_y + y, but all usages of this value did (chr_y - y),
which does not make a lot of sense when reading the code.
2015-08-31 12:49:38 +03:00
Daniel Hirt b707c2cd27 try fix rectangles 2015-08-31 12:49:38 +03:00
Daniel Hirt 8b8351f8ee Evas Textblock: add more debug info 2015-08-31 12:49:38 +03:00
Daniel Hirt 0be1c90c74 Evas Textblock: Modify items_get Debug API logic 2015-08-31 12:49:38 +03:00
Daniel Hirt 030f299401 Evas Textblock: Add debug API for Visual Tool 2015-08-31 12:49:38 +03:00
2 changed files with 157 additions and 5 deletions

View File

@ -390,6 +390,7 @@ struct _Evas_Object_Textblock_Item
size_t text_pos; /**< Position of this item in textblock line. */
#ifdef BIDI_SUPPORT
size_t visual_pos; /**< Visual position of this item. */
size_t bidi_level;
#endif
Evas_Textblock_Item_Type type; /**< EVAS_TEXTBLOCK_ITEM_TEXT or EVAS_TEXTBLOCK_ITEM_FORMAT */
@ -3492,6 +3493,10 @@ loop_advance:
x += it->adv + obs_adv;
if ((it->w > 0) && ((it->x + it->w) > c->ln->w)) c->ln->w = it->x + it->w;
if (c->ln->par->bidi_props)
{
it->bidi_level = c->ln->par->bidi_props->embedding_levels[it->text_pos];
}
}
/* clear obstacle info for this line */
@ -10951,6 +10956,7 @@ evas_textblock_cursor_range_simple_geometry_get(const Evas_Textblock_Cursor *cur
/* Add middle rect */
if ((ln1->par->y + ln1->y + ln1->h) != (ln2->par->y + ln2->y))
{
printf("Middle rect\n");
tr = calloc(1, sizeof(Evas_Textblock_Rectangle));
tr->x = lm;
tr->y = ln1->par->y + ln1->y + ln1->h;
@ -12321,6 +12327,152 @@ _evas_textblock_format_offset_get(const Evas_Object_Textblock_Node_Format *n)
}
#endif
#if 1 // TODO: Should replace with #if EDBG if something
EAPI Eina_List *
_evas_textblock_par_rects_get(const Evas_Object *obj)
{
Eina_List *rects = NULL;
Eina_Rectangle *rect;
Evas_Object_Textblock_Paragraph *par;
Evas_Textblock_Data *o = eo_data_scope_get(obj, MY_CLASS);
EINA_INLIST_FOREACH(o->paragraphs, par)
{
if (!par->visible) break;
rect = eina_rectangle_new(0, par->y, par->w, par->h);
rects = eina_list_append(rects, rect);
}
return rects;
}
typedef struct
{
int idx; /* Visual index */
int log_idx; /* Logical index */
Evas_Coord x, y, w, h;
Evas_Textblock_Item_Type type;
Evas_Script_Type script;
Eina_Rectangle *rect;
int bidi_level;
const char *font_src;
Eina_Bool is_rtl : 1;
} Textblock_Item_Debug_Data;
static int
_evas_textblock_get_logical_index(
Evas_Object_Textblock_Paragraph *par,
Evas_Object_Textblock_Item *it)
{
int idx = 0;
Evas_Object_Textblock_Item *itr;
Eina_List *i;
EINA_LIST_FOREACH(par->logical_items, i, itr)
{
if (it == itr) return idx;
idx++;
}
return -1;
}
EAPI Eina_List *
_evas_textblock_items_get(const Evas_Object *obj)
{
Eina_List *rects = NULL;
Evas_Object_Textblock_Paragraph *par;
Evas_Textblock_Data *o = eo_data_scope_get(obj, MY_CLASS);
printf("Populating Items:\n");
EINA_INLIST_FOREACH(o->paragraphs, par)
{
Evas_Object_Textblock_Line *ln;
int idx = 0;
if (!par->visible) break;
EINA_INLIST_FOREACH(par->lines, ln)
{
Evas_Object_Textblock_Item *it;
Evas_Coord marginl = 0;
if (ln->items)
{
marginl = ln->items->format->margin.l;
}
EINA_INLIST_FOREACH(ln->items, it)
{
Textblock_Item_Debug_Data *d = calloc(1, sizeof(Textblock_Item_Debug_Data));
Evas_Coord y = par->y + ln->y;
d->idx = idx++;
d->log_idx = _evas_textblock_get_logical_index(par, it);
d->w = it->w;
d->h = it->h;
d->x = it->x + marginl;
d->y = ln->y;
d->type = it->type;
if (it->type == EVAS_TEXTBLOCK_ITEM_TEXT)
{
Evas_Object_Textblock_Text_Item *ti = _ITEM_TEXT(it);
d->script = ti->text_props.script;
d->is_rtl = (ti->text_props.bidi_dir == EVAS_BIDI_DIRECTION_RTL);
d->bidi_level = it->bidi_level;
RGBA_Font_Int *rfi = ti->text_props.font_instance;
if (rfi)
d->font_src = rfi->src->name;
}
d->rect = eina_rectangle_new(ln->x + it->x + marginl, y, it->w, it->h);
rects = eina_list_append(rects, d);
}
}
evas_bidi_paragraph_props_unref(par->bidi_props);
}
return rects;
}
typedef struct
{
int idx;
int lines;
Evas_Coord x, y, w, h;
Eina_Rectangle *rect;
Eina_Bool is_rtl : 1;
} Textblock_Paragraph_Debug_Data;
EAPI Eina_List *
_evas_textblock_paragraphs_get(const Evas_Object *eo_obj)
{
Eina_List *rects = NULL;
Evas_Object_Textblock_Paragraph *par;
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
Evas_Textblock_Data *o = eo_data_scope_get(eo_obj, MY_CLASS);
printf("Populating Items:\n");
int idx = 0;
EINA_INLIST_FOREACH(o->paragraphs, par)
{
if (!par->visible) break;
Textblock_Paragraph_Debug_Data *d = calloc(1, sizeof(Textblock_Paragraph_Debug_Data));
d->idx = idx++;
d->w = par->w;
d->h = par->h;
d->x = 0;
d->y = par->y;
d->lines = eina_inlist_count(EINA_INLIST_GET(par->lines));
d->is_rtl = (par->direction == EVAS_BIDI_DIRECTION_RTL);
d->rect = eina_rectangle_new(0, par->y, obj->cur->geometry.w, par->h);
rects = eina_list_append(rects, d);
}
return rects;
}
#endif
#if 0
/* Good for debugging */
EAPI void

View File

@ -142,7 +142,7 @@ evas_common_font_rgba_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y,
}
chr_x = x + glyph->x;
chr_y = y + glyph->y;
chr_y = glyph->y;
if (chr_x < (ext_x + ext_w))
{
if ((w > 0) && ((chr_x + w) > ext_x))
@ -152,10 +152,10 @@ evas_common_font_rgba_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y,
if ((fg->ext_dat) && (dc->font_ext.func.gl_draw))
dc->font_ext.func.gl_draw(dc->font_ext.data, dst,
dc, fg,
chr_x, y - (chr_y - y));
chr_x, y - chr_y);
else
evas_common_font_glyph_draw(fg, dc, dst, im_w,
chr_x, y - (chr_y - y),
chr_x, y - chr_y,
ext_x, ext_y,
ext_w, ext_h);
}
@ -164,11 +164,11 @@ evas_common_font_rgba_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y,
if (dc->font_ext.func.gl_image_draw)
dc->font_ext.func.gl_image_draw
(dc->font_ext.data, fg->ext_dat, 0, 0, w, h,
chr_x, y - (chr_y - y), w, h, EINA_TRUE);
chr_x, y - chr_y, w, h, EINA_TRUE);
else
_evas_font_image_draw
(dc, dst, fg->ext_dat, 0, 0, w, h,
chr_x, y - (chr_y - y), w, h, EINA_TRUE);
chr_x, y - chr_y, w, h, EINA_TRUE);
}
}
}