static cairo_status_t _cairo_default_context_arc (void *abstract_cr, double xc, double yc, double radius, double angle1, double angle2, cairo_bool_t forward) { cairo_default_context_t *cr = abstract_cr; cairo_status_t status; /* Do nothing, successfully, if radius is <= 0 */ if (radius <= 0.0) { cairo_fixed_t x_fixed, y_fixed; _cairo_gstate_user_to_backend (cr->gstate, &xc, &yc); x_fixed = _cairo_fixed_from_double (xc); y_fixed = _cairo_fixed_from_double (yc); status = _cairo_path_fixed_line_to (cr->path, x_fixed, y_fixed); if (unlikely (status)) return status; status = _cairo_path_fixed_line_to (cr->path, x_fixed, y_fixed); if (unlikely (status)) return status; return CAIRO_STATUS_SUCCESS; } status = _cairo_default_context_line_to (cr, xc + radius * cos (angle1), yc + radius * sin (angle1)); if (unlikely (status)) return status; if (forward) _cairo_arc_path (&cr->base, xc, yc, radius, angle1, angle2); else _cairo_arc_path_negative (&cr->base, xc, yc, radius, angle1, angle2); return CAIRO_STATUS_SUCCESS; /* any error will have already been set on cr */ }
static cairo_status_t _cairo_skia_context_arc (void *abstract_cr, double xc, double yc, double radius, double angle1, double angle2, cairo_bool_t forward) { cairo_skia_context_t *cr = (cairo_skia_context_t *) abstract_cr; cairo_status_t status; /* XXX cr->path->arc() */ /* Do nothing, successfully, if radius is <= 0 */ if (radius <= 0.0) { status = _cairo_skia_context_line_to (cr, xc, yc); if (unlikely (status)) return status; status = _cairo_skia_context_line_to (cr, xc, yc); if (unlikely (status)) return status; return CAIRO_STATUS_SUCCESS; } status = _cairo_skia_context_line_to (cr, xc + radius * cos (angle1), yc + radius * sin (angle1)); if (unlikely (status)) return status; if (forward) _cairo_arc_path (&cr->base, xc, yc, radius, angle1, angle2); else _cairo_arc_path_negative (&cr->base, xc, yc, radius, angle1, angle2); return CAIRO_STATUS_SUCCESS; }