containing ui setup steps in the profiling again.
[platform/upstream/expedite.git] / src / bin / image_map_nearest_solid_rotate.c
1 #undef FNAME
2 #undef NAME
3 #undef ICON
4
5 /* metadata */
6 #define FNAME image_map_nearest_solid_rotate_start
7 #define NAME "Image Map Nearest 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_image_smooth_scale_set(o, 0);
33         efl_gfx_entity_visible_set(o, EINA_TRUE);
34      }
35    done = 0;
36 }
37
38 /* cleanup */
39 static void _cleanup(void)
40 {
41    int i;
42    for (i = 0; i < (OBNUM / 2); i++) efl_del(o_images[i]);
43 }
44
45 /* loop - do things */
46 static void _loop(double t, int f)
47 {
48    int i;
49    static Evas_Map *m = NULL;
50    Evas_Coord x, y, w, h;
51    if (!m) m = evas_map_new(4);
52    evas_map_smooth_set(m, 0);
53    for (i = 0; i < (OBNUM / 2); i++)
54      {
55         w = 120;
56         h = 160;
57         x = (win_w / 2) - (w / 2);
58         x += sin((double)(f + (i * 13)) / (36.7 * SLOW)) * (w / 2);
59         y = (win_h / 2) - (h / 2);
60         y += cos((double)(f + (i * 28)) / (43.8 * SLOW)) * (h / 2);
61
62         evas_map_util_points_populate_from_geometry(m, x, y, w, h, 0);
63
64         evas_map_util_rotate(m, f, x + (w / 2), y + (h / 2));
65
66         evas_object_map_enable_set(o_images[i], 1);
67         evas_object_map_set(o_images[i], m);
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    ui_func_set(_key, _loop, _setup);
106 }
107 # endif
108 #endif
109 #undef FNAME
110 #undef NAME
111 #undef ICON