summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-09-02 20:27:26 +0200
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-09-02 20:27:26 +0200
commit64c45e94cd7f2799d8cd417d30b1e5383fcf1f80 (patch)
tree44d84986671bc6579ab57499606cf6c1634b6214
parent2cbb0d382ee43b1760f0437bd629ae1069528cf5 (diff)
make things work betterdevs/bu5hm4n/cv
-rw-r--r--src/lib/elementary/efl_ui_collection_view.c73
1 files changed, 52 insertions, 21 deletions
diff --git a/src/lib/elementary/efl_ui_collection_view.c b/src/lib/elementary/efl_ui_collection_view.c
index 1bb3b6b737..fc8ebd12c9 100644
--- a/src/lib/elementary/efl_ui_collection_view.c
+++ b/src/lib/elementary/efl_ui_collection_view.c
@@ -259,7 +259,7 @@ printf("MODEL FETCHED %d -> %d\n", request->offset, request->length);
259 Efl_Ui_Collection_Item_Lookup *insert; 259 Efl_Ui_Collection_Item_Lookup *insert;
260 unsigned int v; 260 unsigned int v;
261 261
262 for (v = 0; v < 3; ++v) 262 /*for (v = 0; v < 3; ++v)
263 { 263 {
264 if (!pd->viewport[v]) continue; 264 if (!pd->viewport[v]) continue;
265 265
@@ -274,18 +274,38 @@ if (!index)
274 child = NULL; 274 child = NULL;
275 break; 275 break;
276 } 276 }
277 } 277 }*/
278 278
279 // When requesting a model, it should not be in the cache prior to the request 279 // When requesting a model, it should not be in the cache prior to the request
280 if (!child) continue; 280 if (!child) continue;
281 281
282 insert = calloc(1, sizeof (Efl_Ui_Collection_Item_Lookup)); 282 int search_index = request->offset + i;
283 if (!insert) continue;
284 283
285 insert->index = request->offset + i; 284 insert = (void*) eina_rbtree_inline_lookup(pd->cache, &search_index,
286 insert->item.model = efl_ref(child); 285 sizeof (search_index), _cache_tree_lookup,
286 NULL);
287 if (insert)
288 {
289 if (!insert->item.entity && request->need_entity)
290 {
291 //drop the old model here, overwrite with model + view
292 efl_unref(insert->item.model);
293 insert->item.model = efl_ref(child);
294 }
295 else
296 ERR("Inserting a model that was already fetched, dropping new model %d", search_index);
297
298 }
299 else
300 {
301 insert = calloc(1, sizeof (Efl_Ui_Collection_Item_Lookup));
302 if (!insert) continue;
303 insert->index = request->offset + i;
304 insert->item.model = efl_ref(child);
305 pd->cache = eina_rbtree_inline_insert(pd->cache, EINA_RBTREE_GET(insert), _cache_tree_cmp, NULL);
306 printf("INSERTING ELEMENT %lu\n", request->offset + i);
307 }
287 308
288 pd->cache = eina_rbtree_inline_insert(pd->cache, EINA_RBTREE_GET(insert), _cache_tree_cmp, NULL);
289 } 309 }
290 310
291 return v; 311 return v;
@@ -526,9 +546,6 @@ _cache_size_fetch(Eina_List *requests, Efl_Ui_Collection_Request **request,
526 // If we do not know the size 546 // If we do not know the size
527 if (!ITEM_SIZE_FROM_MODEL(model, item_size)) 547 if (!ITEM_SIZE_FROM_MODEL(model, item_size))
528 { 548 {
529 // But can calculate it now
530 if (!lookup->item.entity) goto not_found;
531
532 item_size = efl_gfx_hint_size_combined_min_get(lookup->item.entity); 549 item_size = efl_gfx_hint_size_combined_min_get(lookup->item.entity);
533 if (item_size.h == 0 && item_size.w == 0) 550 if (item_size.h == 0 && item_size.w == 0)
534 ITEM_BASE_SIZE_FROM_MODEL(pd->model, item_size); 551 ITEM_BASE_SIZE_FROM_MODEL(pd->model, item_size);
@@ -543,7 +560,6 @@ _cache_size_fetch(Eina_List *requests, Efl_Ui_Collection_Request **request,
543 return requests; 560 return requests;
544 561
545 not_found: 562 not_found:
546// printf("LINE %d\n", __LINE__);
547 requests = _request_add(requests, request, search_index, EINA_FALSE); 563 requests = _request_add(requests, request, search_index, EINA_FALSE);
548 564
549 target->size = item_size; 565 target->size = item_size;
@@ -858,21 +874,36 @@ _batch_size_cb(void *data, Efl_Ui_Position_Manager_Size_Call_Config conf, Eina_R
858 if (!sizes[idx].size.w || !sizes[idx].size.h) ERR("NULL SIZE ENT"); 874 if (!sizes[idx].size.w || !sizes[idx].size.h) ERR("NULL SIZE ENT");
859 idx++; 875 idx++;
860 }*/ 876 }*/
861 while (idx < limit) 877 if (conf.cache_request)
862 { 878 {
863 uint64_t search_index = conf.range.start_id + idx; 879 printf("CACHING SIZE CALL\n");
864// printf("%lu LINE %d\n", search_index, __LINE__); 880 while (idx < limit)
865 requests = _cache_size_fetch(requests, &request, pd, 881 {
866 search_index, &sizes[idx], item_base); 882 sizes[idx].depth_leader = EINA_FALSE;
867 if (!sizes[idx].size.w || !sizes[idx].size.h) ERR("NULL SIZE ENT"); 883 sizes[idx].element_depth = 0;
868 idx++; 884 sizes[idx].size = item_base;
885 if (!sizes[idx].size.w || !sizes[idx].size.h) ERR("NULL SIZE ENT");
886 idx++;
887 }
869 } 888 }
889 else
890 {
891 while (idx < limit)
892 {
893 uint64_t search_index = conf.range.start_id + idx;
894 // printf("%lu LINE %d\n", search_index, __LINE__);
895 requests = _cache_size_fetch(requests, &request, pd,
896 search_index, &sizes[idx], item_base);
897 if (!sizes[idx].size.w || !sizes[idx].size.h) ERR("NULL SIZE ENT");
898 idx++;
899 }
870 900
871 901
872 // Done, but flush request first 902 // Done, but flush request first
873 if (request) requests = eina_list_append(requests, request); 903 if (request) requests = eina_list_append(requests, request);
874 904
875 requests = _batch_request_flush(requests, data, pd); 905 requests = _batch_request_flush(requests, data, pd);
906 }
876 907
877 // Get the amount of filled item 908 // Get the amount of filled item
878 result.filled_items = limit; 909 result.filled_items = limit;