summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYakov Goldberg <yakov.g@samsung.com>2015-06-30 11:30:36 +0300
committerYakov Goldberg <yakov.g@samsung.com>2015-06-30 11:44:28 +0300
commit3ce8b3f1451700f9a2da60c2e717c644220e2449 (patch)
treedf4f7bfad4bf923974f20bde3c486b5de07630ad
parentcc4fa8a76ea2ea230964516993f87ec3edbda9c3 (diff)
vector: add a basic circle testdevs/cedric/efl-1.15
Separate test for circle was added because results are quite different for shapes/backends For Cairo backend: rect == 0.72, circle = 0.32 -> 125% slower For Freetype backend: rect == 2.81, circle = 2.26 -> 24% slower
-rw-r--r--src/bin/Makefile.am1
-rw-r--r--src/bin/tests.h1
-rw-r--r--src/bin/vg_basic_circle.c116
3 files changed, 118 insertions, 0 deletions
diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am
index 25a7847..d37babc 100644
--- a/src/bin/Makefile.am
+++ b/src/bin/Makefile.am
@@ -126,6 +126,7 @@ image_mask_11.c \
126image_mask_12.c \ 126image_mask_12.c \
127image_mask_13.c \ 127image_mask_13.c \
128vg_basic_rect.c \ 128vg_basic_rect.c \
129vg_basic_circle.c \
129vg_basic_gradient.c \ 130vg_basic_gradient.c \
130vg_scaled.c 131vg_scaled.c
131# \ 132# \
diff --git a/src/bin/tests.h b/src/bin/tests.h
index c7894bc..0724ee3 100644
--- a/src/bin/tests.h
+++ b/src/bin/tests.h
@@ -107,6 +107,7 @@
107#include "image_mask_12.c" 107#include "image_mask_12.c"
108#include "image_mask_13.c" 108#include "image_mask_13.c"
109#include "vg_basic_rect.c" 109#include "vg_basic_rect.c"
110#include "vg_basic_circle.c"
110#include "vg_basic_gradient.c" 111#include "vg_basic_gradient.c"
111#include "vg_scaled.c" 112#include "vg_scaled.c"
112#if 0 // test disabled - evas having code disabled 113#if 0 // test disabled - evas having code disabled
diff --git a/src/bin/vg_basic_circle.c b/src/bin/vg_basic_circle.c
new file mode 100644
index 0000000..ea8bd25
--- /dev/null
+++ b/src/bin/vg_basic_circle.c
@@ -0,0 +1,116 @@
1#undef FNAME
2#undef NAME
3#undef ICON
4
5/* metadata */
6#define FNAME vg_basic_circle_start
7#define NAME "VG Basic Circle"
8#define ICON "vector.png"
9
10#ifndef PROTO
11# ifndef UI
12# include "main.h"
13
14/* standard var */
15static int done = 0;
16
17/* private data */
18static Eo *o_shapes[OBNUM];
19
20/* setup
21 * Creating Evas Objects, each holds a vector shape.
22 * Then start moving these Evas Objects. */
23static void _setup(void)
24{
25 unsigned int i;
26
27 for (i = 0; i < OBNUM; i++)
28 {
29 Efl_VG *root, *circle;
30 Eo *vector;
31 double r = 35, stroke_w = 3;
32
33 vector = eo_add(EVAS_VG_CLASS, evas);
34 o_shapes[i] = vector;
35 eo_do(vector,
36 efl_gfx_size_set(r * 2 + stroke_w * 2, r * 2 + stroke_w * 2),
37 efl_gfx_position_set(0, 0),
38 efl_gfx_visible_set(EINA_TRUE));
39
40 eo_do(vector, root = evas_obj_vg_root_node_get());
41
42 circle = eo_add(EFL_VG_SHAPE_CLASS, root);
43 eo_do(circle,
44 efl_gfx_shape_append_circle(r + stroke_w, r + stroke_w, r),
45 efl_gfx_shape_stroke_width_set(stroke_w),
46 efl_gfx_shape_stroke_color_set(128, 0, 128, 128),
47 efl_gfx_shape_stroke_join_set(EFL_GFX_JOIN_ROUND));
48 }
49 done = 0;
50}
51
52/* cleanup */
53static void _cleanup(void)
54{
55 unsigned int i;
56
57 for (i = 0; i < OBNUM; i++) eo_del(o_shapes[i]);
58}
59
60/* loop - do things */
61static void _loop(double t, int f)
62{
63 int i;
64 Evas_Coord x, y, w = 200, h = 200;
65 for (i = 0; i < OBNUM; i++)
66 {
67 x = (win_w / 2) - (w / 2);
68 x += sin((double)(f + (i * 13)) / (36.7 * SLOW)) * (w / 2);
69 y = (win_h / 2) - (h / 2);
70 y += cos((double)(f + (i * 28)) / (43.8 * SLOW)) * (w / 2);
71 eo_do(o_shapes[i], efl_gfx_position_set(x, y));
72 }
73 FPS_STD(NAME);
74}
75
76/* prepend special key handlers if interactive (before STD) */
77static void _key(char *key)
78{
79 KEY_STD;
80}
81
82
83
84
85
86
87
88
89
90
91
92
93/* template stuff - ignore */
94# endif
95#endif
96
97#ifdef UI
98_ui_menu_item_add(ICON, NAME, FNAME);
99#endif
100
101#ifdef PROTO
102void FNAME(void);
103#endif
104
105#ifndef PROTO
106# ifndef UI
107void FNAME(void)
108{
109 ui_func_set(_key, _loop);
110 _setup();
111}
112# endif
113#endif
114#undef FNAME
115#undef NAME
116#undef ICON