diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2007-04-08 21:24:59 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2007-04-09 15:05:24 +0100 |
commit | fd49bbb4b21b73247b4d391c2cb1b028a596f6eb (patch) | |
tree | 2d495407ad56f0bf3eff2cdd1da551a54780f2f5 /src/cairo-path.c | |
parent | 814830f63b72f69198e92564c53f2683e5bda269 (diff) | |
download | cairo-fd49bbb4b21b73247b4d391c2cb1b028a596f6eb.tar.gz |
cairo-path - check for failure during _cairo_path_fixed_interpret
Catch an error return from _cairo_path_fixed_interpret() and return
it. Similary check for an error code in cairo_status() before returning
success.
Diffstat (limited to 'src/cairo-path.c')
-rw-r--r-- | src/cairo-path.c | 55 |
1 files changed, 32 insertions, 23 deletions
diff --git a/src/cairo-path.c b/src/cairo-path.c index ff4419132..3add10769 100644 --- a/src/cairo-path.c +++ b/src/cairo-path.c @@ -143,15 +143,16 @@ _cairo_path_count (cairo_path_t *path, cpc.current_point.x = 0; cpc.current_point.y = 0; - _cairo_path_fixed_interpret (path_fixed, - CAIRO_DIRECTION_FORWARD, - _cpc_move_to, - _cpc_line_to, - flatten ? - _cpc_curve_to_flatten : - _cpc_curve_to, - _cpc_close_path, - &cpc); + if (_cairo_path_fixed_interpret (path_fixed, + CAIRO_DIRECTION_FORWARD, + _cpc_move_to, + _cpc_line_to, + flatten ? + _cpc_curve_to_flatten : + _cpc_curve_to, + _cpc_close_path, + &cpc) != CAIRO_STATUS_SUCCESS) + return 0; return cpc.count; } @@ -307,12 +308,13 @@ _cpp_close_path (void *closure) return CAIRO_STATUS_SUCCESS; } -static void +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; @@ -320,18 +322,22 @@ _cairo_path_populate (cairo_path_t *path, cpp.current_point.x = 0; cpp.current_point.y = 0; - _cairo_path_fixed_interpret (path_fixed, - CAIRO_DIRECTION_FORWARD, - _cpp_move_to, - _cpp_line_to, - flatten ? - _cpp_curve_to_flatten : - _cpp_curve_to, - _cpp_close_path, - &cpp); + status = _cairo_path_fixed_interpret (path_fixed, + CAIRO_DIRECTION_FORWARD, + _cpp_move_to, + _cpp_line_to, + flatten ? + _cpp_curve_to_flatten : + _cpp_curve_to, + _cpp_close_path, + &cpp); + if (status) + return status; /* Sanity check the count */ assert (cpp.data - path->data == path->num_data); + + return status; } cairo_path_t * @@ -371,10 +377,8 @@ _cairo_path_create_internal (cairo_path_fixed_t *path_fixed, return (cairo_path_t*) &_cairo_path_nil; } - path->status = CAIRO_STATUS_SUCCESS; - - _cairo_path_populate (path, path_fixed, - gstate, flatten); + path->status = _cairo_path_populate (path, path_fixed, + gstate, flatten); return path; } @@ -463,6 +467,7 @@ _cairo_path_append_to_context (const cairo_path_t *path, { int i; cairo_path_data_t *p; + cairo_status_t status; for (i=0; i < path->num_data; i += path->data[i].header.length) { p = &path->data[i]; @@ -495,6 +500,10 @@ _cairo_path_append_to_context (const cairo_path_t *path, default: return CAIRO_STATUS_INVALID_PATH_DATA; } + + status = cairo_status (cr); + if (status) + return status; } return CAIRO_STATUS_SUCCESS; |