summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2019-05-13 07:56:19 -0400
committerMike Blumenkrantz <zmike@samsung.com>2019-05-13 07:56:19 -0400
commit3a1058aab1f68a07021b23e9e02fe9f3f4315267 (patch)
tree8540ca6601f0212e134803edeb6405230cbf42b9
parent9fd3c26a5e9e1895344565cbb27d278453c669ed (diff)
add test for a clipped masked image
Summary: this test is the same as one of the other mask tests (I forgot which) but it clips the mask and then moves/resizes the mask crazily to make the performance really bad Reviewers: cedric Reviewed By: cedric Tags: #expedite Differential Revision: https://phab.enlightenment.org/D8836
-rw-r--r--src/bin/image_mask_clipped.c133
-rw-r--r--src/bin/meson.build1
-rw-r--r--src/bin/tests.h1
3 files changed, 135 insertions, 0 deletions
diff --git a/src/bin/image_mask_clipped.c b/src/bin/image_mask_clipped.c
new file mode 100644
index 0000000..a314546
--- /dev/null
+++ b/src/bin/image_mask_clipped.c
@@ -0,0 +1,133 @@
1#undef FNAME
2#undef NAME
3#undef ICON
4
5/* metadata */
6#define FNAME image_mask_clipped
7#define NAME "Image Mask Clipped"
8#define ICON "blend.png"
9
10#ifndef PROTO
11# ifndef UI
12# include "main.h"
13
14/* standard var */
15static int done = 0;
16/* private data */
17static Evas_Object *o_images[OBNUM];
18static Evas_Object *o_mask;
19static Evas_Object *o_clip;
20
21/* setup */
22static void _setup(void)
23{
24 int i;
25 Evas_Object *o;
26
27 o = efl_add(EFL_CANVAS_RECTANGLE_CLASS, evas);
28 o_clip = o;
29 efl_gfx_entity_size_set(o, EINA_SIZE2D(180, 105));
30 efl_gfx_entity_position_set(o, EINA_POSITION2D((win_w - 180) / 2, (win_h - 105) / 2));
31 efl_gfx_entity_visible_set(o, EINA_TRUE);
32
33 o = efl_add(EFL_CANVAS_IMAGE_CLASS, evas);
34 o_mask = o;
35 efl_file_simple_load(o, build_path("e-logo-mask.png"), NULL);
36 efl_gfx_fill_set(o, EINA_RECT(0, 0, 720, 420));
37 efl_gfx_entity_size_set(o, EINA_SIZE2D(720, 420));
38 evas_object_clip_set(o, o_clip);
39 efl_gfx_entity_position_set(o, EINA_POSITION2D((win_w - 720) / 2, (win_h - 420) / 2));
40 efl_gfx_entity_visible_set(o, EINA_TRUE);
41
42 for (i = 0; i < OBNUM; i++)
43 {
44 o = efl_add(EFL_CANVAS_IMAGE_CLASS, evas);
45 o_images[i] = o;
46 efl_file_simple_load(o, build_path("logo.png"), NULL);
47 efl_gfx_fill_set(o, EINA_RECT(0, 0, 360, 480));
48 efl_gfx_entity_size_set(o, EINA_SIZE2D(360, 480));
49 efl_gfx_image_smooth_scale_set(o, 0);
50 evas_object_clip_set(o, o_mask);
51 efl_gfx_entity_visible_set(o, EINA_TRUE);
52 }
53 done = 0;
54}
55
56/* cleanup */
57static void _cleanup(void)
58{
59 int i;
60 for (i = 0; i < OBNUM; i++) efl_del(o_images[i]);
61 efl_del(o_mask);
62 efl_del(o_clip);
63}
64
65/* loop - do things */
66static void _loop(double t, int f)
67{
68 int i;
69 Evas_Coord x, y, w, h, w0, h0;
70
71 for (i = 0; i < OBNUM; i++)
72 {
73 w0 = 80;
74 h0 = 80;
75 w = 5 + ((1.0 + cos((double)(f + (i * 10)) / (7.4 * SLOW) )) * w0 * 2);
76 h = 5 + ((1.0 + sin((double)(f + (i * 19)) / (12.6 * SLOW) )) * h0 * 2);
77 x = (win_w / 2) - (w / 2);
78 x += sin((double)(f + (i * 13)) / (36.7 * SLOW)) * (w0 / 2);
79 y = (win_h / 2) - (h / 2);
80 y += cos((double)(f + (i * 28)) / (43.8 * SLOW)) * (h0 / 2);
81
82 efl_gfx_entity_position_set(o_images[i], EINA_POSITION2D(x, y));
83 efl_gfx_entity_size_set(o_images[i], EINA_SIZE2D(w, h));
84 efl_gfx_fill_set(o_images[i], EINA_RECT(0, 0, w, h));
85 }
86 w = (sin((double)f) * 720 + 840) / 2.2;
87 h = (sin((double)f) * 720 + 840) / 2.2;
88 efl_gfx_entity_size_set(o_mask, EINA_SIZE2D(w, h));
89 efl_gfx_entity_position_set(o_mask, EINA_POSITION2D((win_w - w) / 2, (win_h - h) / 2));
90 FPS_STD(NAME);
91}
92
93/* prepend special key handlers if interactive (before STD) */
94static void _key(const char *key)
95{
96 KEY_STD;
97}
98
99
100
101
102
103
104
105
106
107
108
109
110/* template stuff - ignore */
111# endif
112#endif
113
114#ifdef UI
115_ui_menu_item_add(ICON, NAME, FNAME);
116#endif
117
118#ifdef PROTO
119void FNAME(void);
120#endif
121
122#ifndef PROTO
123# ifndef UI
124void FNAME(void)
125{
126 ui_func_set(_key, _loop);
127 _setup();
128}
129# endif
130#endif
131#undef FNAME
132#undef NAME
133#undef ICON
diff --git a/src/bin/meson.build b/src/bin/meson.build
index ba4b263..710b6c9 100644
--- a/src/bin/meson.build
+++ b/src/bin/meson.build
@@ -113,6 +113,7 @@ expedite_sources = [ 'main.c',
113 'image_mask_11.c', 113 'image_mask_11.c',
114 'image_mask_12.c', 114 'image_mask_12.c',
115 'image_mask_13.c', 115 'image_mask_13.c',
116 'image_mask_clipped.c',
116 'vg_basic_rect.c', 117 'vg_basic_rect.c',
117 'vg_basic_circle.c', 118 'vg_basic_circle.c',
118 'vg_basic_gradient.c', 119 'vg_basic_gradient.c',
diff --git a/src/bin/tests.h b/src/bin/tests.h
index b03d0f0..4f21d05 100644
--- a/src/bin/tests.h
+++ b/src/bin/tests.h
@@ -106,6 +106,7 @@
106#include "image_mask_11.c" 106#include "image_mask_11.c"
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 "image_mask_clipped.c"
109#include "vg_basic_rect.c" 110#include "vg_basic_rect.c"
110#include "vg_basic_circle.c" 111#include "vg_basic_circle.c"
111#include "vg_basic_gradient.c" 112#include "vg_basic_gradient.c"