summaryrefslogtreecommitdiff
path: root/src/cairo-path-bounds.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2008-12-27 11:46:24 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2008-12-27 11:46:24 +0000
commit50bc2bc0170be2a9c84ae3064525b18190e22b48 (patch)
treecb6418b1df3217b76b2b6d30d4c8f4a61ba9c845 /src/cairo-path-bounds.c
parent078ebb01ba0b99ab4973ba479fe438f0674aa102 (diff)
downloadcairo-50bc2bc0170be2a9c84ae3064525b18190e22b48.tar.gz
[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.
Diffstat (limited to 'src/cairo-path-bounds.c')
-rw-r--r--src/cairo-path-bounds.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/src/cairo-path-bounds.c b/src/cairo-path-bounds.c
index 4a736c6bb..dca237b0e 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);