summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-09-01 14:50:29 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-09-13 09:57:05 +0900
commit230b234891e22dd1cffd668642dc75ee023e58f5 (patch)
tree810d0380b6109c67ba89e393a70a0c021e8bce00
parentf5a56789e062a47d0cf5141953c5d8a6071eecdf (diff)
evas: Remove private data for clipped object
Another step towards merging both classes of smart objects.
-rw-r--r--src/lib/edje/edje_smart.c5
-rw-r--r--src/lib/evas/canvas/efl_canvas_group_clipped.eo2
-rw-r--r--src/lib/evas/canvas/evas_object_box.c3
-rw-r--r--src/lib/evas/canvas/evas_object_smart.c8
-rw-r--r--src/lib/evas/canvas/evas_object_smart_clipped.c47
5 files changed, 36 insertions, 29 deletions
diff --git a/src/lib/edje/edje_smart.c b/src/lib/edje/edje_smart.c
index 72452fa9..85c4a55 100644
--- a/src/lib/edje/edje_smart.c
+++ b/src/lib/edje/edje_smart.c
@@ -32,11 +32,10 @@ _edje_object_efl_object_constructor(Eo *obj, Edje *ed)
32 Evas *e; 32 Evas *e;
33 void *tmp; 33 void *tmp;
34 34
35 ed->base = efl_data_ref(obj, EFL_CANVAS_GROUP_CLIPPED_CLASS);
36 ed->duration_scale = 1.0;
37
38 obj = efl_constructor(efl_super(obj, MY_CLASS)); 35 obj = efl_constructor(efl_super(obj, MY_CLASS));
39 efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY); 36 efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
37 ed->base = evas_object_smart_data_get(obj);
38 ed->duration_scale = 1.0;
40 _edje_lib_ref(); 39 _edje_lib_ref();
41 40
42 parent = efl_parent_get(obj); 41 parent = efl_parent_get(obj);
diff --git a/src/lib/evas/canvas/efl_canvas_group_clipped.eo b/src/lib/evas/canvas/efl_canvas_group_clipped.eo
index f121dce..4a7b66e 100644
--- a/src/lib/evas/canvas/efl_canvas_group_clipped.eo
+++ b/src/lib/evas/canvas/efl_canvas_group_clipped.eo
@@ -3,7 +3,7 @@
3abstract Efl.Canvas.Group.Clipped (Efl.Canvas.Group) 3abstract Efl.Canvas.Group.Clipped (Efl.Canvas.Group)
4{ 4{
5 [[Internal class representing a canvas object group with a clipper.]] 5 [[Internal class representing a canvas object group with a clipper.]]
6 data: Evas_Object_Smart_Clipped_Data; 6 data: null;
7 implements { 7 implements {
8 Efl.Object.constructor; 8 Efl.Object.constructor;
9 Efl.Gfx.color { set; } 9 Efl.Gfx.color { set; }
diff --git a/src/lib/evas/canvas/evas_object_box.c b/src/lib/evas/canvas/evas_object_box.c
index f0d2b2a..b7e0218 100644
--- a/src/lib/evas/canvas/evas_object_box.c
+++ b/src/lib/evas/canvas/evas_object_box.c
@@ -405,9 +405,10 @@ _evas_box_efl_canvas_group_group_add(Eo *eo_obj, Evas_Object_Box_Data *priv)
405 405
406 // make sure evas box smart data is fully initialized and set (for legacy) 406 // make sure evas box smart data is fully initialized and set (for legacy)
407 // this assumes only box and smart clipped access the smart data 407 // this assumes only box and smart clipped access the smart data
408 cso = efl_data_scope_get(eo_obj, EFL_CANVAS_GROUP_CLIPPED_CLASS); 408 cso = evas_object_smart_data_get(eo_obj);
409 priv->base = *cso; 409 priv->base = *cso;
410 evas_object_smart_data_set(eo_obj, priv); 410 evas_object_smart_data_set(eo_obj, priv);
411 free(cso);
411} 412}
412 413
413EOLIAN static void 414EOLIAN static void
diff --git a/src/lib/evas/canvas/evas_object_smart.c b/src/lib/evas/canvas/evas_object_smart.c
index 4b3623e..c82bd47 100644
--- a/src/lib/evas/canvas/evas_object_smart.c
+++ b/src/lib/evas/canvas/evas_object_smart.c
@@ -10,8 +10,7 @@
10#define MY_CLASS_NAME_LEGACY "Evas_Object_Smart" 10#define MY_CLASS_NAME_LEGACY "Evas_Object_Smart"
11 11
12#define EVAS_OBJECT_SMART_GET_OR_RETURN(eo_obj, ...) \ 12#define EVAS_OBJECT_SMART_GET_OR_RETURN(eo_obj, ...) \
13 Evas_Smart_Data *o = efl_isa(eo_obj, EFL_CANVAS_GROUP_CLASS) ? \ 13 Evas_Smart_Data *o = efl_data_scope_safe_get(eo_obj, EFL_CANVAS_GROUP_CLASS); \
14 efl_data_scope_get(eo_obj, EFL_CANVAS_GROUP_CLASS) : NULL; \
15 do { if (!o) { MAGIC_CHECK_FAILED(eo_obj,0,MAGIC_SMART) return __VA_ARGS__; } } while (0) 14 do { if (!o) { MAGIC_CHECK_FAILED(eo_obj,0,MAGIC_SMART) return __VA_ARGS__; } } while (0)
16 15
17extern Eina_Hash* signals_hash_table; 16extern Eina_Hash* signals_hash_table;
@@ -37,8 +36,7 @@ struct _Evas_Smart_Data
37 36
38 Evas_Smart_Cb_Description_Array callbacks_descriptions; 37 Evas_Smart_Cb_Description_Array callbacks_descriptions;
39 38
40 Evas_Coord x, y; 39 int x, y;
41
42 int walking_list; 40 int walking_list;
43 int member_count; /** number of smart member objects */ 41 int member_count; /** number of smart member objects */
44 42
@@ -1671,6 +1669,8 @@ _efl_canvas_group_group_unclipped_set(Eo *eo_obj EINA_UNUSED, Evas_Smart_Data *s
1671 // We must call this function BEFORE the constructor (yes, it's hacky) 1669 // We must call this function BEFORE the constructor (yes, it's hacky)
1672 EINA_SAFETY_ON_FALSE_RETURN(!sd->object); 1670 EINA_SAFETY_ON_FALSE_RETURN(!sd->object);
1673 sd->unclipped = !!unclipped; 1671 sd->unclipped = !!unclipped;
1672 if (!unclipped && !sd->data)
1673 sd->data = calloc(1, sizeof(Evas_Object_Smart_Clipped_Data));
1674} 1674}
1675 1675
1676/* Internal EO APIs */ 1676/* Internal EO APIs */
diff --git a/src/lib/evas/canvas/evas_object_smart_clipped.c b/src/lib/evas/canvas/evas_object_smart_clipped.c
index 2ad3597..50fb1b0 100644
--- a/src/lib/evas/canvas/evas_object_smart_clipped.c
+++ b/src/lib/evas/canvas/evas_object_smart_clipped.c
@@ -7,9 +7,7 @@
7#define MY_CLASS EFL_CANVAS_GROUP_CLIPPED_CLASS 7#define MY_CLASS EFL_CANVAS_GROUP_CLIPPED_CLASS
8 8
9#define CSO_DATA_GET(eo_obj, ptr) \ 9#define CSO_DATA_GET(eo_obj, ptr) \
10 Evas_Object_Smart_Clipped_Data *ptr = (efl_isa(eo_obj, MY_CLASS) ? \ 10 Evas_Object_Smart_Clipped_Data *ptr = evas_object_smart_data_get(eo_obj);
11 efl_data_scope_get(eo_obj, MY_CLASS) : \
12 evas_object_smart_data_get(eo_obj));
13 11
14#define CSO_DATA_GET_OR_RETURN(eo_obj, ptr, ...) \ 12#define CSO_DATA_GET_OR_RETURN(eo_obj, ptr, ...) \
15 CSO_DATA_GET(eo_obj, ptr) \ 13 CSO_DATA_GET(eo_obj, ptr) \
@@ -24,14 +22,10 @@ evas_object_smart_clipped_clipper_get(const Evas_Object *eo_obj)
24} 22}
25 23
26static void 24static void
27evas_object_smart_clipped_smart_add(Evas_Object *eo_obj) 25evas_object_smart_clipped_smart_add(Evas_Object *eo_obj, Evas_Object_Smart_Clipped_Data *cso)
28{ 26{
29 Evas_Object *clipper; 27 Evas_Object *clipper;
30 28
31 CSO_DATA_GET(eo_obj, cso)
32 if (!cso)
33 cso = calloc(1, sizeof(*cso)); /* users can provide it or realloc() later */
34
35 cso->evas = evas_object_evas_get(eo_obj); 29 cso->evas = evas_object_evas_get(eo_obj);
36 clipper = evas_object_rectangle_add(cso->evas); 30 clipper = evas_object_rectangle_add(cso->evas);
37 evas_object_static_clip_set(clipper, 1); 31 evas_object_static_clip_set(clipper, 1);
@@ -48,10 +42,22 @@ evas_object_smart_clipped_smart_add(Evas_Object *eo_obj)
48 evas_object_smart_data_set(eo_obj, cso); 42 evas_object_smart_data_set(eo_obj, cso);
49} 43}
50 44
45static void
46evas_object_smart_clipped_smart_add_legacy(Evas_Object *eo_obj)
47{
48 Evas_Object_Smart_Clipped_Data *cso;
49
50 cso = calloc(1, sizeof(*cso));
51 evas_object_smart_clipped_smart_add(eo_obj, cso);
52}
53
51EOLIAN static void 54EOLIAN static void
52_efl_canvas_group_clipped_efl_canvas_group_group_add(Eo *eo_obj, Evas_Object_Smart_Clipped_Data *obj EINA_UNUSED) 55_efl_canvas_group_clipped_efl_canvas_group_group_add(Eo *eo_obj, void *_pd EINA_UNUSED)
53{ 56{
54 evas_object_smart_clipped_smart_add(eo_obj); 57 Evas_Object_Smart_Clipped_Data *cso;
58
59 cso = evas_object_smart_data_get(eo_obj);
60 evas_object_smart_clipped_smart_add(eo_obj, cso);
55} 61}
56 62
57static void 63static void
@@ -76,7 +82,7 @@ evas_object_smart_clipped_smart_del(Evas_Object *eo_obj)
76} 82}
77 83
78EOLIAN static void 84EOLIAN static void
79_efl_canvas_group_clipped_efl_canvas_group_group_del(Eo *eo_obj, Evas_Object_Smart_Clipped_Data *obj EINA_UNUSED) 85_efl_canvas_group_clipped_efl_canvas_group_group_del(Eo *eo_obj, void *_pd EINA_UNUSED)
80{ 86{
81 evas_object_smart_clipped_smart_del(eo_obj); 87 evas_object_smart_clipped_smart_del(eo_obj);
82 // group_del_called was already set to true, no need to call super here. 88 // group_del_called was already set to true, no need to call super here.
@@ -90,7 +96,7 @@ evas_object_smart_clipped_smart_move(Evas_Object *eo_obj, Evas_Coord x, Evas_Coo
90} 96}
91 97
92EOLIAN static void 98EOLIAN static void
93_efl_canvas_group_clipped_efl_gfx_position_set(Eo *eo_obj, Evas_Object_Smart_Clipped_Data *obj EINA_UNUSED, Evas_Coord x, Evas_Coord y) 99_efl_canvas_group_clipped_efl_gfx_position_set(Eo *eo_obj, void *_pd EINA_UNUSED, Evas_Coord x, Evas_Coord y)
94{ 100{
95 if (_evas_object_intercept_call(eo_obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, x, y)) 101 if (_evas_object_intercept_call(eo_obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, x, y))
96 return; 102 return;
@@ -115,7 +121,7 @@ evas_object_smart_clipped_smart_hide(Evas_Object *eo_obj)
115} 121}
116 122
117EOLIAN static void 123EOLIAN static void
118_efl_canvas_group_clipped_efl_gfx_visible_set(Eo *eo_obj, Evas_Object_Smart_Clipped_Data *obj EINA_UNUSED, Eina_Bool vis) 124_efl_canvas_group_clipped_efl_gfx_visible_set(Eo *eo_obj, void *_pd EINA_UNUSED, Eina_Bool vis)
119{ 125{
120 if (_evas_object_intercept_call(eo_obj, EVAS_OBJECT_INTERCEPT_CB_VISIBLE, 0, vis)) 126 if (_evas_object_intercept_call(eo_obj, EVAS_OBJECT_INTERCEPT_CB_VISIBLE, 0, vis))
121 return; 127 return;
@@ -127,8 +133,9 @@ _efl_canvas_group_clipped_efl_gfx_visible_set(Eo *eo_obj, Evas_Object_Smart_Clip
127} 133}
128 134
129EOLIAN static void 135EOLIAN static void
130_efl_canvas_group_clipped_efl_canvas_object_no_render_set(Eo *eo_obj, Evas_Object_Smart_Clipped_Data *cso, Eina_Bool enable) 136_efl_canvas_group_clipped_efl_canvas_object_no_render_set(Eo *eo_obj, void *_pd EINA_UNUSED, Eina_Bool enable)
131{ 137{
138 CSO_DATA_GET_OR_RETURN(eo_obj, cso);
132 enable = !!enable; 139 enable = !!enable;
133 if (efl_canvas_object_no_render_get(eo_obj) == enable) return; 140 if (efl_canvas_object_no_render_get(eo_obj) == enable) return;
134 efl_canvas_object_no_render_set(efl_super(eo_obj, MY_CLASS), enable); 141 efl_canvas_object_no_render_set(efl_super(eo_obj, MY_CLASS), enable);
@@ -143,7 +150,7 @@ evas_object_smart_clipped_smart_color_set(Evas_Object *eo_obj, int r, int g, int
143} 150}
144 151
145EOLIAN static void 152EOLIAN static void
146_efl_canvas_group_clipped_efl_gfx_color_set(Eo *eo_obj, Evas_Object_Smart_Clipped_Data *obj EINA_UNUSED, int r, int g, int b, int a) 153_efl_canvas_group_clipped_efl_gfx_color_set(Eo *eo_obj, void *_pd EINA_UNUSED, int r, int g, int b, int a)
147{ 154{
148 evas_object_smart_clipped_smart_color_set(eo_obj, r, g, b, a); 155 evas_object_smart_clipped_smart_color_set(eo_obj, r, g, b, a);
149} 156}
@@ -163,7 +170,7 @@ evas_object_smart_clipped_smart_clip_unset(Evas_Object *eo_obj)
163} 170}
164 171
165EOLIAN static void 172EOLIAN static void
166_efl_canvas_group_clipped_efl_canvas_object_clip_set(Eo *eo_obj, Evas_Object_Smart_Clipped_Data *obj EINA_UNUSED, Evas_Object *clip) 173_efl_canvas_group_clipped_efl_canvas_object_clip_set(Eo *eo_obj, void *_pd EINA_UNUSED, Evas_Object *clip)
167{ 174{
168 if (_evas_object_intercept_call(eo_obj, EVAS_OBJECT_INTERCEPT_CB_CLIP_SET, 0, clip)) 175 if (_evas_object_intercept_call(eo_obj, EVAS_OBJECT_INTERCEPT_CB_CLIP_SET, 0, clip))
169 return; 176 return;
@@ -185,7 +192,7 @@ evas_object_smart_clipped_smart_member_add(Evas_Object *eo_obj, Evas_Object *mem
185} 192}
186 193
187EOLIAN static void 194EOLIAN static void
188_efl_canvas_group_clipped_efl_canvas_group_group_member_add(Eo *eo_obj, Evas_Object_Smart_Clipped_Data *obj EINA_UNUSED, Evas_Object *member) 195_efl_canvas_group_clipped_efl_canvas_group_group_member_add(Eo *eo_obj, void *_pd EINA_UNUSED, Evas_Object *member)
189{ 196{
190 efl_canvas_group_member_add(efl_super(eo_obj, MY_CLASS), member); 197 efl_canvas_group_member_add(efl_super(eo_obj, MY_CLASS), member);
191 evas_object_smart_clipped_smart_member_add(eo_obj, member); 198 evas_object_smart_clipped_smart_member_add(eo_obj, member);
@@ -203,14 +210,14 @@ evas_object_smart_clipped_smart_member_del(Evas_Object *eo_obj, Evas_Object *mem
203} 210}
204 211
205EOLIAN static void 212EOLIAN static void
206_efl_canvas_group_clipped_efl_canvas_group_group_member_del(Eo *eo_obj, Evas_Object_Smart_Clipped_Data *obj EINA_UNUSED, Evas_Object *member) 213_efl_canvas_group_clipped_efl_canvas_group_group_member_del(Eo *eo_obj, void *_pd EINA_UNUSED, Evas_Object *member)
207{ 214{
208 evas_object_smart_clipped_smart_member_del(eo_obj, member); 215 evas_object_smart_clipped_smart_member_del(eo_obj, member);
209 efl_canvas_group_member_del(efl_super(eo_obj, MY_CLASS), member); 216 efl_canvas_group_member_del(efl_super(eo_obj, MY_CLASS), member);
210} 217}
211 218
212EOLIAN static Eo * 219EOLIAN static Eo *
213_efl_canvas_group_clipped_efl_object_constructor(Eo *eo_obj, Evas_Object_Smart_Clipped_Data *obj EINA_UNUSED) 220_efl_canvas_group_clipped_efl_object_constructor(Eo *eo_obj, void *_pd EINA_UNUSED)
214{ 221{
215 // Setting this flag before the parent constructor on purpose. 222 // Setting this flag before the parent constructor on purpose.
216 efl_canvas_group_unclipped_set(eo_obj, EINA_FALSE); 223 efl_canvas_group_unclipped_set(eo_obj, EINA_FALSE);
@@ -224,7 +231,7 @@ evas_object_smart_clipped_smart_set(Evas_Smart_Class *sc)
224 if (!sc) 231 if (!sc)
225 return; 232 return;
226 233
227 sc->add = evas_object_smart_clipped_smart_add; 234 sc->add = evas_object_smart_clipped_smart_add_legacy;
228 sc->del = evas_object_smart_clipped_smart_del; 235 sc->del = evas_object_smart_clipped_smart_del;
229 sc->move = evas_object_smart_clipped_smart_move; 236 sc->move = evas_object_smart_clipped_smart_move;
230 sc->show = evas_object_smart_clipped_smart_show; 237 sc->show = evas_object_smart_clipped_smart_show;