vg_common_json: Fix to duplication of mask and matte.
authorJunsuChoi <jsuya.choi@samsung.com>
Tue, 25 Feb 2020 02:54:57 +0000 (11:54 +0900)
committerHermet Park <hermetpark@gmail.com>
Tue, 25 Feb 2020 02:56:15 +0000 (11:56 +0900)
Summary:
There is a case that uses a mask and a mat at the same time.
One of them did not apply. This patch modifies two attributes to be parent-child.

Test Plan: N/A

Reviewers: Hermet, smohanty, kimcinoo

Reviewed By: Hermet

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D11399

Change-Id: I14b1e2ab38c042c6845b2232ca8a7b79abccc8c6

src/static_libs/vg_common/vg_common_json.c

index 2092b85..f7b3e9d 100644 (file)
@@ -311,7 +311,7 @@ _construct_mask_nodes(Efl_Canvas_Vg_Container *parent, LOTMask *mask, int depth
    efl_gfx_color_set(shape, r, g, b, a);
 }
 
-static void
+static Efl_Canvas_Vg_Container*
 _construct_masks(Efl_Canvas_Vg_Container *mtarget, LOTMask *masks, unsigned int mask_cnt, int depth)
 {
    char *key = NULL;
@@ -329,7 +329,7 @@ _construct_masks(Efl_Canvas_Vg_Container *mtarget, LOTMask *masks, unsigned int
 
 #if DEBUG
         for (int i = 0; i < depth; i++) printf("    ");
-        printf("%s (%p), mask => %p\n", efl_class_name_get(efl_class_get(msource)), msource, mtarget);
+        printf("%s (%p), base mask => %p\n", efl_class_name_get(efl_class_get(msource)), msource, mtarget);
         depth++;
 #endif
 
@@ -356,7 +356,7 @@ _construct_masks(Efl_Canvas_Vg_Container *mtarget, LOTMask *masks, unsigned int
 
 #if DEBUG
         for (int i = 0; i < depth; i++) printf("    ");
-        printf("%s (%p), mask:%d => %p\n", efl_class_name_get(efl_class_get(msource)), msource, mask->mMode, mtarget);
+        printf("%s (%p), real mask:%d => %p\n", efl_class_name_get(efl_class_get(msource)), msource, mask->mMode, mtarget);
 #endif
 
         _construct_mask_nodes(msource, mask, depth + 1);
@@ -381,6 +381,7 @@ _construct_masks(Efl_Canvas_Vg_Container *mtarget, LOTMask *masks, unsigned int
         efl_canvas_vg_node_comp_method_set(mtarget, msource, mask_mode);
         mtarget = msource;
      }
+   return mtarget;
 }
 
 static void
@@ -432,7 +433,7 @@ _update_vg_tree(Efl_Canvas_Vg_Container *root, const LOTLayerNode *layer, int de
           }
 #if DEBUG
         for (int i = 0; i < depth; i++) printf("    ");
-        printf("%s (%p) matte:%d => %p\n", efl_class_name_get(efl_class_get(ctree)), ctree, matte_mode, ptree);
+        printf("%s (%p) matte:%d => %p %s\n", efl_class_name_get(efl_class_get(ctree)), ctree, matte_mode, ptree, clayer->keypath);
 #endif
         _update_vg_tree(ctree, clayer, depth+1);
 
@@ -448,6 +449,8 @@ _update_vg_tree(Efl_Canvas_Vg_Container *root, const LOTLayerNode *layer, int de
              mlayer = clayer;
              if (!mtarget) mtarget = ctree;
           }
+        else
+           mtarget = NULL;
 
         ptree = ctree;
 
@@ -475,15 +478,16 @@ _update_vg_tree(Efl_Canvas_Vg_Container *root, const LOTLayerNode *layer, int de
               matte_mode = 0;
               break;
           }
+
+        //Construct node that have mask.
+        if (mlayer && mtarget)
+          ptree = _construct_masks(mtarget, mlayer->mMaskList.ptr, mlayer->mMaskList.size, depth + 1);
      }
 
    //Construct drawable nodes.
    if (layer->mNodeList.size > 0)
      _construct_drawable_nodes(root, layer, depth);
 
-   //Construct node that have mask.
-   if (mlayer)
-     _construct_masks(mtarget, mlayer->mMaskList.ptr, mlayer->mMaskList.size, depth);
 }
 #endif