summaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-07-30 11:13:46 +0200
committerCedric BAIL <cedric.bail@free.fr>2019-07-31 15:51:48 -0700
commitd98d434e56fe98af76cdccc38e96f0e8f34db590 (patch)
treed2cf2c0fa120da17234ec13f642d558cad2528ff /src/tests
parent69975fc72d12dec339f9c0a9b2ce93d34265c599 (diff)
efl_ui_position_manager: move from accessor to function callback
this commit enables access to the item structure of the collection via a function callback. The function callback now enables batching for items, which does not pay off right now. However, a few more optimizations can be done in order to get the whole payoff. Reviewed-by: Cedric BAIL <cedric.bail@free.fr> Differential Revision: https://phab.enlightenment.org/D9445
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/elementary/efl_ui_test_position_manager_common.c57
1 files changed, 23 insertions, 34 deletions
diff --git a/src/tests/elementary/efl_ui_test_position_manager_common.c b/src/tests/elementary/efl_ui_test_position_manager_common.c
index 7cf39f92d8..ea89662837 100644
--- a/src/tests/elementary/efl_ui_test_position_manager_common.c
+++ b/src/tests/elementary/efl_ui_test_position_manager_common.c
@@ -12,8 +12,7 @@ static Eo* win;
12 12
13static Eina_Array *arr_obj; 13static Eina_Array *arr_obj;
14static Eina_Inarray *arr_size; 14static Eina_Inarray *arr_size;
15static Eina_Accessor inner_size_acc; 15
16static Eina_Accessor *size_acc;
17static void 16static void
18item_container_setup() 17item_container_setup()
19{ 18{
@@ -26,54 +25,44 @@ item_container_teardown()
26 win = NULL; 25 win = NULL;
27} 26}
28 27
29static Eina_Bool 28static int
30_get_at(Eina_Accessor *it EINA_UNUSED, unsigned int idx, void **data) 29_size_accessor_get_at(void *data EINA_UNUSED, int start_id, Eina_Rw_Slice memory)
31{ 30{
32 Eina_Size2D *result_ptr = (void*)data; 31 int i;
33 Eina_Size2D *inner_result;
34 32
35 if (!eina_accessor_data_get(size_acc, idx, (void*)&inner_result)) 33 for (i = start_id; i < (int)(MIN(start_id + memory.len, eina_inarray_count(arr_size))); ++i)
36 return EINA_FALSE; 34 {
37 *result_ptr = *inner_result; 35 Eina_Size2D *size = eina_inarray_nth(arr_size, i);
38 return EINA_TRUE;
39}
40 36
41static void 37 ((Eina_Size2D*)memory.mem)[i - start_id] = *size;
42_free_cb(Eina_Accessor *it EINA_UNUSED) 38 }
43{ 39 return i - start_id;
44 eina_accessor_free(size_acc);
45} 40}
46 41
47static Eina_Bool 42static int
48_lock_cb(Eina_Accessor *it EINA_UNUSED) 43_obj_accessor_get_at(void *data EINA_UNUSED, int start_id, Eina_Rw_Slice memory)
49{ 44{
50 return eina_accessor_lock(size_acc); 45 int i;
51}
52 46
53static Eina_Accessor* 47 for (i = start_id; i < (int)(MIN(start_id + memory.len, eina_array_count(arr_obj))); ++i)
54_clone_cb(Eina_Accessor *it EINA_UNUSED) 48 {
55{ 49 Efl_Gfx_Entity *geom = eina_array_data_get(arr_obj, i);
56 return eina_accessor_clone(size_acc);
57}
58 50
51 ((Efl_Gfx_Entity**)memory.mem)[i - start_id] = geom;
52 }
59 53
54 return i - start_id;
55}
60static void 56static void
61_initial_setup(void) 57_initial_setup(void)
62{ 58{
63 arr_obj = eina_array_new(10); 59 arr_obj = eina_array_new(10);
64 arr_size = eina_inarray_new(sizeof(Eina_Size2D), 10); 60 arr_size = eina_inarray_new(sizeof(Eina_Size2D), 10);
65 size_acc = eina_inarray_accessor_new(arr_size);
66
67 inner_size_acc.version = EINA_ACCESSOR_VERSION;
68 EINA_MAGIC_SET(&inner_size_acc, EINA_MAGIC_ACCESSOR);
69 inner_size_acc.get_at = _get_at;
70 inner_size_acc.free = _free_cb;
71 inner_size_acc.lock = _lock_cb;
72 inner_size_acc.clone = _clone_cb;
73 61
74 efl_ui_position_manager_entity_data_access_set(position_manager, 62 efl_ui_position_manager_entity_data_access_set(position_manager,
75 eina_array_accessor_new(arr_obj), 63 NULL, _obj_accessor_get_at, NULL,
76 &inner_size_acc, 0); 64 NULL, _size_accessor_get_at, NULL,
65 0);
77} 66}
78 67
79static int 68static int