From 38902ef2919f0bc303e81081c5275412114fed8e Mon Sep 17 00:00:00 2001 From: Subhransu Mohanty Date: Mon, 23 Nov 2015 10:43:46 +0900 Subject: [PATCH] efl: change efl_gfx_shape_cubic_to() api signature to follow other API (cairo and freetype). Signed-off-by: Cedric BAIL --- src/examples/evas/evas-vg-simple.c | 4 +-- src/lib/ector/cairo/ector_renderer_cairo_shape.c | 8 ++--- .../ector/software/ector_renderer_software_shape.c | 9 ++--- src/lib/efl/interfaces/efl_gfx_shape.c | 40 +++++++++++----------- src/lib/efl/interfaces/efl_gfx_shape.eo | 4 +-- 5 files changed, 30 insertions(+), 35 deletions(-) diff --git a/src/examples/evas/evas-vg-simple.c b/src/examples/evas/evas-vg-simple.c index 96afcb1..17416eb 100644 --- a/src/examples/evas/evas-vg-simple.c +++ b/src/examples/evas/evas-vg-simple.c @@ -370,9 +370,9 @@ void _arcto(Efl_VG *obj, int x, int y, int width, int height, int startAngle, in for (i = 0; i < point_count; i += 3) { evas_vg_shape_shape_append_cubic_to(obj, - pts[i+2].x, pts[i+2].y, pts[i].x, pts[i].y, - pts[i+1].x, pts[i+1].y); + pts[i+1].x, pts[i+1].y, + pts[i+2].x, pts[i+2].y); } evas_vg_shape_shape_append_close(obj); } diff --git a/src/lib/ector/cairo/ector_renderer_cairo_shape.c b/src/lib/ector/cairo/ector_renderer_cairo_shape.c index a174cd1..aafec7b 100644 --- a/src/lib/ector/cairo/ector_renderer_cairo_shape.c +++ b/src/lib/ector/cairo/ector_renderer_cairo_shape.c @@ -130,12 +130,10 @@ _ector_renderer_cairo_shape_ector_renderer_generic_base_prepare(Eo *obj, Ector_R pts += 2; break; case EFL_GFX_PATH_COMMAND_TYPE_CUBIC_TO: - // Be careful, we do have a different order than - // cairo, first is destination point, followed by - // the control point. The opposite of cairo. + cairo_curve_to(pd->parent->cairo, - pts[2], pts[3], pts[4], pts[5], // control points - pts[0], pts[1]); // destination point + pts[0], pts[1], pts[2], pts[3], // control points + pts[4], pts[5]); // destination point pts += 6; break; diff --git a/src/lib/ector/software/ector_renderer_software_shape.c b/src/lib/ector/software/ector_renderer_software_shape.c index a9a8c95..2d4947e 100644 --- a/src/lib/ector/software/ector_renderer_software_shape.c +++ b/src/lib/ector/software/ector_renderer_software_shape.c @@ -224,12 +224,9 @@ _generate_outline(const Efl_Gfx_Path_Command *cmds, const double *pts, Outline * break; case EFL_GFX_PATH_COMMAND_TYPE_CUBIC_TO: - // Be careful, we do have a different order than - // freetype first is destination point, followed by - // the control point. The opposite of cairo. _outline_cubic_to(outline, - pts[2], pts[3], pts[4], pts[5], // control points - pts[0], pts[1]); // destination point + pts[0], pts[1], pts[2], pts[3], // control points + pts[4], pts[5]); // destination point pts += 6; break; @@ -474,7 +471,7 @@ _generate_dashed_outline(const Efl_Gfx_Path_Command *cmds, const double *pts, Ou pts += 2; break; case EFL_GFX_PATH_COMMAND_TYPE_CUBIC_TO: - _dasher_cubic_to(&dasher, pts[2], pts[3], pts[4], pts[5], pts[0], pts[1]); + _dasher_cubic_to(&dasher, pts[0], pts[1], pts[2], pts[3], pts[4], pts[5]); pts += 6; break; diff --git a/src/lib/efl/interfaces/efl_gfx_shape.c b/src/lib/efl/interfaces/efl_gfx_shape.c index 364bd44..9fe4d9e 100644 --- a/src/lib/efl/interfaces/efl_gfx_shape.c +++ b/src/lib/efl/interfaces/efl_gfx_shape.c @@ -498,9 +498,9 @@ _efl_gfx_shape_append_line_to(Eo *obj, Efl_Gfx_Shape_Data *pd, static void _efl_gfx_shape_append_cubic_to(Eo *obj, Efl_Gfx_Shape_Data *pd, - double x, double y, double ctrl_x0, double ctrl_y0, - double ctrl_x1, double ctrl_y1) + double ctrl_x1, double ctrl_y1, + double x, double y) { double *offset_point; @@ -508,12 +508,12 @@ _efl_gfx_shape_append_cubic_to(Eo *obj, Efl_Gfx_Shape_Data *pd, pd, &offset_point)) return ; - offset_point[0] = x; - offset_point[1] = y; - offset_point[2] = ctrl_x0; - offset_point[3] = ctrl_y0; - offset_point[4] = ctrl_x1; - offset_point[5] = ctrl_y1; + offset_point[0] = ctrl_x0; + offset_point[1] = ctrl_y0; + offset_point[2] = ctrl_x1; + offset_point[3] = ctrl_y1; + offset_point[4] = x; + offset_point[5] = y; pd->current.x = x; pd->current.y = y; @@ -542,8 +542,8 @@ _efl_gfx_shape_append_scubic_to(Eo *obj, Efl_Gfx_Shape_Data *pd, ctrl_x0 = 2 * current_x - current_ctrl_x; ctrl_y0 = 2 * current_y - current_ctrl_y; - _efl_gfx_shape_append_cubic_to(obj, pd, x, y, - ctrl_x0, ctrl_y0, ctrl_x, ctrl_y); + _efl_gfx_shape_append_cubic_to(obj, pd, ctrl_x0, ctrl_y0, + ctrl_x, ctrl_y, x, y); } static void @@ -563,8 +563,8 @@ _efl_gfx_shape_append_quadratic_to(Eo *obj, Efl_Gfx_Shape_Data *pd, ctrl_x1 = (x + 2 * ctrl_x) * (1.0 / 3.0); ctrl_y1 = (y + 2 * ctrl_y) * (1.0 / 3.0); - _efl_gfx_shape_append_cubic_to(obj, pd, x, y, - ctrl_x0, ctrl_y0, ctrl_x1, ctrl_y1); + _efl_gfx_shape_append_cubic_to(obj, pd, ctrl_x0, ctrl_y0, + ctrl_x1, ctrl_y1, x, y); } static void @@ -589,9 +589,9 @@ _efl_gfx_shape_append_squadratic_to(Eo *obj, Efl_Gfx_Shape_Data *pd, ctrl_x1 = (x + 2 * xc) * (1.0 / 3.0); ctrl_y1 = (y + 2 * yc) * (1.0 / 3.0); - _efl_gfx_shape_append_cubic_to(obj, pd, x, y, - ctrl_x0, ctrl_y0, - ctrl_x1, ctrl_y1); + _efl_gfx_shape_append_cubic_to(obj, pd, ctrl_x0, ctrl_y0, + ctrl_x1, ctrl_y1, + x, y); } /* @@ -770,7 +770,7 @@ _efl_gfx_shape_append_arc_to(Eo *obj, Efl_Gfx_Shape_Data *pd, c2x = ex + bcp * (cos_phi_rx * sin_theta2 + sin_phi_ry * cos_theta2); c2y = ey + bcp * (sin_phi_rx * sin_theta2 - cos_phi_ry * cos_theta2); - _efl_gfx_shape_append_cubic_to(obj, pd, ex, ey, c1x, c1y, c2x, c2y); + _efl_gfx_shape_append_cubic_to(obj, pd, c1x, c1y, c2x, c2y, ex, ey); // next start point is the current end point (same for angle) sx = ex; @@ -1076,9 +1076,9 @@ _efl_gfx_shape_append_arc(Eo *obj, Efl_Gfx_Shape_Data *pd, for (i = 0; i < point_count; i += 3) { _efl_gfx_shape_append_cubic_to(obj, pd, - pts[i+2].x, pts[i+2].y, pts[i].x, pts[i].y, - pts[i+1].x, pts[i+1].y); + pts[i+1].x, pts[i+1].y, + pts[i+2].x, pts[i+2].y); } } @@ -1292,7 +1292,7 @@ static Eina_Bool _efl_gfx_path_parse_six_to(const char *content, char **end, Eo *obj, Efl_Gfx_Shape_Data *pd, double *current_x, double *current_y, - void (*func)(Eo *obj, Efl_Gfx_Shape_Data *pd, double x, double y, double ctrl_x0, double ctrl_y0, double ctrl_x1, double ctrl_y1), + void (*func)(Eo *obj, Efl_Gfx_Shape_Data *pd, double ctrl_x0, double ctrl_y0, double ctrl_x1, double ctrl_y1, double x, double y), Eina_Bool rel) { double x, y, ctrl_x0, ctrl_y0, ctrl_x1, ctrl_y1; @@ -1317,7 +1317,7 @@ _efl_gfx_path_parse_six_to(const char *content, char **end, ctrl_x1 += *current_x; ctrl_y1 += *current_y; } - func(obj, pd, x, y, ctrl_x0, ctrl_y0, ctrl_x1, ctrl_y1); + func(obj, pd, ctrl_x0, ctrl_y0, ctrl_x1, ctrl_y1, x, y); content = *end; *current_x = x; diff --git a/src/lib/efl/interfaces/efl_gfx_shape.eo b/src/lib/efl/interfaces/efl_gfx_shape.eo index 4943522..f70571e 100644 --- a/src/lib/efl/interfaces/efl_gfx_shape.eo +++ b/src/lib/efl/interfaces/efl_gfx_shape.eo @@ -280,12 +280,12 @@ mixin Efl.Gfx.Shape @since 1.14 ]] params { - @in x: double; [[X co-ordinate of end point of the line.]] - @in y: double; [[Y co-ordinate of end point of the line.]] @in ctrl_x0: double; [[X co-ordinate of 1st control point.]] @in ctrl_y0: double; [[Y co-ordinate of 1st control point.]] @in ctrl_x1: double; [[X co-ordinate of 2nd control point.]] @in ctrl_y1: double; [[Y co-ordinate of 2nd control point.]] + @in x: double; [[X co-ordinate of end point of the line.]] + @in y: double; [[Y co-ordinate of end point of the line.]] } } append_scubic_to { -- 2.7.4