vg_common_json: No path information, do not create a shape 77/268377/1 submit/tizen/20211227.021527
authorJunsuChoi <jsuya.choi@samsung.com>
Wed, 22 Dec 2021 04:18:26 +0000 (20:18 -0800)
committerJunsuChoi <jsuya.choi@samsung.com>
Wed, 22 Dec 2021 04:29:32 +0000 (20:29 -0800)
Change-Id: Ic016bf3e41d8fd706c31973a78b3c6825d0941b4

src/static_libs/vg_common/vg_common_json.c

index d79a737..b28ba66 100644 (file)
@@ -53,13 +53,16 @@ _construct_drawable_nodes(Tvg_Paint *parent, const LOTLayerNode *layer, int dept
         const float *data = node->mPath.ptPtr;
         if (!data) continue;
 
-        Tvg_Paint* shape = tvg_shape_new();
 
         //0: Path
         uint32_t cmdCnt = node->mPath.elmCount;
         uint32_t ptsCnt = node->mPath.ptCount * sizeof(float) / sizeof(Tvg_Point);
-        Tvg_Path_Command cmds[cmdCnt];
-        Tvg_Point pts[ptsCnt];
+        if (cmdCnt == 0 || ptsCnt == 0) continue;
+
+        Tvg_Paint* shape = tvg_shape_new();
+
+        Tvg_Path_Command* cmds = static_cast<Tvg_Path_Command*>(alloca(sizeof(Tvg_Path_Command) * cmdCnt));
+        Tvg_Point* pts = static_cast<Tvg_Point*>(alloca(sizeof(Tvg_Point) * ptsCnt));
 
         uint32_t cmd_i = 0, pts_i = 0;
         for (uint32_t i = 0; i < cmdCnt; i++)
@@ -211,13 +214,16 @@ _construct_mask_nodes(Tvg_Paint *parent, LOTMask *mask, int depth EINA_UNUSED)
    const float *data = mask->mPath.ptPtr;
    if (!data) return;
 
-   Tvg_Paint* shape = tvg_shape_new();
 
    //Path
    uint32_t cmdCnt = mask->mPath.elmCount;
    uint32_t ptsCnt = mask->mPath.ptCount * sizeof(float) / sizeof(Tvg_Point);
-   Tvg_Path_Command cmds[cmdCnt];
-   Tvg_Point pts[ptsCnt];
+   if (cmdCnt == 0 || ptsCnt == 0) return;
+
+   Tvg_Paint* shape = tvg_shape_new();
+
+   Tvg_Path_Command* cmds = static_cast<Tvg_Path_Command*>(alloca(sizeof(Tvg_Path_Command) * cmdCnt));
+   Tvg_Point* pts = static_cast<Tvg_Point*>(alloca(sizeof(Tvg_Point) * ptsCnt));
 
    uint32_t cmd_i = 0, pts_i = 0;
    for (uint32_t i = 0; i < cmdCnt; i++)