summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Hacohen <tom@stosb.com>2013-09-20 14:47:32 +0100
committerTom Hacohen <tom@stosb.com>2013-09-23 14:37:18 +0100
commit5adffd54e5f2e6490ef5c4aff4c932f625a83f68 (patch)
tree72b92187da4e20e771d306c54880f6a654c0e3b5
parent2041e995fc75a8943f4592afb6076a56710861ed (diff)
Evas textblock: rename maxascent/descent->ascent/descent.
Although we kinda use them as max in some situations, they are actually just the regular ascent and descent. Following commits will make this separation even stronger.
-rw-r--r--src/lib/evas/canvas/evas_object_textblock.c53
1 files changed, 28 insertions, 25 deletions
diff --git a/src/lib/evas/canvas/evas_object_textblock.c b/src/lib/evas/canvas/evas_object_textblock.c
index 533deaa688..924ef75d7e 100644
--- a/src/lib/evas/canvas/evas_object_textblock.c
+++ b/src/lib/evas/canvas/evas_object_textblock.c
@@ -2489,6 +2489,7 @@ struct _Ctxt
2489 int x, y; 2489 int x, y;
2490 int w, h; 2490 int w, h;
2491 int wmax, hmax; 2491 int wmax, hmax;
2492 int ascent, descent;
2492 int maxascent, maxdescent; 2493 int maxascent, maxdescent;
2493 int marginl, marginr; 2494 int marginl, marginr;
2494 int line_no; 2495 int line_no;
@@ -2643,6 +2644,7 @@ _layout_line_new(Ctxt *c, Evas_Object_Textblock_Format *fmt)
2643 c->marginr = fmt->margin.r; 2644 c->marginr = fmt->margin.r;
2644 c->par->lines = (Evas_Object_Textblock_Line *)eina_inlist_append(EINA_INLIST_GET(c->par->lines), EINA_INLIST_GET(c->ln)); 2645 c->par->lines = (Evas_Object_Textblock_Line *)eina_inlist_append(EINA_INLIST_GET(c->par->lines), EINA_INLIST_GET(c->ln));
2645 c->x = 0; 2646 c->x = 0;
2647 c->ascent = c->descent = 0;
2646 c->maxascent = c->maxdescent = 0; 2648 c->maxascent = c->maxdescent = 0;
2647 c->ln->line_no = -1; 2649 c->ln->line_no = -1;
2648 c->ln->par = c->par; 2650 c->ln->par = c->par;
@@ -3268,9 +3270,9 @@ _layout_line_finalize(Ctxt *c, Evas_Object_Textblock_Format *fmt)
3268 3270
3269 /* If there are no text items yet, calc ascent/descent 3271 /* If there are no text items yet, calc ascent/descent
3270 * according to the current format. */ 3272 * according to the current format. */
3271 if (c->maxascent + c->maxdescent == 0) 3273 if (c->ascent + c->descent == 0)
3272 _layout_format_ascent_descent_adjust(c->obj, &c->maxascent, 3274 _layout_format_ascent_descent_adjust(c->obj, &c->ascent,
3273 &c->maxdescent, fmt); 3275 &c->descent, fmt);
3274 3276
3275 /* Adjust all the item sizes according to the final line size, 3277 /* Adjust all the item sizes according to the final line size,
3276 * and update the x positions of all the items of the line. */ 3278 * and update the x positions of all the items of the line. */
@@ -3280,8 +3282,8 @@ _layout_line_finalize(Ctxt *c, Evas_Object_Textblock_Format *fmt)
3280 { 3282 {
3281 Evas_Object_Textblock_Format_Item *fi = _ITEM_FORMAT(it); 3283 Evas_Object_Textblock_Format_Item *fi = _ITEM_FORMAT(it);
3282 if (!fi->formatme) goto loop_advance; 3284 if (!fi->formatme) goto loop_advance;
3283 _layout_calculate_format_item_size(c->obj, fi, &c->maxascent, 3285 _layout_calculate_format_item_size(c->obj, fi, &c->ascent,
3284 &c->maxdescent, &fi->y, &fi->parent.w, &fi->parent.h); 3286 &c->descent, &fi->y, &fi->parent.w, &fi->parent.h);
3285 fi->parent.adv = fi->parent.w; 3287 fi->parent.adv = fi->parent.w;
3286 } 3288 }
3287 else 3289 else
@@ -3290,10 +3292,10 @@ _layout_line_finalize(Ctxt *c, Evas_Object_Textblock_Format *fmt)
3290 _layout_item_ascent_descent_adjust(c->obj, &asc, &desc, 3292 _layout_item_ascent_descent_adjust(c->obj, &asc, &desc,
3291 it, c->position); 3293 it, c->position);
3292 3294
3293 if (asc > c->maxascent) 3295 if (asc > c->ascent)
3294 c->maxascent = asc; 3296 c->ascent = asc;
3295 if (desc > c->maxdescent) 3297 if (desc > c->descent)
3296 c->maxdescent = desc; 3298 c->descent = desc;
3297 } 3299 }
3298 3300
3299loop_advance: 3301loop_advance:
@@ -3304,19 +3306,19 @@ loop_advance:
3304 } 3306 }
3305 3307
3306 c->ln->y = (c->y - c->par->y) + c->o->style_pad.t; 3308 c->ln->y = (c->y - c->par->y) + c->o->style_pad.t;
3307 c->ln->h = c->maxascent + c->maxdescent; 3309 c->ln->h = c->ascent + c->descent;
3308 c->ln->baseline = c->maxascent; 3310 c->ln->baseline = c->ascent;
3309 if (c->have_underline2) 3311 if (c->have_underline2)
3310 { 3312 {
3311 if (c->maxdescent < 4) c->underline_extend = 4 - c->maxdescent; 3313 if (c->descent < 4) c->underline_extend = 4 - c->descent;
3312 } 3314 }
3313 else if (c->have_underline) 3315 else if (c->have_underline)
3314 { 3316 {
3315 if (c->maxdescent < 2) c->underline_extend = 2 - c->maxdescent; 3317 if (c->descent < 2) c->underline_extend = 2 - c->descent;
3316 } 3318 }
3317 c->ln->line_no = c->line_no - c->ln->par->line_no; 3319 c->ln->line_no = c->line_no - c->ln->par->line_no;
3318 c->line_no++; 3320 c->line_no++;
3319 c->y += c->maxascent + c->maxdescent; 3321 c->y += c->ascent + c->descent;
3320 if (c->w >= 0) 3322 if (c->w >= 0)
3321 { 3323 {
3322 c->ln->x = c->marginl + c->o->style_pad.l + 3324 c->ln->x = c->marginl + c->o->style_pad.l +
@@ -4441,24 +4443,24 @@ _layout_par(Ctxt *c)
4441 4443
4442 if (it->type == EVAS_TEXTBLOCK_ITEM_TEXT) 4444 if (it->type == EVAS_TEXTBLOCK_ITEM_TEXT)
4443 { 4445 {
4444 _layout_item_ascent_descent_adjust(c->obj, &c->maxascent, 4446 _layout_item_ascent_descent_adjust(c->obj, &c->ascent,
4445 &c->maxdescent, it, c->position); 4447 &c->descent, it, c->position);
4446 } 4448 }
4447 else 4449 else
4448 { 4450 {
4449 Evas_Object_Textblock_Format_Item *fi = _ITEM_FORMAT(it); 4451 Evas_Object_Textblock_Format_Item *fi = _ITEM_FORMAT(it);
4450 if (fi->formatme) 4452 if (fi->formatme)
4451 { 4453 {
4452 prevdescent = c->maxdescent; 4454 prevdescent = c->descent;
4453 prevascent = c->maxascent; 4455 prevascent = c->ascent;
4454 /* If there are no text items yet, calc ascent/descent 4456 /* If there are no text items yet, calc ascent/descent
4455 * according to the current format. */ 4457 * according to the current format. */
4456 if (c->maxascent + c->maxdescent == 0) 4458 if (c->ascent + c->descent == 0)
4457 _layout_item_ascent_descent_adjust(c->obj, &c->maxascent, 4459 _layout_item_ascent_descent_adjust(c->obj, &c->ascent,
4458 &c->maxdescent, it, c->position); 4460 &c->descent, it, c->position);
4459 4461
4460 _layout_calculate_format_item_size(c->obj, fi, &c->maxascent, 4462 _layout_calculate_format_item_size(c->obj, fi, &c->ascent,
4461 &c->maxdescent, &fi->y, &fi->parent.w, &fi->parent.h); 4463 &c->descent, &fi->y, &fi->parent.w, &fi->parent.h);
4462 fi->parent.adv = fi->parent.w; 4464 fi->parent.adv = fi->parent.w;
4463 } 4465 }
4464 } 4466 }
@@ -4607,8 +4609,8 @@ _layout_par(Ctxt *c)
4607 4609
4608 /* We didn't end up using the item, so revert the ascent 4610 /* We didn't end up using the item, so revert the ascent
4609 * and descent changes. */ 4611 * and descent changes. */
4610 c->maxdescent = prevdescent; 4612 c->descent = prevdescent;
4611 c->maxascent = prevascent; 4613 c->ascent = prevascent;
4612 4614
4613 adv_line = 0; 4615 adv_line = 0;
4614 redo_item = 1; 4616 redo_item = 1;
@@ -4959,6 +4961,7 @@ _layout(const Evas_Object *eo_obj, int w, int h, int *w_ret, int *h_ret)
4959 c->w = w; 4961 c->w = w;
4960 c->h = h; 4962 c->h = h;
4961 c->wmax = c->hmax = 0; 4963 c->wmax = c->hmax = 0;
4964 c->ascent = c->descent = 0;
4962 c->maxascent = c->maxdescent = 0; 4965 c->maxascent = c->maxdescent = 0;
4963 c->marginl = c->marginr = 0; 4966 c->marginl = c->marginr = 0;
4964 c->have_underline = 0; 4967 c->have_underline = 0;