Add realize policy canvas output for optimized lazy loading on scroller in gengrid... 32/250632/3
authorSangHyeon Jade Lee <sh10233.lee@samsung.com>
Wed, 30 Dec 2020 10:46:02 +0000 (19:46 +0900)
committerSangHyeon Jade Lee <sh10233.lee@samsung.com>
Wed, 30 Dec 2020 11:23:30 +0000 (20:23 +0900)
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 <sh10233.lee@samsung.com>
src/lib/elementary/elm_gengrid.c

index 0418c1e..dfe3f1a 100755 (executable)
@@ -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;