diff options
author | Carl Worth <cworth@cworth.org> | 2004-02-12 19:02:33 +0000 |
---|---|---|
committer | Carl Worth <cworth@cworth.org> | 2004-02-12 19:02:33 +0000 |
commit | b55f1076793229d182463100ed9de2a68dd3c77b (patch) | |
tree | ba55f8191450559c189b0f31e482144cd0a5d55c /src/cairo-path-fill.c | |
parent | 810037bc7c7707337fb1e7682b36651f6a7c4e04 (diff) |
Add typedefs for new callbacks to be used by cairo_current_path: cairo_move_to_func, cairo_line_to_func, cairo_curve_to_func, and cairo_close_path_func.
cairo_path.last_move_point and cairo_path.current_point are now fixed-point not doubles for consistency.
Now accept 4 explicit function pointers rather than a structure. Eliminate unnecessary done_path callback.
Track change in _cairo_path_interpret. Code previously in done_path callback is now here immediately after call to _cairo_path_interpret.
Internal _cairo_path API modified to accept fixed-point data everywhere. Much cleaner this way.
Have to convert doubles to fixed-point to track changes in _cairo_path API.
Keep data in fixed-point rather than going through intermediate doubles. Track changes in _cairo_path API.
New function to help when working with freetype.
Diffstat (limited to 'src/cairo-path-fill.c')
-rw-r--r-- | src/cairo-path-fill.c | 58 |
1 files changed, 20 insertions, 38 deletions
diff --git a/src/cairo-path-fill.c b/src/cairo-path-fill.c index 74a019d6..fba5bb09 100644 --- a/src/cairo-path-fill.c +++ b/src/cairo-path-fill.c @@ -57,9 +57,6 @@ _cairo_filler_curve_to (void *closure, static cairo_status_t _cairo_filler_close_path (void *closure); -static cairo_status_t -_cairo_filler_done_path (void *closure); - static void _cairo_filler_init (cairo_filler_t *filler, cairo_gstate_t *gstate, cairo_traps_t *traps) { @@ -164,52 +161,37 @@ _cairo_filler_close_path (void *closure) return CAIRO_STATUS_SUCCESS; } -static cairo_status_t -_cairo_filler_done_path (void *closure) -{ - cairo_status_t status; - cairo_filler_t *filler = closure; - cairo_polygon_t *polygon = &filler->polygon; - - status = _cairo_polygon_close (polygon); - if (status) - return status; - - status = _cairo_traps_tessellate_polygon (filler->traps, - &filler->polygon, - filler->gstate->fill_rule); - if (status) - return status; - - return CAIRO_STATUS_SUCCESS; -} - cairo_status_t _cairo_path_fill_to_traps (cairo_path_t *path, cairo_gstate_t *gstate, cairo_traps_t *traps) { - static const cairo_path_callbacks_t filler_callbacks = { - _cairo_filler_move_to, - _cairo_filler_line_to, - _cairo_filler_curve_to, - _cairo_filler_close_path, - _cairo_filler_done_path - }; - - cairo_status_t status; + cairo_status_t status = CAIRO_STATUS_SUCCESS; cairo_filler_t filler; _cairo_filler_init (&filler, gstate, traps); status = _cairo_path_interpret (path, CAIRO_DIRECTION_FORWARD, - &filler_callbacks, &filler); - if (status) { - _cairo_filler_fini (&filler); - return status; - } + _cairo_filler_move_to, + _cairo_filler_line_to, + _cairo_filler_curve_to, + _cairo_filler_close_path, + &filler); + if (status) + goto BAIL; + + status = _cairo_polygon_close (&filler.polygon); + if (status) + goto BAIL; + status = _cairo_traps_tessellate_polygon (filler.traps, + &filler.polygon, + filler.gstate->fill_rule); + if (status) + goto BAIL; + +BAIL: _cairo_filler_fini (&filler); - return CAIRO_STATUS_SUCCESS; + return status; } |