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