evas vg: fixing the compatibility issue 92/256592/2
authorMira Grudzinska <m.grudzinska@samsung.com>
Wed, 7 Apr 2021 21:02:25 +0000 (23:02 +0200)
committerChun <jykeon@samsung.com>
Thu, 8 Apr 2021 11:00:21 +0000 (11:00 +0000)
The current point set after appending the rectangle is different
for the rectangles with sharp or with rounded corners. The same logic
is applied to the version using ThorVG.

Change-Id: Id2908a248b4f9803989d31b2073300f92bba0fc9

src/lib/evas/canvas/efl_canvas_vg_shape.c

index fddf4be..5409afc 100644 (file)
@@ -488,6 +488,12 @@ _shape_properties_interpolate(Evas_Vg_Shape *obj,
    tvg_shape_get_stroke_join(sd_to->shape, &join_to);
    (pos_map < 0.5) ? tvg_shape_set_stroke_join(sd->shape, join) : tvg_shape_set_stroke_join(sd->shape, join_to);
 
+   // Current points
+   sd->curr.x = _interpolate(sd_from->curr.x, sd_to->curr.x, pos_map);
+   sd->curr.y = _interpolate(sd_from->curr.y, sd_to->curr.y, pos_map);
+   sd->curr_ctrl.x = _interpolate(sd_from->curr_ctrl.x, sd_to->curr_ctrl.x, pos_map);
+   sd->curr_ctrl.y = _interpolate(sd_from->curr_ctrl.y, sd_to->curr_ctrl.y, pos_map);
+
    return EINA_TRUE;
 }
 
@@ -1518,8 +1524,16 @@ evas_vg_shape_append_rect(Evas_Vg_Shape *obj, double x, double y, double w, doub
    if (!sd || !sd->shape) return;
 
    tvg_shape_append_rect(sd->shape, x, y, w, h, rx, ry);
-   tvg_shape_move_to(sd->shape, x, y + ry);
-   _assign_current_point(sd, NULL, x, y + ry);
+   if (rx <= 0 || ry <= 0)
+     {
+        _assign_current_point(sd, NULL, x + w, y);
+     }
+   else
+     {
+        ry = 2 * ry > h ? h / 2 : ry;
+        _assign_current_point(sd, NULL, x, y + ry);
+        tvg_shape_move_to(sd->shape, x, y + h/2);
+     }
 #else
    efl_gfx_path_append_rect(obj, x, y, w, h, rx, ry);
 #endif