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.

This commit is contained in:
Pepsin Ye 2021-10-02 09:24:43 +08:00
parent 156cd3eaae
commit 924a9fe8c2
17 changed files with 66 additions and 45 deletions

View file

@ -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

View file

@ -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",

View file

@ -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;

View file

@ -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

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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);

View file

@ -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",

View file

@ -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);

View file

@ -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;

View file

@ -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,