Revert "Revert "Setup before starting fps measurement""
[platform/upstream/expedite.git] / src / bin / rect_blend_few.c
1 #undef FNAME
2 #undef NAME
3 #undef ICON
4
5 /* metadata */
6 #define FNAME rect_blend_few_start
7 #define NAME "Rect Blend Few"
8 #define ICON "rect.png"
9
10 #ifndef PROTO
11 # ifndef UI
12 #  include "main.h"
13
14 #undef OBNUM
15 #define OBNUM 3
16
17 /* standard var */
18 static int done = 0;
19 /* private data */
20 static Evas_Object *o_images[OBNUM];
21
22 /* setup */
23 static void _setup(void)
24 {
25    int i;
26    Evas_Object *o;
27    srnd();
28    for (i = 0; i < OBNUM; i++)
29      {
30         int r, g, b, a;
31
32         o = efl_add(EFL_CANVAS_RECTANGLE_CLASS, evas);
33         o_images[i] = o;
34         a = rnd()&0xff;
35         r = ((rnd()&0xff) * a) / 255;
36         g = ((rnd()&0xff) * a) / 255;
37         b = ((rnd()&0xff) * a) / 255;
38         efl_gfx_color_set(o, r, g, b, a);
39         efl_gfx_entity_visible_set(o, EINA_TRUE);
40      }
41    done = 0;
42 }
43
44 /* cleanup */
45 static void _cleanup(void)
46 {
47    int i;
48    for (i = 0; i < OBNUM; i++) efl_del(o_images[i]);
49 }
50
51 /* loop - do things */
52 static void _loop(double t, int f)
53 {
54    int i;
55    Evas_Coord x, y, w, h, w0, h0;
56    for (i = 0; i < OBNUM; i++)
57      {
58         w0 = 80;
59         h0 = 80;
60         w = 5 + ((1.0 + cos((double)(f + (i * 10)) / (7.4 * SLOW) )) * w0 * 2);
61         h = 5 + ((1.0 + sin((double)(f + (i * 19)) / (12.6 * SLOW) )) * h0 * 2);
62         x = (win_w / 2) - (w / 2);
63         x += sin((double)(f + (i * 113)) / (36.7 * SLOW)) * (w0 / 2);
64         y = (win_h / 2) - (h / 2);
65         y += cos((double)(f + (i * 228)) / (43.8 * SLOW)) * (h0 / 2);
66         efl_gfx_entity_position_set(o_images[i], EINA_POSITION2D(x, y));
67         efl_gfx_entity_size_set(o_images[i], EINA_SIZE2D(w, h));
68      }
69    FPS_STD(NAME);
70 }
71
72 /* prepend special key handlers if interactive (before STD) */
73 static void _key(const char *key)
74 {
75    KEY_STD;
76 }
77
78
79
80
81
82
83
84
85
86
87
88
89 /* template stuff - ignore */
90 # endif
91 #endif
92
93 #ifdef UI
94 _ui_menu_item_add(ICON, NAME, FNAME);
95 #endif
96
97 #ifdef PROTO
98 void FNAME(void);
99 #endif
100
101 #ifndef PROTO
102 # ifndef UI
103 void FNAME(void)
104 {
105    _setup();
106    ui_func_set(_key, _loop);
107 }
108 # endif
109 #endif
110 #undef FNAME
111 #undef NAME
112 #undef ICON