evas vg: fix for invisible masking layer 72/264572/3 accepted/tizen/unified/20211001.001525 submit/tizen/20210928.074404
authorMichal Maciola <m.maciola@samsung.com>
Fri, 24 Sep 2021 12:02:33 +0000 (14:02 +0200)
committerHermet Park <chuneon.park@samsung.com>
Mon, 27 Sep 2021 04:20:59 +0000 (04:20 +0000)
This patch solves the problem of masking on layers that visibility
is set to false.

Change-Id: I0d96362709e551d8dadf151d7fd79ddb39e8ce7d

src/static_libs/vg_common/vg_common_json.c

index 7bc1ec8..3e44258 100644 (file)
@@ -31,7 +31,7 @@ _construct_drawable_nodes(Tvg_Paint *parent, const LOTLayerNode *layer, int dept
 
 #if DEBUG
         for (int i = 0; i < depth; i++) printf("    ");
-        printf("[node %03d] type:%s\n", i, (node->mImageInfo.data)?"image":"shape");
+        printf("[node %03d] type:%s keypath:%s\n", i, (node->mImageInfo.data)?"image":"shape", node->keypath);
 #endif
 
         //Image object
@@ -318,29 +318,35 @@ _update_vg_tree(Tvg_Paint *root, const LOTLayerNode *layer, int depth EINA_UNUSE
      {
         LOTLayerNode *clayer = layer->mLayerList.ptr[i];
 
+        if (!clayer->mVisible)
+          {
+             if (ptree && matte_mode != TVG_COMPOSITE_METHOD_NONE)
+               tvg_paint_set_opacity(ptree, 0);
+             matte_mode = TVG_COMPOSITE_METHOD_NONE;
+             mtarget = NULL;
+             continue;
+          }
+
 #if DEBUG
         for (int i = 0; i < depth; i++) printf("    ");
-        printf("[layer %03d] matte:%d\n", i, matte_mode);
+        printf("[layer %03d] matte:%d keypath:%s%s\n", i, matte_mode, clayer->keypath, clayer->mVisible?"":" visible:FALSE");
 #endif
 
-        if ((clayer->mLayerList.size > 0 || clayer->mNodeList.size > 0) && clayer->mVisible)
-          {
-             //Source Layer
-             Tvg_Paint *ctree = tvg_scene_new();
-             _update_vg_tree(ctree, clayer, depth+1);
+        //Source Layer
+        Tvg_Paint *ctree = tvg_scene_new();
+        _update_vg_tree(ctree, clayer, depth+1);
 
-             if (matte_mode == TVG_COMPOSITE_METHOD_NONE)
-               {
-                  tvg_scene_push(root, ctree);
-               }
-             else
-               {
-                  tvg_paint_set_composite_method(ptree, ctree, matte_mode);
-                  mtarget = ctree;
-               }
-
-             ptree = ctree;
+        if (matte_mode == TVG_COMPOSITE_METHOD_NONE)
+          {
+             tvg_scene_push(root, ctree);
           }
+        else
+          {
+             tvg_paint_set_composite_method(ptree, ctree, matte_mode);
+             mtarget = ctree;
+          }
+
+        ptree = ctree;
 
         //Remap Matte Mode
         switch (clayer->mMatte)
@@ -506,8 +512,7 @@ vg_common_json_create_vg_node(Vg_File_Data *vfd)
    cd->master_scene = EINA_TRUE;
 
    tvg_scene_clear(cd->scene, EINA_TRUE);
-   if (!tree->mVisible) return EINA_TRUE;
-   _update_vg_tree(cd->scene, tree, 1);
+   if (tree->mVisible) _update_vg_tree(cd->scene, tree, 1);
 
    return EINA_TRUE;
 #else