static double _cairo_default_context_get_tolerance (void *abstract_cr) { cairo_default_context_t *cr = abstract_cr; return _cairo_gstate_get_tolerance (cr->gstate); }
static cairo_path_t * _cairo_path_create_internal (cairo_path_fixed_t *path_fixed, cairo_gstate_t *gstate, cairo_bool_t flatten) { cairo_path_t *path; //+EAWebKitChange //11/10/2011 path = cairo_malloc (sizeof (cairo_path_t)); //-EAWebKitChange if (path == NULL) { _cairo_error_throw (CAIRO_STATUS_NO_MEMORY); return (cairo_path_t*) &_cairo_path_nil; } path->num_data = _cairo_path_count (path, path_fixed, _cairo_gstate_get_tolerance (gstate), flatten); if (path->num_data < 0) { //+EAWebKitChange //11/10/2011 cairo_free (path); //-EAWebKitChange return (cairo_path_t*) &_cairo_path_nil; } if (path->num_data) { path->data = _cairo_malloc_ab (path->num_data, sizeof (cairo_path_data_t)); if (path->data == NULL) { //+EAWebKitChange //11/10/2011 cairo_free (path); //-EAWebKitChange _cairo_error_throw (CAIRO_STATUS_NO_MEMORY); return (cairo_path_t*) &_cairo_path_nil; } path->status = _cairo_path_populate (path, path_fixed, gstate, flatten); } else { path->data = NULL; path->status = CAIRO_STATUS_SUCCESS; } return path; }
static cairo_status_t _cairo_path_populate (cairo_path_t *path, cairo_path_fixed_t *path_fixed, cairo_gstate_t *gstate, cairo_bool_t flatten) { cairo_status_t status; cpp_t cpp; cpp.data = path->data; cpp.gstate = gstate; cpp.current_point.x = 0; cpp.current_point.y = 0; if (flatten) { double tolerance = _cairo_gstate_get_tolerance (gstate); status = _cairo_path_fixed_interpret_flat (path_fixed, CAIRO_DIRECTION_FORWARD, _cpp_move_to, _cpp_line_to, _cpp_close_path, &cpp, tolerance); } else { status = _cairo_path_fixed_interpret (path_fixed, CAIRO_DIRECTION_FORWARD, _cpp_move_to, _cpp_line_to, _cpp_curve_to, _cpp_close_path, &cpp); } if (unlikely (status)) return status; /* Sanity check the count */ assert (cpp.data - path->data == path->num_data); return CAIRO_STATUS_SUCCESS; }