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