From: Mira Grudzinska Date: Tue, 22 Dec 2020 16:15:45 +0000 (+0100) Subject: evas vector: changes reconciling the differences in the direction of arc drawing... X-Git-Tag: accepted/tizen/unified/20210104.130306~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e5e3b1b1a72d0f2d9985fc8bfbc63f4f04a5d1cc;p=platform%2Fupstream%2Fefl.git evas vector: changes reconciling the differences in the direction of arc drawing in EFL and ThorVG Since EFL and ThorVG draw arcs anti-clockwise and clockwise, respectively, it was necessary to change the sign of angles in a ThorVG function call. The current point has been properly assigned in the arc drawing API. Change-Id: I397afdd8213713f32f537c2dfb9f0d2b5b920ef4 --- diff --git a/src/lib/evas/canvas/efl_canvas_vg_shape.c b/src/lib/evas/canvas/efl_canvas_vg_shape.c index 91a80b3..e2e2ef5 100644 --- a/src/lib/evas/canvas/efl_canvas_vg_shape.c +++ b/src/lib/evas/canvas/efl_canvas_vg_shape.c @@ -1422,12 +1422,13 @@ evas_vg_shape_append_arc(Evas_Vg_Shape *obj, double x, double y, double w, doubl sd = _get_shape_data(obj); if (!sd || !sd->shape) return; - float radius = fmin(w / 2.0f, h / 2.0f); - float cx = x + (w / 2.0f); - float cy = y + (h / 2.0f); + double radius = fmin(w / 2.0f, h / 2.0f); + double cx = x + (w / 2.0f); + double cy = y + (h / 2.0f); - tvg_shape_append_arc(sd->shape, cx, cy, radius, start_angle, sweep_length, 0); - _assign_current_point(sd, NULL, cx, cy); + tvg_shape_append_arc(sd->shape, cx, cy, radius, -start_angle, -sweep_length, 0); + _assign_current_point(sd, NULL, cx + radius*cos((start_angle + sweep_length) * M_PI / 180), + cy - radius*sin((start_angle + sweep_length) * M_PI / 180)); #endif efl_canvas_vg_node_change(obj); } diff --git a/src/lib/evas/canvas/evas_tvg_path_helpers.h b/src/lib/evas/canvas/evas_tvg_path_helpers.h index f27d602..99234d6 100644 --- a/src/lib/evas/canvas/evas_tvg_path_helpers.h +++ b/src/lib/evas/canvas/evas_tvg_path_helpers.h @@ -436,10 +436,10 @@ _process_command(Efl_Tvg_Shape_Svg_Path *svg_path, char c, double *pts, case 'q': case 'Q': { - float ctrl_x0 = (*cur_x + 2 * pts[0]) * (1.0 / 3.0); - float ctrl_y0 = (*cur_y + 2 * pts[1]) * (1.0 / 3.0); - float ctrl_x1 = (pts[2] + 2 * pts[0]) * (1.0 / 3.0); - float ctrl_y1 = (pts[3] + 2 * pts[1]) * (1.0 / 3.0); + double ctrl_x0 = (*cur_x + 2 * pts[0]) * (1.0 / 3.0); + double ctrl_y0 = (*cur_y + 2 * pts[1]) * (1.0 / 3.0); + double ctrl_x1 = (pts[2] + 2 * pts[0]) * (1.0 / 3.0); + double ctrl_y1 = (pts[3] + 2 * pts[1]) * (1.0 / 3.0); if (!_svg_path_grow(svg_path, 3)) break; svg_path->pts[svg_path->pts_cnt-3].x = ctrl_x0; svg_path->pts[svg_path->pts_cnt-3].y = ctrl_y0;