Revert "Revert "Setup before starting fps measurement""
[platform/upstream/expedite.git] / src / bin / image_blend_occlude3_few.c
1 #undef FNAME
2 #undef NAME
3 #undef ICON
4
5 /* metadata */
6 #define FNAME image_blend_occlude3_few_start
7 #define NAME "Image Blend Occlude 3 Few"
8 #define ICON "blend.png"
9
10 #ifndef PROTO
11 # ifndef UI
12 #  include "main.h"
13
14 #undef OBNUM
15 #define OBNUM 32
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         o = efl_add(EFL_CANVAS_IMAGE_CLASS, evas);
31         o_images[i] = o;
32         if (i > (OBNUM / 2))
33           {
34              efl_file_simple_load(o, build_path("logo.png"), NULL);
35           }
36         else
37           {
38              Evas_Coord x, y;
39
40              x = (win_w / 4) + (((rnd() & 0xff) * ((win_w / 2) - 120)) >> 8);
41              y = (win_h / 4) + (((rnd() & 0xff) * ((win_h / 2) - 120)) >> 8);
42              efl_file_simple_load(o, build_path("image.png"), NULL);
43              efl_gfx_entity_position_set(o, EINA_POSITION2D(x, y));
44           }
45         efl_gfx_fill_set(o, EINA_RECT(0, 0, 120, 160));
46         efl_gfx_entity_size_set(o, EINA_SIZE2D(120, 160));
47         efl_gfx_entity_visible_set(o, EINA_TRUE);
48      }
49    done = 0;
50 }
51
52 /* cleanup */
53 static void _cleanup(void)
54 {
55    int i;
56    for (i = 0; i < OBNUM; i++) efl_del(o_images[i]);
57 }
58
59 /* loop - do things */
60 static void _loop(double t, int f)
61 {
62    static int k = 0;
63    int i;
64    Evas_Coord x, y, w, h;
65    for (i = 0; i < OBNUM; i++)
66      {
67         if (i < (OBNUM / 2))
68           {
69              w = 120;
70              h = 160;
71              x = (win_w / 2) - (w / 2);
72              x += sin((double)(f + ((i + k) * 13)) / (36.7 * SLOW)) * (w / 2);
73              y = (win_h / 2) - (h / 2);
74              y += cos((double)(f + ((i + k) * 28)) / (43.8 * SLOW)) * (h / 2);
75              efl_gfx_entity_position_set(o_images[i], EINA_POSITION2D(x, y));
76           }
77      }
78    ++k;
79    FPS_STD(NAME);
80 }
81
82 /* prepend special key handlers if interactive (before STD) */
83 static void _key(const char *key)
84 {
85    KEY_STD;
86 }
87
88
89
90
91
92
93
94
95
96
97
98
99 /* template stuff - ignore */
100 # endif
101 #endif
102
103 #ifdef UI
104 _ui_menu_item_add(ICON, NAME, FNAME);
105 #endif
106
107 #ifdef PROTO
108 void FNAME(void);
109 #endif
110
111 #ifndef PROTO
112 # ifndef UI
113 void FNAME(void)
114 {
115    _setup();
116    ui_func_set(_key, _loop);
117 }
118 # endif
119 #endif
120 #undef FNAME
121 #undef NAME
122 #undef ICON