summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2019-05-13 07:57:08 -0400
committerMike Blumenkrantz <zmike@samsung.com>2019-05-13 07:57:08 -0400
commit735ca81d6ba225d7194ba16bd51a1faf7fe3afa4 (patch)
treeed12026b5c4f07d7e3cba4c660ca93ae47b3cd35
parent37093983bfd55022f5757eb70ff929cd4701d3d3 (diff)
add a clipped textblock proxy test
Summary: this renders a classic text passage split in twain between a real textblock and a proxy render of the textblock to mimic rendering only a textblock also provides a define for easily testing against raw textblock render perf Depends on D8877 Reviewers: cedric, Hermet Reviewed By: Hermet Subscribers: Hermet Tags: #expedite Differential Revision: https://phab.enlightenment.org/D8878
-rw-r--r--src/bin/meson.build1
-rw-r--r--src/bin/proxy_textblock.c163
-rw-r--r--src/bin/tests.h1
3 files changed, 165 insertions, 0 deletions
diff --git a/src/bin/meson.build b/src/bin/meson.build
index b8abc11..73a4724 100644
--- a/src/bin/meson.build
+++ b/src/bin/meson.build
@@ -95,6 +95,7 @@ expedite_sources = [ 'main.c',
95 'poly_blend.c', 95 'poly_blend.c',
96 'proxy_image.c', 96 'proxy_image.c',
97 'proxy_image_clipped.c', 97 'proxy_image_clipped.c',
98 'proxy_textblock.c',
98 'proxy_text_fixed.c', 99 'proxy_text_fixed.c',
99 'proxy_text_random.c', 100 'proxy_text_random.c',
100 'line_blend.c', 101 'line_blend.c',
diff --git a/src/bin/proxy_textblock.c b/src/bin/proxy_textblock.c
new file mode 100644
index 0000000..af2c644
--- /dev/null
+++ b/src/bin/proxy_textblock.c
@@ -0,0 +1,163 @@
1#undef FNAME
2#undef NAME
3#undef ICON
4
5/* metadata */
6#define FNAME proxy_textblock_start
7#define NAME "Proxy Textblock"
8#define ICON "text.png"
9
10#ifndef PROTO
11# ifndef UI
12# include "main.h"
13
14#undef OBNUM
15#define OBNUM 1
16
17/* standard var */
18static int done = 0;
19
20/* private data */
21static Evas_Object *o_texts[OBNUM * 3];
22
23//uncomment to test vs plain textblock render perf
24//#define PROXY_CMP 1
25
26/* setup */
27static void _setup(void)
28{
29 int i;
30 Evas_Object *o, *clip, *proxy;
31
32 for (i = 0; i < OBNUM * 4; i++)
33 {
34 o = efl_add(EFL_CANVAS_TEXT_CLASS, evas);
35 o_texts[i] = o;
36 efl_text_font_set(o, "Vera-Bold", 12);
37 efl_text_wrap_set(o, EFL_TEXT_FORMAT_WRAP_WORD);
38 efl_text_multiline_set(o, 1);
39 efl_text_set(o,
40 "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do "
41 "eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut "
42 "enim ad minim veniam, quis nostrud exercitation ullamco laboris "
43 "nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in "
44 "reprehenderit in voluptate velit esse cillum dolore eu fugiat "
45 "nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in "
46 "culpa qui officia deserunt mollit anim id est laborum."
47 );
48 efl_text_normal_color_set(o, 0, 0, 0, 255);
49 efl_gfx_entity_size_set(o, EINA_SIZE2D(480, 160));
50 efl_gfx_entity_visible_set(o, EINA_TRUE);
51
52 i++;
53 clip = efl_add(EFL_CANVAS_RECTANGLE_CLASS, evas);
54 o_texts[i] = clip;
55 efl_canvas_object_clipper_set(o, clip);
56#ifdef PROXY_CMP
57 efl_gfx_entity_size_set(clip, EINA_SIZE2D(480, 160));
58#else
59 efl_gfx_entity_size_set(clip, EINA_SIZE2D(480, 80));
60#endif
61 efl_gfx_entity_visible_set(clip, EINA_TRUE);
62
63 i++;
64 proxy = efl_add(EFL_CANVAS_PROXY_CLASS, evas);
65 o_texts[i] = proxy;
66 efl_canvas_proxy_source_set(proxy, o);
67 efl_canvas_proxy_source_clip_set(proxy, EINA_FALSE);
68 /* only draw the lower half of the proxy object */
69 efl_gfx_fill_set(proxy, EINA_RECT(0, 80, 480, 80));
70 efl_gfx_entity_size_set(proxy, EINA_SIZE2D(480, 160));
71#ifdef PROXY_CMP
72 efl_gfx_entity_visible_set(proxy, EINA_FALSE);
73#else
74 efl_gfx_entity_visible_set(proxy, EINA_TRUE);
75#endif
76
77 i++;
78 /* restrict the sampling of the source text to the lower half */
79 clip = efl_add(EFL_CANVAS_RECTANGLE_CLASS, evas);
80 o_texts[i] = clip;
81 efl_canvas_object_clipper_set(proxy, clip);
82 efl_gfx_entity_size_set(clip, EINA_SIZE2D(480, 80));
83#ifdef PROXY_CMP
84 efl_gfx_entity_visible_set(clip, EINA_FALSE);
85#else
86 efl_gfx_entity_visible_set(clip, EINA_TRUE);
87#endif
88 }
89 done = 0;
90}
91
92/* cleanup */
93static void _cleanup(void)
94{
95 int i;
96 for (i = 0; i < OBNUM * 4; i++) efl_del(o_texts[i]);
97}
98
99/* loop - do things */
100static void _loop(double t, int f)
101{
102 int i;
103 Evas_Coord x, y, w, h;
104 for (i = 0; i < OBNUM * 4; i++)
105 {
106 w = 480;
107 h = 160;
108 x = (win_w / 2) - (w / 2);
109 x += sin((double)(f + (i * 13)) / (36.7 * SLOW)) * (w / 2);
110 y = (win_h / 2) - (h / 2);
111 y += cos((double)(f + (i * 28)) / (43.8 * SLOW)) * (h / 2);
112 efl_gfx_entity_position_set(o_texts[i], EINA_POSITION2D(x, y));
113 i++;
114 efl_gfx_entity_position_set(o_texts[i], EINA_POSITION2D(x, y));
115 i++;
116 efl_gfx_entity_position_set(o_texts[i], EINA_POSITION2D(x, y));
117 i++;
118 efl_gfx_entity_position_set(o_texts[i], EINA_POSITION2D(x, y + (h / 2)));
119 }
120 FPS_STD(NAME);
121}
122
123/* prepend special key handlers if interactive (before STD) */
124static void _key(const char *key)
125{
126 KEY_STD;
127}
128
129
130
131
132
133
134
135
136
137
138
139
140/* template stuff - ignore */
141# endif
142#endif
143
144#ifdef UI
145_ui_menu_item_add(ICON, NAME, FNAME);
146#endif
147
148#ifdef PROTO
149void FNAME(void);
150#endif
151
152#ifndef PROTO
153# ifndef UI
154void FNAME(void)
155{
156 ui_func_set(_key, _loop);
157 _setup();
158}
159# endif
160#endif
161#undef FNAME
162#undef NAME
163#undef ICON
diff --git a/src/bin/tests.h b/src/bin/tests.h
index dc58148..18833de 100644
--- a/src/bin/tests.h
+++ b/src/bin/tests.h
@@ -88,6 +88,7 @@
88#include "poly_blend.c" 88#include "poly_blend.c"
89#include "proxy_image.c" 89#include "proxy_image.c"
90#include "proxy_image_clipped.c" 90#include "proxy_image_clipped.c"
91#include "proxy_textblock.c"
91#include "proxy_text_fixed.c" 92#include "proxy_text_fixed.c"
92#include "proxy_text_random.c" 93#include "proxy_text_random.c"
93#include "line_blend.c" 94#include "line_blend.c"