common json: fix for an empty layer used as a mask 35/264235/2 accepted/tizen/unified/20210916.123547 submit/tizen/20210915.070054
authorMichal Maciola <m.maciola@samsung.com>
Tue, 14 Sep 2021 14:51:32 +0000 (16:51 +0200)
committerHermet Park <chuneon.park@samsung.com>
Wed, 15 Sep 2021 02:39:25 +0000 (02:39 +0000)
If a layer is empty, do not use it as a mask, so not to incorrectly completely
hide a parent layer.

Change-Id: Ia48b0b150faa3a1fd44cc79c16facab14ab00564

src/static_libs/vg_common/vg_common_json.c

index 7664494..6a3fef3 100644 (file)
@@ -301,10 +301,10 @@ _construct_masks(Tvg_Paint *mtarget, LOTMask *masks, unsigned int mask_cnt, int
    return mtarget;
 }
 
-static void
+static Eina_Bool
 _update_vg_tree(Tvg_Paint *root, const LOTLayerNode *layer, int depth EINA_UNUSED)
 {
-   if (!layer->mVisible) return;
+   if (!layer->mVisible) return EINA_FALSE;
 
    Tvg_Paint *ptree = NULL;
 
@@ -327,13 +327,13 @@ _update_vg_tree(Tvg_Paint *root, const LOTLayerNode *layer, int depth EINA_UNUSE
 
         //Source Layer
         Tvg_Paint *ctree = tvg_scene_new();
-        _update_vg_tree(ctree, clayer, depth+1);
+        Eina_Bool hastree = _update_vg_tree(ctree, clayer, depth+1);
 
         if (matte_mode == TVG_COMPOSITE_METHOD_NONE)
           {
              tvg_scene_push(root, ctree);
           }
-        else
+        else if (hastree == EINA_TRUE)
           {
              tvg_paint_set_composite_method(ptree, ctree, matte_mode);
              mtarget = ctree;
@@ -382,6 +382,8 @@ _update_vg_tree(Tvg_Paint *root, const LOTLayerNode *layer, int depth EINA_UNUSE
    //Construct drawable nodes.
    if (layer->mNodeList.size > 0)
      _construct_drawable_nodes(root, layer, depth);
+
+   return layer->mLayerList.size || layer->mNodeList.size;
 }
 #endif