diff --git a/source/plutovg-path.c b/source/plutovg-path.c index a8d7d7d..7aabb43 100644 --- a/source/plutovg-path.c +++ b/source/plutovg-path.c @@ -118,8 +118,6 @@ void plutovg_path_quad_to(plutovg_path_t* path, float x1, float y1, float x2, fl { float current_x, current_y; plutovg_path_get_current_point(path, ¤t_x, ¤t_y); - if(path->elements.size == 0) - plutovg_path_move_to(path, 0, 0); float cx = 2.f / 3.f * x1 + 1.f / 3.f * current_x; float cy = 2.f / 3.f * y1 + 1.f / 3.f * current_y; float cx1 = 2.f / 3.f * x1 + 1.f / 3.f * x2; @@ -145,8 +143,6 @@ void plutovg_path_arc_to(plutovg_path_t* path, float rx, float ry, float angle, { float current_x, current_y; plutovg_path_get_current_point(path, ¤t_x, ¤t_y); - if(path->elements.size == 0) - plutovg_path_move_to(path, 0, 0); if(rx == 0.f || ry == 0.f || (current_x == x && current_y == y)) { plutovg_path_line_to(path, x, y); return; @@ -215,19 +211,19 @@ void plutovg_path_arc_to(plutovg_path_t* path, float rx, float ry, float angle, float x3 = cosf(th_end) + cx1; float y3 = sinf(th_end) + cy1; - float x2 = x3 + t * sinf(th_end); - float y2 = y3 - t * cosf(th_end); + float cp2x = x3 + t * sinf(th_end); + float cp2y = y3 - t * cosf(th_end); - float x1 = cosf(th_start) - t * sinf(th_start); - float y1 = sinf(th_start) + t * cosf(th_start); + float cp1x = cosf(th_start) - t * sinf(th_start); + float cp1y = sinf(th_start) + t * cosf(th_start); - x1 += cx1; - y1 += cy1; + cp1x += cx1; + cp1y += cy1; - plutovg_matrix_map(&matrix, x1, y1, &x1, &y1); - plutovg_matrix_map(&matrix, x2, y2, &x2, &y2); + plutovg_matrix_map(&matrix, cp1x, cp1y, &cp1x, &cp1y); + plutovg_matrix_map(&matrix, cp2x, cp2y, &cp2x, &cp2y); plutovg_matrix_map(&matrix, x3, y3, &x3, &y3); - plutovg_path_cubic_to(path, x1, y1, x2, y2, x3, y3); + plutovg_path_cubic_to(path, cp1x, cp1y, cp2x, cp2y, x3, y3); } }