vg_load_svg: Add points copy of missing polygon/polyline 61/245561/1
authorJunsuChoi <jsuya.choi@samsung.com>
Mon, 12 Oct 2020 09:36:31 +0000 (18:36 +0900)
committerHermet Park <chuneon.park@samsung.com>
Mon, 12 Oct 2020 09:41:36 +0000 (18:41 +0900)
Summary:
When using <use> node, do atrribute copy.
At that time, when target(url) is polygon or polyline,
points array is not copied, causing a problem in output.
So, add missing array copy.

Test Plan:
 - Test SVG code

<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 64 64" enable-background="new 0 0 64 64" xml:space="preserve">
    <g opacity="0.5">
        <defs>
            <polygon id="test" opacity="0.5" points="41.8,14.5 22.2,14.5 22.2,22.8 41.8,40.7"/>
        </defs>
        <use xlink:href="#test"  overflow="visible"/>
    </g>
</svg>

Reviewers: Hermet, smohanty

Reviewed By: Hermet

Subscribers: #reviewers, #committers, kimcinoo, herb, cedric

Tags: #efl

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

Change-Id: Iecbed3a953d7e7465b54e9c648474ca8f9480e0a

src/modules/evas/vg_loaders/svg/evas_vg_load_svg.c

index 246e3e2..721851e 100644 (file)
@@ -1651,10 +1651,12 @@ _copy_attribute(Svg_Node *to, Svg_Node *from)
         case SVG_NODE_POLYGON:
            to->node.polygon.points_count = from->node.polygon.points_count;
            to->node.polygon.points = calloc(to->node.polygon.points_count, sizeof(double));
+           memcpy(to->node.polygon.points, from->node.polygon.points, to->node.polygon.points_count * sizeof(double));
            break;
         case SVG_NODE_POLYLINE:
            to->node.polyline.points_count = from->node.polyline.points_count;
            to->node.polyline.points = calloc(to->node.polyline.points_count, sizeof(double));
+           memcpy(to->node.polyline.points, from->node.polyline.points, to->node.polyline.points_count * sizeof(double));
            break;
         default:
            break;