cedric pushed a commit to branch master.

http://git.enlightenment.org/tools/expedite.git/commit/?id=dc6c931dc2e6c240d3e240f24578980c689ab7fc

commit dc6c931dc2e6c240d3e240f24578980c689ab7fc
Author: ali <[email protected]>
Date:   Sat Aug 10 11:33:18 2019 +0000

    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
---
 src/bin/Makefile.am                  |   1 +
 src/bin/meson.build                  |   1 +
 src/bin/tests.h                      |   1 +
 src/bin/textblock_text_fill_format.c | 116 +++++++++++++++++++++++++++++++++++
 4 files changed, 119 insertions(+)

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 \
 textblock_intl.c \
 textblock_auto_align.c \
 textblock_text_append.c \
+textblock_text_fill_format.c \
 rect_blend.c \
 rect_blend_pow2.c \
 rect_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',
        'textblock_intl.c',
        'textblock_auto_align.c',
        'textblock_text_append.c',
+       'textblock_text_fill_format.c',
        'rect_blend.c',
        'rect_blend_pow2.c',
        '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 @@
 #include "textblock_intl.c"
 #include "textblock_auto_align.c"
 #include "textblock_text_append.c"
+#include "textblock_text_fill_format.c"
 #include "rect_blend.c"
 #include "rect_blend_pow2.c"
 #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 @@
+#undef FNAME
+#undef NAME
+#undef ICON
+
+/* metadata */
+#define FNAME textblock_text_fill_format
+#define NAME "Textblock text_fill_format"
+#define ICON "text.png"
+
+#ifndef PROTO
+# ifndef UI
+#  include "main.h"
+
+/* standard var */
+static int done = 0;
+
+/* private data */
+static Evas_Object *o_text;
+static int sizes[] = {500, 600};
+Evas_Coord ll, rr, tt, bb;
+
+/* setup */
+static void _setup(void)
+{
+   Evas_Object *o;
+   Evas_Textblock_Style *st;
+
+   o = evas_object_textblock_add(evas);
+   o_text = o;
+   st = evas_textblock_style_new();
+   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'");
+   evas_object_textblock_style_set(o, st);
+   evas_object_textblock_clear(o);
+   evas_object_textblock_text_markup_set(o, "This test resize text block and 
keep style (style parsed only once)");
+
+   efl_gfx_entity_position_set(o, EINA_POSITION2D(0, 0)); \
+   efl_gfx_entity_size_set(o, EINA_SIZE2D(win_w, win_h)); \
+   efl_gfx_entity_visible_set(o, EINA_TRUE);
+
+   evas_textblock_style_free(st);
+
+   done = 0;
+}
+
+/* cleanup */
+static void _cleanup(void)
+{
+   efl_del(o_text);
+   o_text = NULL;
+}
+
+/* loop - do things */
+static void _loop(double t, int f)
+{
+   Evas_Coord x, y, w, h, w0, h0;
+   int i = 0;
+
+   w0 = 160;
+   h0 = 120;
+   w = 150 + ((1.0 + cos((double)(f + (i * 10)) / (37.4 * SLOW) )) * w0 * 2);
+   h = 50 + ((1.0 + sin((double)(f + (i * 19)) / (52.6 * SLOW) )) * h0 * 2);
+   x = (win_w / 2) - (w / 2);
+   x += sin((double)(f + (i * 13)) / (86.7 * SLOW)) * (w0 / 2);
+   y = (win_h / 2) - (h / 2);
+   y += cos((double)(f + (i * 28)) / (93.8 * SLOW)) * (h0 / 2);
+   efl_gfx_entity_position_set(o_text, EINA_POSITION2D(x, y));
+
+   for (i = 0; i < 10000; i++)
+     {
+        evas_object_resize(o_text, sizes[i%2], sizes[i%2]);
+        evas_object_textblock_style_insets_get((Efl_Canvas_Object*) o_text, 
&ll, &rr, &tt, &bb);
+     }
+   FPS_STD(NAME);
+}
+
+/* prepend special key handlers if interactive (before STD) */
+static void _key(const char *key)
+{
+   KEY_STD;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+/* template stuff - ignore */
+# endif
+#endif
+
+#ifdef UI
+_ui_menu_item_add(ICON, NAME, FNAME);
+#endif
+
+#ifdef PROTO
+void FNAME(void);
+#endif
+
+#ifndef PROTO
+# ifndef UI
+void FNAME(void)
+{
+   ui_func_set(_key, _loop);
+   _setup();
+}
+# endif
+#endif
+#undef FNAME
+#undef NAME
+#undef ICON

-- 


Reply via email to