mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-01-07 18:20:27 +01:00
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.
This commit is contained in:
parent
814830f63b
commit
fd49bbb4b2
1 changed files with 32 additions and 23 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue