From 987b3a59109ad178c571ee952c55edefc4d103a5 Mon Sep 17 00:00:00 2001 From: SangHyeon Jade Lee Date: Wed, 30 Dec 2020 19:46:02 +0900 Subject: [PATCH] Add realize policy canvas output for optimized lazy loading on scroller in gengrid case This patch is tricky way of realize/unrealize item on evas output size instead of object size. export or setenv() "GENGRID_REALIZE_POLICY_CANVAS_OUTPUT", gengrid will change realize policy to canvas output. @tizen_only Change-Id: I99f6007f19721228233d006e283fe46ebd4eef6a Signed-off-by: SangHyeon Jade Lee --- src/lib/elementary/elm_gengrid.c | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/src/lib/elementary/elm_gengrid.c b/src/lib/elementary/elm_gengrid.c index 0418c1e..dfe3f1a 100755 --- a/src/lib/elementary/elm_gengrid.c +++ b/src/lib/elementary/elm_gengrid.c @@ -2094,12 +2094,32 @@ _item_place(Elm_Gen_Item *it, it->x = cx; it->y = cy; evas_object_geometry_get(wsd->pan_obj, &ox, &oy, &vw, &vh); + if (getenv("GENGRID_REALIZE_POLICY_WITH_CANVAS_OUTPUT_SIZE")) + { + evas_output_viewport_get + (evas_object_evas_get(wsd->pan_obj), &cvx, &cvy, &cvw, &cvh); + if (ELM_RECTS_INTERSECT(cvx, cvy, cvw, cvh, ox, oy, vw, vh)) + { + cvx = MAX(cvx, ox); + cvw = MIN(cvx + cvw, ox + vw) - cvx; + cvy = MAX(cvy, oy); + cvh = MIN(cvy + cvh, oy + vh) - cvy; + } + else + { + cvx = 0; cvy = 0; cvw = 0; cvh = 0; + } + } + else + { + cvx = ox; cvy = oy; cvw = vw; cvh = vh; + } /* Preload rows/columns at each side of the Gengrid */ - cvx = ox - PRELOAD * wsd->item_width; - cvy = oy - PRELOAD * wsd->item_height; - cvw = vw + 2 * PRELOAD * wsd->item_width; - cvh = vh + 2 * PRELOAD * wsd->item_height; + cvx = cvx - PRELOAD * wsd->item_width; + cvy = cvy - PRELOAD * wsd->item_height; + cvw = cvw + 2 * PRELOAD * wsd->item_width; + cvh = cvh + 2 * PRELOAD * wsd->item_height; items_count = wsd->item_count - eina_list_count(wsd->group_items) + wsd->items_lost; -- 2.7.4