summaryrefslogtreecommitdiff
path: root/legacy/edje/src/lib/edje_text.c
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2012-09-11 13:14:51 +0000
committerCarsten Haitzler <raster@rasterman.com>2012-09-11 13:14:51 +0000
commita00b9084eadd3d21a7629710876d600692257234 (patch)
tree2153676c407154620e6c48c5bc38ea123b68331d /legacy/edje/src/lib/edje_text.c
parent2ad877574e44ca90d620664649d991b287ce8b50 (diff)
use less memory at runtime with real part structs. actual savings are
about 25%. SVN revision: 76460
Diffstat (limited to 'legacy/edje/src/lib/edje_text.c')
-rw-r--r--legacy/edje/src/lib/edje_text.c88
1 files changed, 45 insertions, 43 deletions
diff --git a/legacy/edje/src/lib/edje_text.c b/legacy/edje/src/lib/edje_text.c
index 8d81159..700154c 100644
--- a/legacy/edje/src/lib/edje_text.c
+++ b/legacy/edje/src/lib/edje_text.c
@@ -346,27 +346,29 @@ _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep,
346 int inlined_font = 0, free_text = 0; 346 int inlined_font = 0, free_text = 0;
347 Eina_Bool same_text = EINA_FALSE; 347 Eina_Bool same_text = EINA_FALSE;
348 FLOAT_T sc; 348 FLOAT_T sc;
349 349
350 if ((ep->type != EDJE_RP_TYPE_TEXT) ||
351 (!ep->typedata.text)) return;
350 sc = ed->scale; 352 sc = ed->scale;
351 if (sc == 0.0) sc = _edje_scale; 353 if (sc == 0.0) sc = _edje_scale;
352 text = edje_string_get(&chosen_desc->text.text); 354 text = edje_string_get(&chosen_desc->text.text);
353 font = _edje_text_class_font_get(ed, chosen_desc, &size, &sfont); 355 font = _edje_text_class_font_get(ed, chosen_desc, &size, &sfont);
354 356
355 if (ep->text.text) text = ep->text.text; 357 if (ep->typedata.text->text) text = ep->typedata.text->text;
356 if (ep->text.font) font = ep->text.font; 358 if (ep->typedata.text->font) font = ep->typedata.text->font;
357 if (ep->text.size > 0) size = ep->text.size; 359 if (ep->typedata.text->size > 0) size = ep->typedata.text->size;
358 360
359 if (ep->text.text_source) 361 if (ep->typedata.text->text_source)
360 { 362 {
361 text = edje_string_get(&(((Edje_Part_Description_Text *)ep->text.text_source->chosen_description)->text.text)); 363 text = edje_string_get(&(((Edje_Part_Description_Text *)ep->typedata.text->text_source->chosen_description)->text.text));
362 if (ep->text.text_source->text.text) text = ep->text.text_source->text.text; 364 if (ep->typedata.text->text_source->typedata.text->text) text = ep->typedata.text->text_source->typedata.text->text;
363 } 365 }
364 if (ep->text.source) 366 if (ep->typedata.text->source)
365 { 367 {
366 font = edje_string_get(&(((Edje_Part_Description_Text *)ep->text.source->chosen_description)->text.font)); 368 font = edje_string_get(&(((Edje_Part_Description_Text *)ep->typedata.text->source->chosen_description)->text.font));
367 size = ((Edje_Part_Description_Text *)ep->text.source->chosen_description)->text.size; 369 size = ((Edje_Part_Description_Text *)ep->typedata.text->source->chosen_description)->text.size;
368 if (ep->text.source->text.font) font = ep->text.source->text.font; 370 if (ep->typedata.text->source->typedata.text->font) font = ep->typedata.text->source->typedata.text->font;
369 if (ep->text.source->text.size > 0) size = ep->text.source->text.size; 371 if (ep->typedata.text->source->typedata.text->size > 0) size = ep->typedata.text->source->typedata.text->size;
370 } 372 }
371 373
372 if (!text) text = ""; 374 if (!text) text = "";
@@ -410,35 +412,35 @@ _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep,
410 size = params->type.text.size; 412 size = params->type.text.size;
411 if (!text) text = ""; 413 if (!text) text = "";
412 414
413 if ((text == ep->text.cache.in_str) 415 if ((text == ep->typedata.text->cache.in_str)
414 || (text && ep->text.cache.in_str && !strcmp(ep->text.cache.in_str, text))) 416 || (text && ep->typedata.text->cache.in_str && !strcmp(ep->typedata.text->cache.in_str, text)))
415 { 417 {
416 text = ep->text.cache.in_str; 418 text = ep->typedata.text->cache.in_str;
417 same_text = EINA_TRUE; 419 same_text = EINA_TRUE;
418 } 420 }
419 421
420 if ((ep->text.cache.in_size == size) && 422 if ((ep->typedata.text->cache.in_size == size) &&
421 (ep->text.cache.in_w == sw) && 423 (ep->typedata.text->cache.in_w == sw) &&
422 (ep->text.cache.in_h == sh) && 424 (ep->typedata.text->cache.in_h == sh) &&
423 (ep->text.cache.in_str) && 425 (ep->typedata.text->cache.in_str) &&
424 same_text && 426 same_text &&
425 (ep->text.cache.align_x == params->type.text.align.x) && 427 (ep->typedata.text->cache.align_x == params->type.text.align.x) &&
426 (ep->text.cache.align_y == params->type.text.align.y) && 428 (ep->typedata.text->cache.align_y == params->type.text.align.y) &&
427 (ep->text.cache.elipsis == params->type.text.elipsis) && 429 (ep->typedata.text->cache.elipsis == params->type.text.elipsis) &&
428 (ep->text.cache.fit_x == chosen_desc->text.fit_x) && 430 (ep->typedata.text->cache.fit_x == chosen_desc->text.fit_x) &&
429 (ep->text.cache.fit_y == chosen_desc->text.fit_y)) 431 (ep->typedata.text->cache.fit_y == chosen_desc->text.fit_y))
430 { 432 {
431 text = ep->text.cache.out_str; 433 text = ep->typedata.text->cache.out_str;
432 size = ep->text.cache.out_size; 434 size = ep->typedata.text->cache.out_size;
433 435
434 goto arrange_text; 436 goto arrange_text;
435 } 437 }
436 if (!same_text) 438 if (!same_text)
437 { 439 {
438 eina_stringshare_replace(&ep->text.cache.in_str, text); 440 eina_stringshare_replace(&ep->typedata.text->cache.in_str, text);
439 } 441 }
440 ep->text.cache.in_size = size; 442 ep->typedata.text->cache.in_size = size;
441 if (chosen_desc->text.fit_x && (ep->text.cache.in_str && eina_stringshare_strlen(ep->text.cache.in_str) > 0)) 443 if (chosen_desc->text.fit_x && (ep->typedata.text->cache.in_str && eina_stringshare_strlen(ep->typedata.text->cache.in_str) > 0))
442 { 444 {
443 if (inlined_font) evas_object_text_font_source_set(ep->object, ed->path); 445 if (inlined_font) evas_object_text_font_source_set(ep->object, ed->path);
444 else evas_object_text_font_source_set(ep->object, NULL); 446 else evas_object_text_font_source_set(ep->object, NULL);
@@ -464,7 +466,7 @@ _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep,
464 * but it's still way better than what was here before. */ 466 * but it's still way better than what was here before. */
465 if (tw > sw) size--; 467 if (tw > sw) size--;
466 } 468 }
467 if (chosen_desc->text.fit_y && (ep->text.cache.in_str && eina_stringshare_strlen(ep->text.cache.in_str) > 0)) 469 if (chosen_desc->text.fit_y && (ep->typedata.text->cache.in_str && eina_stringshare_strlen(ep->typedata.text->cache.in_str) > 0))
468 { 470 {
469 /* if we fit in the x axis, too, size already has a somewhat 471 /* if we fit in the x axis, too, size already has a somewhat
470 * meaningful value, so don't overwrite it with the starting 472 * meaningful value, so don't overwrite it with the starting
@@ -567,15 +569,15 @@ _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep,
567 text = _edje_text_fit_x(ed, ep, params, text, font, size, sw, &free_text); 569 text = _edje_text_fit_x(ed, ep, params, text, font, size, sw, &free_text);
568 } 570 }
569 571
570 eina_stringshare_replace(&ep->text.cache.out_str, text); 572 eina_stringshare_replace(&ep->typedata.text->cache.out_str, text);
571 ep->text.cache.in_w = sw; 573 ep->typedata.text->cache.in_w = sw;
572 ep->text.cache.in_h = sh; 574 ep->typedata.text->cache.in_h = sh;
573 ep->text.cache.out_size = size; 575 ep->typedata.text->cache.out_size = size;
574 ep->text.cache.align_x = params->type.text.align.x; 576 ep->typedata.text->cache.align_x = params->type.text.align.x;
575 ep->text.cache.align_y = params->type.text.align.y; 577 ep->typedata.text->cache.align_y = params->type.text.align.y;
576 ep->text.cache.elipsis = params->type.text.elipsis; 578 ep->typedata.text->cache.elipsis = params->type.text.elipsis;
577 ep->text.cache.fit_x = chosen_desc->text.fit_x; 579 ep->typedata.text->cache.fit_x = chosen_desc->text.fit_x;
578 ep->text.cache.fit_y = chosen_desc->text.fit_y; 580 ep->typedata.text->cache.fit_y = chosen_desc->text.fit_y;
579 arrange_text: 581 arrange_text:
580 582
581 if (inlined_font) evas_object_text_font_source_set(ep->object, ed->path); 583 if (inlined_font) evas_object_text_font_source_set(ep->object, ed->path);
@@ -604,13 +606,13 @@ _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep,
604 { 606 {
605 align_x = params->type.text.align.x; 607 align_x = params->type.text.align.x;
606 } 608 }
607 ep->text.offset.x = TO_INT(SCALE(align_x, (sw - tw))); 609 ep->typedata.text->offset.x = TO_INT(SCALE(align_x, (sw - tw)));
608 ep->text.offset.y = TO_INT(SCALE(params->type.text.align.y, (sh - th))); 610 ep->typedata.text->offset.y = TO_INT(SCALE(params->type.text.align.y, (sh - th)));
609 } 611 }
610 612
611 evas_object_move(ep->object, 613 evas_object_move(ep->object,
612 ed->x + params->x + ep->text.offset.x, 614 ed->x + params->x + ep->typedata.text->offset.x,
613 ed->y + params->y + ep->text.offset.y); 615 ed->y + params->y + ep->typedata.text->offset.y);
614 616
615 if (params->visible) evas_object_show(ep->object); 617 if (params->visible) evas_object_show(ep->object);
616 else evas_object_hide(ep->object); 618 else evas_object_hide(ep->object);