From c29634026f26bb4a006a09a19d12fd9f386aa1c4 Mon Sep 17 00:00:00 2001 From: Michal Maciola Date: Fri, 24 Sep 2021 14:02:33 +0200 Subject: [PATCH] evas vg: fix for invisible masking layer 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 | 45 +++++++++++++++++------------- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/src/static_libs/vg_common/vg_common_json.c b/src/static_libs/vg_common/vg_common_json.c index 7bc1ec8..3e44258 100644 --- a/src/static_libs/vg_common/vg_common_json.c +++ b/src/static_libs/vg_common/vg_common_json.c @@ -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 -- 2.7.4