summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorali <ali198724@gmail.com>2019-08-10 11:33:18 +0000
committerCedric BAIL <cedric@ddlm.me>2019-08-12 10:12:00 -0700
commitdc6c931dc2e6c240d3e240f24578980c689ab7fc (patch)
tree65cb8f7d8ebbb7152fcbae6818deb6c71fb5758f
parent4e6dd92826dc4200953f507645eeb00b065774ed (diff)
evas_textblock: add test for parsing styles time (fill_format)
speed test for setting parsing formats during layot_setup stage this is related to D9536 Differential Revision: https://phab.enlightenment.org/D9541
-rw-r--r--src/bin/Makefile.am1
-rw-r--r--src/bin/meson.build1
-rw-r--r--src/bin/tests.h1
-rw-r--r--src/bin/textblock_text_fill_format.c116
4 files changed, 119 insertions, 0 deletions
diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am
index 754b8ab..046aad3 100644
--- a/src/bin/Makefile.am
+++ b/src/bin/Makefile.am
@@ -86,6 +86,7 @@ textblock_basic.c \
86textblock_intl.c \ 86textblock_intl.c \
87textblock_auto_align.c \ 87textblock_auto_align.c \
88textblock_text_append.c \ 88textblock_text_append.c \
89textblock_text_fill_format.c \
89rect_blend.c \ 90rect_blend.c \
90rect_blend_pow2.c \ 91rect_blend_pow2.c \
91rect_solid.c \ 92rect_solid.c \
diff --git a/src/bin/meson.build b/src/bin/meson.build
index b68f600..03c60b4 100644
--- a/src/bin/meson.build
+++ b/src/bin/meson.build
@@ -76,6 +76,7 @@ expedite_sources = [ 'main.c',
76 'textblock_intl.c', 76 'textblock_intl.c',
77 'textblock_auto_align.c', 77 'textblock_auto_align.c',
78 'textblock_text_append.c', 78 'textblock_text_append.c',
79 'textblock_text_fill_format.c',
79 'rect_blend.c', 80 'rect_blend.c',
80 'rect_blend_pow2.c', 81 'rect_blend_pow2.c',
81 'rect_solid.c', 82 'rect_solid.c',
diff --git a/src/bin/tests.h b/src/bin/tests.h
index a3fdb1c..3308836 100644
--- a/src/bin/tests.h
+++ b/src/bin/tests.h
@@ -69,6 +69,7 @@
69#include "textblock_intl.c" 69#include "textblock_intl.c"
70#include "textblock_auto_align.c" 70#include "textblock_auto_align.c"
71#include "textblock_text_append.c" 71#include "textblock_text_append.c"
72#include "textblock_text_fill_format.c"
72#include "rect_blend.c" 73#include "rect_blend.c"
73#include "rect_blend_pow2.c" 74#include "rect_blend_pow2.c"
74#include "rect_solid.c" 75#include "rect_solid.c"
diff --git a/src/bin/textblock_text_fill_format.c b/src/bin/textblock_text_fill_format.c
new file mode 100644
index 0000000..278a4d4
--- /dev/null
+++ b/src/bin/textblock_text_fill_format.c
@@ -0,0 +1,116 @@
1#undef FNAME
2#undef NAME
3#undef ICON
4
5/* metadata */
6#define FNAME textblock_text_fill_format
7#define NAME "Textblock text_fill_format"
8#define ICON "text.png"
9
10#ifndef PROTO
11# ifndef UI
12# include "main.h"
13
14/* standard var */
15static int done = 0;
16
17/* private data */
18static Evas_Object *o_text;
19static int sizes[] = {500, 600};
20Evas_Coord ll, rr, tt, bb;
21
22/* setup */
23static void _setup(void)
24{
25 Evas_Object *o;
26 Evas_Textblock_Style *st;
27
28 o = evas_object_textblock_add(evas);
29 o_text = o;
30 st = evas_textblock_style_new();
31 evas_textblock_style_set (st, "DEFAULT='font=Sans font_size=10 color=#000000 wrap=word align=left outline_color=#000 shadow_color=#fff8 shadow_color=#0002 glow2_color=#fe87 glow_color=#f214 underline_color=#00f linesize=40'");
32 evas_object_textblock_style_set(o, st);
33 evas_object_textblock_clear(o);
34 evas_object_textblock_text_markup_set(o, "This test resize text block and keep style (style parsed only once)");
35
36 efl_gfx_entity_position_set(o, EINA_POSITION2D(0, 0)); \
37 efl_gfx_entity_size_set(o, EINA_SIZE2D(win_w, win_h)); \
38 efl_gfx_entity_visible_set(o, EINA_TRUE);
39
40 evas_textblock_style_free(st);
41
42 done = 0;
43}
44
45/* cleanup */
46static void _cleanup(void)
47{
48 efl_del(o_text);
49 o_text = NULL;
50}
51
52/* loop - do things */
53static void _loop(double t, int f)
54{
55 Evas_Coord x, y, w, h, w0, h0;
56 int i = 0;
57
58 w0 = 160;
59 h0 = 120;
60 w = 150 + ((1.0 + cos((double)(f + (i * 10)) / (37.4 * SLOW) )) * w0 * 2);
61 h = 50 + ((1.0 + sin((double)(f + (i * 19)) / (52.6 * SLOW) )) * h0 * 2);
62 x = (win_w / 2) - (w / 2);
63 x += sin((double)(f + (i * 13)) / (86.7 * SLOW)) * (w0 / 2);
64 y = (win_h / 2) - (h / 2);
65 y += cos((double)(f + (i * 28)) / (93.8 * SLOW)) * (h0 / 2);
66 efl_gfx_entity_position_set(o_text, EINA_POSITION2D(x, y));
67
68 for (i = 0; i < 10000; i++)
69 {
70 evas_object_resize(o_text, sizes[i%2], sizes[i%2]);
71 evas_object_textblock_style_insets_get((Efl_Canvas_Object*) o_text, &ll, &rr, &tt, &bb);
72 }
73 FPS_STD(NAME);
74}
75
76/* prepend special key handlers if interactive (before STD) */
77static void _key(const char *key)
78{
79 KEY_STD;
80}
81
82
83
84
85
86
87
88
89
90
91
92
93/* template stuff - ignore */
94# endif
95#endif
96
97#ifdef UI
98_ui_menu_item_add(ICON, NAME, FNAME);
99#endif
100
101#ifdef PROTO
102void FNAME(void);
103#endif
104
105#ifndef PROTO
106# ifndef UI
107void FNAME(void)
108{
109 ui_func_set(_key, _loop);
110 _setup();
111}
112# endif
113#endif
114#undef FNAME
115#undef NAME
116#undef ICON