[cairo-commit] src/cairo-path-bounds.c
Chris Wilson
ickle at kemper.freedesktop.org
Sat Dec 27 03:48:27 PST 2008
src/cairo-path-bounds.c | 25 +++++++++++--------------
1 file changed, 11 insertions(+), 14 deletions(-)
New commits:
commit 50bc2bc0170be2a9c84ae3064525b18190e22b48
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Sat Dec 27 11:46:24 2008 +0000
[path] Simply track the current point for bounds.
The idea is to track always update the current point, but not add it
during a move-to.
diff --git a/src/cairo-path-bounds.c b/src/cairo-path-bounds.c
index 4a736c6..dca237b 100644
--- a/src/cairo-path-bounds.c
+++ b/src/cairo-path-bounds.c
@@ -39,9 +39,8 @@
typedef struct cairo_path_bounder {
double tolerance;
- cairo_point_t move_to_point;
cairo_point_t current_point;
- cairo_bool_t has_move_to_point;
+ cairo_bool_t has_initial_point;
cairo_bool_t has_point;
cairo_box_t extents;
@@ -51,14 +50,14 @@ static void
_cairo_path_bounder_init (cairo_path_bounder_t *bounder, double tolerance)
{
bounder->tolerance = tolerance;
- bounder->has_move_to_point = FALSE;
+ bounder->has_initial_point = FALSE;
bounder->has_point = FALSE;
}
static void
_cairo_path_bounder_fini (cairo_path_bounder_t *bounder)
{
- bounder->has_move_to_point = FALSE;
+ bounder->has_initial_point = FALSE;
bounder->has_point = FALSE;
}
@@ -94,8 +93,8 @@ _cairo_path_bounder_move_to (void *closure,
{
cairo_path_bounder_t *bounder = closure;
- bounder->move_to_point = *point;
- bounder->has_move_to_point = TRUE;
+ bounder->current_point = *point;
+ bounder->has_initial_point = TRUE;
return CAIRO_STATUS_SUCCESS;
}
@@ -106,10 +105,9 @@ _cairo_path_bounder_line_to (void *closure,
{
cairo_path_bounder_t *bounder = closure;
- if (bounder->has_move_to_point) {
- _cairo_path_bounder_add_point (bounder,
- &bounder->move_to_point);
- bounder->has_move_to_point = FALSE;
+ if (bounder->has_initial_point) {
+ _cairo_path_bounder_add_point (bounder, &bounder->current_point);
+ bounder->has_initial_point = FALSE;
}
_cairo_path_bounder_add_point (bounder, point);
@@ -150,10 +148,9 @@ _cairo_path_bounder_curve_to_cp (void *closure,
{
cairo_path_bounder_t *bounder = closure;
- if (bounder->has_move_to_point) {
- _cairo_path_bounder_add_point (bounder,
- &bounder->move_to_point);
- bounder->has_move_to_point = FALSE;
+ if (bounder->has_initial_point) {
+ _cairo_path_bounder_add_point (bounder, &bounder->current_point);
+ bounder->has_initial_point = FALSE;
}
_cairo_path_bounder_add_point (bounder, b);
More information about the cairo-commit
mailing list