evas vg: Fixed container alpha settings. 69/254569/1
authorMichal Szczecinski <m.szczecinsk@partner.samsung.com>
Thu, 4 Mar 2021 20:23:16 +0000 (21:23 +0100)
committerMichal Szczecinski <m.szczecinsk@partner.samsung.com>
Thu, 4 Mar 2021 20:23:16 +0000 (21:23 +0100)
This commit fixes rendering issues of SVG's with opacity and color
defined in <g> node type.

Change-Id: I5de54ec9cde3a931ce4920c9a5f91f1c73adb0ae

src/lib/evas/canvas/efl_canvas_vg_container.c
src/lib/evas/canvas/efl_canvas_vg_container.eo
src/static_libs/vg_common/vg_common_svg.c

index f84ba06..d0c6d78 100644 (file)
@@ -176,9 +176,11 @@ _efl_canvas_vg_container_render_pre_tvg(Evas_Object_Protected_Data *obj,
    if (!nd->visibility)
       return;
 
-   if (scene)
+   if (nd->a < 255) tvg_paint_set_opacity(cd->scene, nd->a);
+
+   if (scene != NULL)
      tvg_scene_push(scene, cd->scene);
-   else if (canvas)
+   else if (scene == NULL && canvas != NULL)
      tvg_canvas_push(canvas, cd->scene);
 
    EFL_CANVAS_VG_COMPUTE_MATRIX(cTransform, pTransform, nd);
@@ -383,17 +385,6 @@ _efl_canvas_vg_container_efl_gfx_path_bounds_get(const Eo *obj EINA_UNUSED,
      }
 }
 
-static void
-_efl_canvas_vg_container_efl_gfx_color_color_set(Eo *obj, Efl_Canvas_Vg_Container_Data *pd, int r, int g, int b, int a)
-{
-   efl_gfx_color_set(efl_super(obj, MY_CLASS), r, g, b, a);
-
-#ifdef HAVE_THORVG
-   if (pd->scene) tvg_paint_set_opacity(pd->scene, a);
-#endif
-}
-
-
 static Efl_VG *
 _efl_canvas_vg_container_child_get(Eo *obj EINA_UNUSED, Efl_Canvas_Vg_Container_Data *pd, const char *name)
 {
index 70305d7..6865ecd 100644 (file)
@@ -24,7 +24,6 @@ class @beta Efl.Canvas.Vg.Container extends Efl.Canvas.Vg.Node
       Efl.Object.parent { set; }
       Efl.Gfx.Path.bounds_get;
       Efl.Gfx.Path.interpolate;
-      Efl.Gfx.Color.color { set; }
       Efl.Duplicate.duplicate;
       Efl.Canvas.Vg.Node.comp_method { set; }
    }
index 5dd4830..3313432 100644 (file)
@@ -1101,7 +1101,10 @@ _apply_svg_property(Svg_Node *node, Efl_VG *vg)
 
    node->display = evas_vg_node_visible_get(vg);
 
-   if (node->type == SVG_NODE_G) return;
+   if (node->type == SVG_NODE_G) {
+      evas_vg_node_color_get(vg, NULL, NULL, NULL, &style->opacity);
+      return;
+   }
 
    // apply the fill style property
 #ifndef HAVE_THORVG