From 010085622674bd02098742f401409da8e7c1b1dc Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Mon, 29 Dec 2008 12:45:13 +0000 Subject: [PATCH] [path] Remove tolerance from path bounders With Behdad's analytical analysis of the spline bbox, tolerance is now redundant for the path extents and the approximate bounds, so remove it from the functions parameters. --- src/cairo-analysis-surface.c | 3 +-- src/cairo-gstate.c | 3 +-- src/cairo-path-bounds.c | 18 ++++++------------ src/cairo-surface-fallback.c | 1 - src/cairoint.h | 5 +---- 5 files changed, 9 insertions(+), 21 deletions(-) diff --git a/src/cairo-analysis-surface.c b/src/cairo-analysis-surface.c index b3eab41f4..b80ad628c 100644 --- a/src/cairo-analysis-surface.c +++ b/src/cairo-analysis-surface.c @@ -481,7 +481,7 @@ _cairo_analysis_surface_stroke (void *abstract_surface, cairo_rectangle_int_t mask_extents; _cairo_path_fixed_approximate_stroke_extents (path, - style, ctm, tolerance, + style, ctm, &mask_extents); is_empty = _cairo_rectangle_intersect (&extents, &mask_extents); @@ -539,7 +539,6 @@ _cairo_analysis_surface_fill (void *abstract_surface, cairo_rectangle_int_t mask_extents; _cairo_path_fixed_approximate_fill_extents (path, - tolerance, &mask_extents); is_empty = _cairo_rectangle_intersect (&extents, &mask_extents); diff --git a/src/cairo-gstate.c b/src/cairo-gstate.c index 9ebc5d17b..df7ec5c41 100644 --- a/src/cairo-gstate.c +++ b/src/cairo-gstate.c @@ -796,8 +796,7 @@ _cairo_gstate_path_extents (cairo_gstate_t *gstate, double px1, py1, px2, py2; _cairo_path_fixed_bounds (path, - &px1, &py1, &px2, &py2, - gstate->tolerance); + &px1, &py1, &px2, &py2); _cairo_gstate_backend_to_user_rectangle (gstate, &px1, &py1, &px2, &py2, diff --git a/src/cairo-path-bounds.c b/src/cairo-path-bounds.c index 698d1fa5b..56f2df52f 100644 --- a/src/cairo-path-bounds.c +++ b/src/cairo-path-bounds.c @@ -37,8 +37,6 @@ #include "cairoint.h" typedef struct cairo_path_bounder { - double tolerance; - cairo_point_t current_point; cairo_bool_t has_initial_point; cairo_bool_t has_point; @@ -47,9 +45,8 @@ typedef struct cairo_path_bounder { } cairo_path_bounder_t; static void -_cairo_path_bounder_init (cairo_path_bounder_t *bounder, double tolerance) +_cairo_path_bounder_init (cairo_path_bounder_t *bounder) { - bounder->tolerance = tolerance; bounder->has_initial_point = FALSE; bounder->has_point = FALSE; } @@ -167,7 +164,7 @@ _cairo_path_fixed_approximate_extents (cairo_path_fixed_t *path, cairo_path_bounder_t bounder; cairo_status_t status; - _cairo_path_bounder_init (&bounder, 0.); + _cairo_path_bounder_init (&bounder); status = _cairo_path_fixed_interpret (path, CAIRO_DIRECTION_FORWARD, _cairo_path_bounder_move_to, @@ -192,13 +189,12 @@ _cairo_path_fixed_approximate_extents (cairo_path_fixed_t *path, */ void _cairo_path_fixed_approximate_fill_extents (cairo_path_fixed_t *path, - double tolerance, cairo_rectangle_int_t *extents) { cairo_path_bounder_t bounder; cairo_status_t status; - _cairo_path_bounder_init (&bounder, tolerance); + _cairo_path_bounder_init (&bounder); status = _cairo_path_fixed_interpret (path, CAIRO_DIRECTION_FORWARD, _cairo_path_bounder_move_to, @@ -223,13 +219,12 @@ void _cairo_path_fixed_approximate_stroke_extents (cairo_path_fixed_t *path, cairo_stroke_style_t *style, const cairo_matrix_t *ctm, - double tolerance, cairo_rectangle_int_t *extents) { cairo_path_bounder_t bounder; cairo_status_t status; - _cairo_path_bounder_init (&bounder, tolerance); + _cairo_path_bounder_init (&bounder); status = _cairo_path_fixed_interpret (path, CAIRO_DIRECTION_FORWARD, _cairo_path_bounder_move_to, @@ -261,13 +256,12 @@ _cairo_path_fixed_approximate_stroke_extents (cairo_path_fixed_t *path, void _cairo_path_fixed_bounds (cairo_path_fixed_t *path, double *x1, double *y1, - double *x2, double *y2, - double tolerance) + double *x2, double *y2) { cairo_path_bounder_t bounder; cairo_status_t status; - _cairo_path_bounder_init (&bounder, tolerance); + _cairo_path_bounder_init (&bounder); status = _cairo_path_fixed_interpret (path, CAIRO_DIRECTION_FORWARD, _cairo_path_bounder_move_to, diff --git a/src/cairo-surface-fallback.c b/src/cairo-surface-fallback.c index 9cd59d425..6cc67d190 100644 --- a/src/cairo-surface-fallback.c +++ b/src/cairo-surface-fallback.c @@ -958,7 +958,6 @@ _cairo_surface_fallback_fill (cairo_surface_t *surface, cairo_rectangle_int_t path_extents; _cairo_path_fixed_approximate_fill_extents (path, - tolerance, &path_extents); if (! _cairo_rectangle_intersect (&extents, &path_extents)) return CAIRO_STATUS_SUCCESS; diff --git a/src/cairoint.h b/src/cairoint.h index 95b5e0fa8..2a6681d08 100644 --- a/src/cairoint.h +++ b/src/cairoint.h @@ -1545,21 +1545,18 @@ _cairo_path_fixed_approximate_extents (cairo_path_fixed_t *path, cairo_private void _cairo_path_fixed_approximate_fill_extents (cairo_path_fixed_t *path, - double tolerance, cairo_rectangle_int_t *extents); cairo_private void _cairo_path_fixed_approximate_stroke_extents (cairo_path_fixed_t *path, cairo_stroke_style_t *style, const cairo_matrix_t *ctm, - double tolerance, cairo_rectangle_int_t *extents); cairo_private void _cairo_path_fixed_bounds (cairo_path_fixed_t *path, double *x1, double *y1, - double *x2, double *y2, - double tolerance); + double *x2, double *y2); cairo_private void _cairo_path_fixed_transform (cairo_path_fixed_t *path,