From 924a9fe8c21bb7784770b277f4bed50b24174462 Mon Sep 17 00:00:00 2001 From: Pepsin Ye Date: Sat, 2 Oct 2021 09:24:43 +0800 Subject: [PATCH] In WebAssembly, there's function signature check which don't allow mismatch parameter declarations, this causes Cairo built for Wasm have cairo_arc related API broken. --- src/cairo-clip-boxes.c | 5 +++-- src/cairo-debug.c | 3 ++- src/cairo-path-bounds.c | 3 ++- src/cairo-path-fill.c | 14 ++++++++------ src/cairo-path-fixed.c | 12 +++++++----- src/cairo-path-in-fill.c | 3 ++- src/cairo-path-stroke-boxes.c | 10 ++++++---- src/cairo-path-stroke-polygon.c | 9 +++++---- src/cairo-path-stroke-traps.c | 12 ++++++------ src/cairo-path-stroke-tristrip.c | 9 +++++---- src/cairo-path-stroke.c | 10 ++++++---- src/cairo-path.c | 6 ++++-- src/cairo-pdf-operators.c | 3 ++- src/cairo-script-surface.c | 3 ++- src/cairo-svg-surface.c | 3 ++- src/cairo-type1-fallback.c | 3 ++- src/cairoint.h | 3 ++- 17 files changed, 66 insertions(+), 45 deletions(-) diff --git a/src/cairo-clip-boxes.c b/src/cairo-clip-boxes.c index aaddeb7f7..2db3b1f6a 100644 --- a/src/cairo-clip-boxes.c +++ b/src/cairo-clip-boxes.c @@ -482,7 +482,8 @@ _add_edge (struct reduce *r, static cairo_status_t _reduce_line_to (void *closure, - const cairo_point_t *point) + const cairo_point_t *point, + const cairo_slope_t *tangent) { struct reduce *r = closure; @@ -497,7 +498,7 @@ _reduce_close (void *closure) { struct reduce *r = closure; - return _reduce_line_to (r, &r->last_move_to); + return _reduce_line_to (r, &r->last_move_to, NULL); } static cairo_status_t diff --git a/src/cairo-debug.c b/src/cairo-debug.c index 6acdea9dd..0f580ce0b 100644 --- a/src/cairo-debug.c +++ b/src/cairo-debug.c @@ -204,7 +204,8 @@ _print_move_to (void *closure, static cairo_status_t _print_line_to (void *closure, - const cairo_point_t *point) + const cairo_point_t *point, + const cairo_slope_t *tangent) { fprintf (closure, " %f %f l", diff --git a/src/cairo-path-bounds.c b/src/cairo-path-bounds.c index ac85f27be..b50d566ec 100644 --- a/src/cairo-path-bounds.c +++ b/src/cairo-path-bounds.c @@ -66,7 +66,8 @@ _cairo_path_bounder_move_to (void *closure, static cairo_status_t _cairo_path_bounder_line_to (void *closure, - const cairo_point_t *point) + const cairo_point_t *point, + const cairo_slope_t *tangent) { cairo_path_bounder_t *bounder = closure; diff --git a/src/cairo-path-fill.c b/src/cairo-path-fill.c index 4000c9c58..475e75d45 100644 --- a/src/cairo-path-fill.c +++ b/src/cairo-path-fill.c @@ -55,7 +55,8 @@ typedef struct cairo_filler { static cairo_status_t _cairo_filler_line_to (void *closure, - const cairo_point_t *point) + const cairo_point_t *point, + const cairo_slope_t *tangent) { cairo_filler_t *filler = closure; cairo_status_t status; @@ -75,7 +76,7 @@ _cairo_filler_close (void *closure) cairo_filler_t *filler = closure; /* close the subpath */ - return _cairo_filler_line_to (closure, &filler->last_move_to); + return _cairo_filler_line_to (closure, &filler->last_move_to, NULL); } static cairo_status_t @@ -109,14 +110,14 @@ _cairo_filler_curve_to (void *closure, if (filler->has_limits) { if (! _cairo_spline_intersects (&filler->current_point, p1, p2, p3, &filler->limit)) - return _cairo_filler_line_to (filler, p3); + return _cairo_filler_line_to (filler, p3, NULL); } if (! _cairo_spline_init (&spline, (cairo_spline_add_point_func_t)_cairo_filler_line_to, filler, &filler->current_point, p1, p2, p3)) { - return _cairo_filler_line_to (closure, p3); + return _cairo_filler_line_to (closure, p3, NULL); } return _cairo_spline_decompose (&spline, filler->tolerance); @@ -165,7 +166,8 @@ typedef struct cairo_filler_rectilinear_aligned { static cairo_status_t _cairo_filler_ra_line_to (void *closure, - const cairo_point_t *point) + const cairo_point_t *point, + const cairo_slope_t *tangent) { cairo_filler_ra_t *filler = closure; cairo_status_t status; @@ -187,7 +189,7 @@ static cairo_status_t _cairo_filler_ra_close (void *closure) { cairo_filler_ra_t *filler = closure; - return _cairo_filler_ra_line_to (closure, &filler->last_move_to); + return _cairo_filler_ra_line_to (closure, &filler->last_move_to, NULL); } static cairo_status_t diff --git a/src/cairo-path-fixed.c b/src/cairo-path-fixed.c index d74182346..5d0f786d5 100644 --- a/src/cairo-path-fixed.c +++ b/src/cairo-path-fixed.c @@ -828,7 +828,7 @@ _cairo_path_fixed_interpret (const cairo_path_fixed_t *path, points += 1; break; case CAIRO_PATH_OP_LINE_TO: - status = (*line_to) (closure, &points[0]); + status = (*line_to) (closure, &points[0], NULL); points += 1; break; case CAIRO_PATH_OP_CURVE_TO: @@ -871,7 +871,8 @@ _append_move_to (void *abstract_closure, static cairo_status_t _append_line_to (void *abstract_closure, - const cairo_point_t *point) + const cairo_point_t *point, + const cairo_slope_t *tangent) { cairo_path_fixed_append_closure_t *closure = abstract_closure; @@ -1125,13 +1126,14 @@ _cpf_move_to (void *closure, static cairo_status_t _cpf_line_to (void *closure, - const cairo_point_t *point) + const cairo_point_t *point, + const cairo_slope_t *tangent) { cpf_t *cpf = closure; cpf->current_point = *point; - return cpf->line_to (cpf->closure, point); + return cpf->line_to (cpf->closure, point, NULL); } static cairo_status_t @@ -1150,7 +1152,7 @@ _cpf_curve_to (void *closure, cpf->closure, p0, p1, p2, p3)) { - return _cpf_line_to (closure, p3); + return _cpf_line_to (closure, p3, NULL); } cpf->current_point = *p3; diff --git a/src/cairo-path-in-fill.c b/src/cairo-path-in-fill.c index 1787fb1a3..260272b2d 100644 --- a/src/cairo-path-in-fill.c +++ b/src/cairo-path-in-fill.c @@ -170,7 +170,8 @@ _cairo_in_fill_move_to (void *closure, static cairo_status_t _cairo_in_fill_line_to (void *closure, - const cairo_point_t *point) + const cairo_point_t *point, + const cairo_slope_t *tangent) { cairo_in_fill_t *in_fill = closure; diff --git a/src/cairo-path-stroke-boxes.c b/src/cairo-path-stroke-boxes.c index fba170c63..72fa3f390 100644 --- a/src/cairo-path-stroke-boxes.c +++ b/src/cairo-path-stroke-boxes.c @@ -447,7 +447,8 @@ _cairo_rectilinear_stroker_move_to (void *closure, static cairo_status_t _cairo_rectilinear_stroker_line_to (void *closure, - const cairo_point_t *b) + const cairo_point_t *b, + const cairo_slope_t *tangent) { cairo_rectilinear_stroker_t *stroker = closure; cairo_point_t *a = &stroker->current_point; @@ -471,7 +472,8 @@ _cairo_rectilinear_stroker_line_to (void *closure, static cairo_status_t _cairo_rectilinear_stroker_line_to_dashed (void *closure, - const cairo_point_t *point) + const cairo_point_t *point, + const cairo_slope_t *tangent) { cairo_rectilinear_stroker_t *stroker = closure; const cairo_point_t *a = &stroker->current_point; @@ -586,10 +588,10 @@ _cairo_rectilinear_stroker_close_path (void *closure) if (stroker->dash.dashed) { status = _cairo_rectilinear_stroker_line_to_dashed (stroker, - &stroker->first_point); + &stroker->first_point, NULL); } else { status = _cairo_rectilinear_stroker_line_to (stroker, - &stroker->first_point); + &stroker->first_point, NULL); } if (unlikely (status)) return status; diff --git a/src/cairo-path-stroke-polygon.c b/src/cairo-path-stroke-polygon.c index 3f7c49802..341ac3686 100644 --- a/src/cairo-path-stroke-polygon.c +++ b/src/cairo-path-stroke-polygon.c @@ -1012,7 +1012,8 @@ move_to (void *closure, static cairo_status_t line_to (void *closure, - const cairo_point_t *point) + const cairo_point_t *point, + const cairo_slope_t *tangent) { struct stroker *stroker = closure; cairo_stroke_face_t start; @@ -1161,11 +1162,11 @@ curve_to (void *closure, if (stroker->has_bounds && ! _cairo_spline_intersects (&stroker->current_face.point, b, c, d, &stroker->bounds)) - return line_to (closure, d); + return line_to (closure, d, NULL); if (! _cairo_spline_init (&spline, spline_to, stroker, &stroker->current_face.point, b, c, d)) - return line_to (closure, d); + return line_to (closure, d, NULL); compute_face (&stroker->current_face.point, &spline.initial_slope, stroker, &face); @@ -1197,7 +1198,7 @@ close_path (void *closure) struct stroker *stroker = closure; cairo_status_t status; - status = line_to (stroker, &stroker->first_point); + status = line_to (stroker, &stroker->first_point, NULL); if (unlikely (status)) return status; diff --git a/src/cairo-path-stroke-traps.c b/src/cairo-path-stroke-traps.c index 1363ffa86..82274e338 100644 --- a/src/cairo-path-stroke-traps.c +++ b/src/cairo-path-stroke-traps.c @@ -783,7 +783,7 @@ move_to_dashed (void *closure, const cairo_point_t *point) } static cairo_status_t -line_to (void *closure, const cairo_point_t *point) +line_to (void *closure, const cairo_point_t *point, const cairo_slope_t *tangent) { struct stroker *stroker = closure; cairo_stroke_face_t start, end; @@ -817,7 +817,7 @@ line_to (void *closure, const cairo_point_t *point) * Dashed lines. Cap each dash end, join around turns when on */ static cairo_status_t -line_to_dashed (void *closure, const cairo_point_t *point) +line_to_dashed (void *closure, const cairo_point_t *point, const cairo_slope_t *tangent) { struct stroker *stroker = closure; double mag, remain, step_length = 0; @@ -996,11 +996,11 @@ curve_to (void *closure, if (stroker->has_bounds && ! _cairo_spline_intersects (&stroker->current_face.point, b, c, d, &stroker->line_bounds)) - return line_to (closure, d); + return line_to (closure, d, NULL); if (! _cairo_spline_init (&spline, spline_to, stroker, &stroker->current_face.point, b, c, d)) - return line_to (closure, d); + return line_to (closure, d, NULL); compute_face (&stroker->current_face.point, &spline.initial_slope, stroker, &face); @@ -1088,7 +1088,7 @@ close_path (void *closure) struct stroker *stroker = closure; cairo_status_t status; - status = line_to (stroker, &stroker->first_point); + status = line_to (stroker, &stroker->first_point, NULL); if (unlikely (status)) return status; @@ -1101,7 +1101,7 @@ close_path_dashed (void *closure) struct stroker *stroker = closure; cairo_status_t status; - status = line_to_dashed (stroker, &stroker->first_point); + status = line_to_dashed (stroker, &stroker->first_point, NULL); if (unlikely (status)) return status; diff --git a/src/cairo-path-stroke-tristrip.c b/src/cairo-path-stroke-tristrip.c index 317876560..604193284 100644 --- a/src/cairo-path-stroke-tristrip.c +++ b/src/cairo-path-stroke-tristrip.c @@ -834,7 +834,8 @@ move_to (void *closure, static cairo_status_t line_to (void *closure, - const cairo_point_t *point) + const cairo_point_t *point, + const cairo_slope_t *tangent) { struct stroker *stroker = closure; cairo_stroke_face_t start; @@ -971,12 +972,12 @@ curve_to (void *closure, if (stroker->has_limits) { if (! _cairo_spline_intersects (&stroker->current_face.point, b, c, d, &stroker->limit)) - return line_to (closure, d); + return line_to (closure, d, NULL); } if (! _cairo_spline_init (&spline, spline_to, stroker, &stroker->current_face.point, b, c, d)) - return line_to (closure, d); + return line_to (closure, d, NULL); compute_face (&stroker->current_face.point, &spline.initial_slope, stroker, &face); @@ -1009,7 +1010,7 @@ close_path (void *closure) struct stroker *stroker = closure; cairo_status_t status; - status = line_to (stroker, &stroker->first_point); + status = line_to (stroker, &stroker->first_point, NULL); if (unlikely (status)) return status; diff --git a/src/cairo-path-stroke.c b/src/cairo-path-stroke.c index 64cec8f27..63a6ea018 100644 --- a/src/cairo-path-stroke.c +++ b/src/cairo-path-stroke.c @@ -947,7 +947,8 @@ _cairo_stroker_move_to (void *closure, static cairo_status_t _cairo_stroker_line_to (void *closure, - const cairo_point_t *point) + const cairo_point_t *point, + const cairo_slope_t *tangent) { cairo_stroker_t *stroker = closure; cairo_stroke_face_t start, end; @@ -1085,7 +1086,8 @@ _cairo_stroker_spline_to (void *closure, */ static cairo_status_t _cairo_stroker_line_to_dashed (void *closure, - const cairo_point_t *p2) + const cairo_point_t *p2, + const cairo_slope_t *tangent) { cairo_stroker_t *stroker = closure; double mag, remain, step_length = 0; @@ -1331,9 +1333,9 @@ _cairo_stroker_close_path (void *closure) cairo_status_t status; if (stroker->dash.dashed) - status = _cairo_stroker_line_to_dashed (stroker, &stroker->first_point); + status = _cairo_stroker_line_to_dashed (stroker, &stroker->first_point, NULL); else - status = _cairo_stroker_line_to (stroker, &stroker->first_point); + status = _cairo_stroker_line_to (stroker, &stroker->first_point, NULL); if (unlikely (status)) return status; diff --git a/src/cairo-path.c b/src/cairo-path.c index 566e86f5a..a979c3897 100644 --- a/src/cairo-path.c +++ b/src/cairo-path.c @@ -71,7 +71,8 @@ _cpc_move_to (void *closure, static cairo_status_t _cpc_line_to (void *closure, - const cairo_point_t *point) + const cairo_point_t *point, + const cairo_slope_t *tangent) { cpc_t *cpc = closure; @@ -169,7 +170,8 @@ _cpp_move_to (void *closure, static cairo_status_t _cpp_line_to (void *closure, - const cairo_point_t *point) + const cairo_point_t *point, + const cairo_slope_t *tangent) { cpp_t *cpp = closure; cairo_path_data_t *data = cpp->data; diff --git a/src/cairo-pdf-operators.c b/src/cairo-pdf-operators.c index 328e893d7..e5108ef6c 100644 --- a/src/cairo-pdf-operators.c +++ b/src/cairo-pdf-operators.c @@ -407,7 +407,8 @@ _cairo_pdf_path_move_to (void *closure, static cairo_status_t _cairo_pdf_path_line_to (void *closure, - const cairo_point_t *point) + const cairo_point_t *point, + const cairo_slope_t *tangent) { pdf_path_info_t *info = closure; double x = _cairo_fixed_to_double (point->x); diff --git a/src/cairo-script-surface.c b/src/cairo-script-surface.c index 4d7778b99..6838c271c 100644 --- a/src/cairo-script-surface.c +++ b/src/cairo-script-surface.c @@ -1796,7 +1796,8 @@ _path_move_to (void *closure, static cairo_status_t _path_line_to (void *closure, - const cairo_point_t *point) + const cairo_point_t *point, + const cairo_slope_t *tangent) { _cairo_output_stream_printf (closure, " %f %f l", diff --git a/src/cairo-svg-surface.c b/src/cairo-svg-surface.c index 7e7051eb6..f79975f97 100644 --- a/src/cairo-svg-surface.c +++ b/src/cairo-svg-surface.c @@ -865,7 +865,8 @@ _cairo_svg_path_move_to (void *closure, static cairo_status_t _cairo_svg_path_line_to (void *closure, - const cairo_point_t *point) + const cairo_point_t *point, + const cairo_slope_t *tangent) { svg_path_info_t *info = closure; double x = _cairo_fixed_to_double (point->x); diff --git a/src/cairo-type1-fallback.c b/src/cairo-type1-fallback.c index 0b8e66cd0..6dec9842e 100644 --- a/src/cairo-type1-fallback.c +++ b/src/cairo-type1-fallback.c @@ -246,7 +246,8 @@ _charstring_move_to (void *closure, static cairo_status_t _charstring_line_to (void *closure, - const cairo_point_t *point) + const cairo_point_t *point, + const cairo_slope_t *tangent) { t1_path_info_t *path_info = (t1_path_info_t *) closure; int dx, dy; diff --git a/src/cairoint.h b/src/cairoint.h index 7c1000556..8878b3226 100644 --- a/src/cairoint.h +++ b/src/cairoint.h @@ -999,7 +999,8 @@ typedef cairo_status_t typedef cairo_status_t (cairo_path_fixed_line_to_func_t) (void *closure, - const cairo_point_t *point); + const cairo_point_t *point, + const cairo_slope_t *tangent); typedef cairo_status_t (cairo_path_fixed_curve_to_func_t) (void *closure,