diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2008-10-26 09:54:03 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2008-10-26 10:25:26 +0000 |
commit | 64fb3290f00bafc4a10e6432226f669a51fa0bc6 (patch) | |
tree | 6a1aeb36b61e75f480042cec53c801fb44436ab2 /src/cairo-path-stroke.c | |
parent | 88935947d11762c91e282fb129c493afc6f2f1a6 (diff) | |
download | cairo-64fb3290f00bafc4a10e6432226f669a51fa0bc6.tar.gz |
[stroke] _cairo_stroker_line_to_dashed() whitespace
A couple of comment spelling mistakes and rearrange whitespace to more
closely match CODING_STYLE.
Diffstat (limited to 'src/cairo-path-stroke.c')
-rw-r--r-- | src/cairo-path-stroke.c | 57 |
1 files changed, 39 insertions, 18 deletions
diff --git a/src/cairo-path-stroke.c b/src/cairo-path-stroke.c index 627c71e7e..d8c94a86a 100644 --- a/src/cairo-path-stroke.c +++ b/src/cairo-path-stroke.c @@ -829,7 +829,6 @@ _cairo_stroker_line_to (void *closure, cairo_point_t *point) static cairo_status_t _cairo_stroker_line_to_dashed (void *closure, cairo_point_t *point) { - cairo_status_t status = CAIRO_STATUS_SUCCESS; cairo_stroker_t *stroker = closure; double mag, remain, step_length = 0; double slope_dx, slope_dy; @@ -838,17 +837,19 @@ _cairo_stroker_line_to_dashed (void *closure, cairo_point_t *point) cairo_point_t *p1 = &stroker->current_point; cairo_point_t *p2 = point; cairo_slope_t dev_slope; - cairo_bool_t fully_in_bounds = TRUE; cairo_line_t segment; + cairo_bool_t fully_in_bounds; + cairo_status_t status; stroker->has_initial_sub_path = stroker->dash_starts_on; if (p1->x == p2->x && p1->y == p2->y) return CAIRO_STATUS_SUCCESS; + fully_in_bounds = TRUE; if (stroker->has_bounds && - (!_cairo_box_contains_point (&stroker->bounds, p1) || - !_cairo_box_contains_point (&stroker->bounds, p2))) + (! _cairo_box_contains_point (&stroker->bounds, p1) || + ! _cairo_box_contains_point (&stroker->bounds, p2))) { fully_in_bounds = FALSE; } @@ -858,8 +859,11 @@ _cairo_stroker_line_to_dashed (void *closure, cairo_point_t *point) slope_dx = _cairo_fixed_to_double (p2->x - p1->x); slope_dy = _cairo_fixed_to_double (p2->y - p1->y); - if (!_compute_normalized_device_slope (&slope_dx, &slope_dy, stroker->ctm_inverse, &mag)) + if (! _compute_normalized_device_slope (&slope_dx, &slope_dy, + stroker->ctm_inverse, &mag)) + { return CAIRO_STATUS_SUCCESS; + } remain = mag; segment.p1 = *p1; @@ -876,17 +880,24 @@ _cairo_stroker_line_to_dashed (void *closure, cairo_point_t *point) (fully_in_bounds || _cairo_box_intersects_line_segment (&stroker->bounds, &segment))) { - status = _cairo_stroker_add_sub_edge (stroker, &segment.p1, &segment.p2, &dev_slope, slope_dx, slope_dy, &sub_start, &sub_end); + status = _cairo_stroker_add_sub_edge (stroker, + &segment.p1, &segment.p2, + &dev_slope, + slope_dx, slope_dy, + &sub_start, &sub_end); if (status) return status; if (stroker->has_current_face) { /* Join with final face from previous segment */ - status = _cairo_stroker_join (stroker, &stroker->current_face, &sub_start); - stroker->has_current_face = FALSE; + status = _cairo_stroker_join (stroker, + &stroker->current_face, + &sub_start); if (status) return status; - } else if (!stroker->has_first_face && stroker->dash_starts_on) { + + stroker->has_current_face = FALSE; + } else if (! stroker->has_first_face && stroker->dash_starts_on) { /* Save sub path's first face in case needed for closing join */ stroker->first_face = sub_start; stroker->has_first_face = TRUE; @@ -909,9 +920,11 @@ _cairo_stroker_line_to_dashed (void *closure, cairo_point_t *point) } else { if (stroker->has_current_face) { /* Cap final face from previous segment */ - status = _cairo_stroker_add_trailing_cap (stroker, &stroker->current_face); + status = _cairo_stroker_add_trailing_cap (stroker, + &stroker->current_face); if (status) return status; + stroker->has_current_face = FALSE; } } @@ -920,24 +933,32 @@ _cairo_stroker_line_to_dashed (void *closure, cairo_point_t *point) segment.p1 = segment.p2; } - if (stroker->dash_on && !stroker->has_current_face) { + if (stroker->dash_on && ! stroker->has_current_face) { /* This segment ends on a transition to dash_on, compute a new face - * and add cap for the begining of the next dash_on step. + * and add cap for the beginning of the next dash_on step. * * Note: this will create a degenerate cap if this is not the last line * in the path. Whether this behaviour is desirable or not is debatable. - * On one side these degnerate caps can not be reproduced with regular path stroking. - * On the other side Acroread 7 also produces the degenerate caps. */ - _compute_face (point, &dev_slope, slope_dx, slope_dy, stroker, &stroker->current_face); - stroker->has_current_face = TRUE; - status = _cairo_stroker_add_leading_cap (stroker, &stroker->current_face); + * On one side these degenerate caps can not be reproduced with regular + * path stroking. + * On the other hand, Acroread 7 also produces the degenerate caps. + */ + _compute_face (point, &dev_slope, + slope_dx, slope_dy, + stroker, + &stroker->current_face); + + status = _cairo_stroker_add_leading_cap (stroker, + &stroker->current_face); if (status) return status; + + stroker->has_current_face = TRUE; } stroker->current_point = *point; - return status; + return CAIRO_STATUS_SUCCESS; } static cairo_status_t |