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', 'poly_blend.c', 'proxy_image.c', 'proxy_image_clipped.c', + 'proxy_textblock.c', 'proxy_text_fixed.c', 'proxy_text_random.c', '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 @@ +#undef FNAME +#undef NAME +#undef ICON + +/* metadata */ +#define FNAME proxy_textblock_start +#define NAME "Proxy Textblock" +#define ICON "text.png" + +#ifndef PROTO +# ifndef UI +# include "main.h" + +#undef OBNUM +#define OBNUM 1 + +/* standard var */ +static int done = 0; + +/* private data */ +static Evas_Object *o_texts[OBNUM * 3]; + +//uncomment to test vs plain textblock render perf +//#define PROXY_CMP 1 + +/* setup */ +static void _setup(void) +{ + int i; + Evas_Object *o, *clip, *proxy; + + for (i = 0; i < OBNUM * 4; i++) + { + o = efl_add(EFL_CANVAS_TEXT_CLASS, evas); + o_texts[i] = o; + efl_text_font_set(o, "Vera-Bold", 12); + efl_text_wrap_set(o, EFL_TEXT_FORMAT_WRAP_WORD); + efl_text_multiline_set(o, 1); + efl_text_set(o, + "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do " + "eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut " + "enim ad minim veniam, quis nostrud exercitation ullamco laboris " + "nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in " + "reprehenderit in voluptate velit esse cillum dolore eu fugiat " + "nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in " + "culpa qui officia deserunt mollit anim id est laborum." + ); + efl_text_normal_color_set(o, 0, 0, 0, 255); + efl_gfx_entity_size_set(o, EINA_SIZE2D(480, 160)); + efl_gfx_entity_visible_set(o, EINA_TRUE); + + i++; + clip = efl_add(EFL_CANVAS_RECTANGLE_CLASS, evas); + o_texts[i] = clip; + efl_canvas_object_clipper_set(o, clip); +#ifdef PROXY_CMP + efl_gfx_entity_size_set(clip, EINA_SIZE2D(480, 160)); +#else + efl_gfx_entity_size_set(clip, EINA_SIZE2D(480, 80)); +#endif + efl_gfx_entity_visible_set(clip, EINA_TRUE); + + i++; + proxy = efl_add(EFL_CANVAS_PROXY_CLASS, evas); + o_texts[i] = proxy; + efl_canvas_proxy_source_set(proxy, o); + efl_canvas_proxy_source_clip_set(proxy, EINA_FALSE); + /* only draw the lower half of the proxy object */ + efl_gfx_fill_set(proxy, EINA_RECT(0, 80, 480, 80)); + efl_gfx_entity_size_set(proxy, EINA_SIZE2D(480, 160)); +#ifdef PROXY_CMP + efl_gfx_entity_visible_set(proxy, EINA_FALSE); +#else + efl_gfx_entity_visible_set(proxy, EINA_TRUE); +#endif + + i++; + /* restrict the sampling of the source text to the lower half */ + clip = efl_add(EFL_CANVAS_RECTANGLE_CLASS, evas); + o_texts[i] = clip; + efl_canvas_object_clipper_set(proxy, clip); + efl_gfx_entity_size_set(clip, EINA_SIZE2D(480, 80)); +#ifdef PROXY_CMP + efl_gfx_entity_visible_set(clip, EINA_FALSE); +#else + efl_gfx_entity_visible_set(clip, EINA_TRUE); +#endif + } + done = 0; +} + +/* cleanup */ +static void _cleanup(void) +{ + int i; + for (i = 0; i < OBNUM * 4; i++) efl_del(o_texts[i]); +} + +/* loop - do things */ +static void _loop(double t, int f) +{ + int i; + Evas_Coord x, y, w, h; + for (i = 0; i < OBNUM * 4; i++) + { + w = 480; + h = 160; + x = (win_w / 2) - (w / 2); + x += sin((double)(f + (i * 13)) / (36.7 * SLOW)) * (w / 2); + y = (win_h / 2) - (h / 2); + y += cos((double)(f + (i * 28)) / (43.8 * SLOW)) * (h / 2); + efl_gfx_entity_position_set(o_texts[i], EINA_POSITION2D(x, y)); + i++; + efl_gfx_entity_position_set(o_texts[i], EINA_POSITION2D(x, y)); + i++; + efl_gfx_entity_position_set(o_texts[i], EINA_POSITION2D(x, y)); + i++; + efl_gfx_entity_position_set(o_texts[i], EINA_POSITION2D(x, y + (h / 2))); + } + 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 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 @@ #include "poly_blend.c" #include "proxy_image.c" #include "proxy_image_clipped.c" +#include "proxy_textblock.c" #include "proxy_text_fixed.c" #include "proxy_text_random.c" #include "line_blend.c"