evas vg: Enabled composition for containers. 84/256184/2
authorMichal Szczecinski <m.szczecinsk@partner.samsung.com>
Tue, 30 Mar 2021 12:02:22 +0000 (14:02 +0200)
committerHermet Park <chuneon.park@samsung.com>
Fri, 16 Apr 2021 06:28:50 +0000 (06:28 +0000)
Use tvg_paint_set_composite_method() for scenes. Currently because of
other issues only MATTE_ALPHA method is supported.

Change-Id: I2f42d28e5ae71ebd56c4c3057287461d0ad80e34

src/lib/evas/canvas/efl_canvas_vg_container.c

index 53e41ec..5f4f36c 100644 (file)
@@ -186,6 +186,14 @@ _efl_canvas_vg_container_render_pre_tvg(Evas_Object_Protected_Data *obj,
           cnd->render_pre_tvg(obj, child, cnd, cTransform, canvas, cd->scene);
      }
 
+   //We don't want to push composition sources
+   //FIX_TVG: when thorvg will be default, Vg_Comp structure with additional buffer and pixels
+   //will be removed. Then we can use only one boolean to verify if render_pre is called for
+   //composite object
+
+   //FIX_TVG: or maybe we can avoid to call render_pre for composite objects?
+   if (cd->comp.src) return;
+
    if (scene) tvg_scene_push(scene, cd->scene);
    else if (canvas) tvg_canvas_push(canvas, cd->scene);
 }
@@ -479,6 +487,11 @@ _efl_canvas_vg_container_efl_canvas_vg_node_comp_method_set(Eo *obj,
      {
         Efl_Canvas_Vg_Container_Data *pd2 = efl_data_scope_get(target, MY_CLASS);
         pd2->comp.src = eina_list_append(pd2->comp.src, obj);
+#ifdef HAVE_THORVG
+        //FIX_TVG: currently only matte alpha is supported. Observed crash in thorvg when CLIP_PATH method is used.
+        if (method == EFL_GFX_VG_COMPOSITE_METHOD_MATTE_ALPHA)
+          tvg_paint_set_composite_method(pd->scene, pd2->scene, TVG_COMPOSITE_METHOD_ALPHA_MASK);
+#endif
      }
 
    pd->comp.method = method;