diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2010-04-10 16:00:45 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2010-04-10 16:03:14 +0100 |
commit | 0899852c974099da9f8c5e493fa89b8d022646c5 (patch) | |
tree | cb938cd310cf6fa3b3a8687080fe3e23884ea4b0 /src/cairo-clip.c | |
parent | 557016a86a5a4487aeb6ab6392795eb709ee8bb5 (diff) | |
download | cairo-0899852c974099da9f8c5e493fa89b8d022646c5.tar.gz |
clip: Compare the whole clip when testing for equality.
Should fix test/clip-contexts
Diffstat (limited to 'src/cairo-clip.c')
-rw-r--r-- | src/cairo-clip.c | 40 |
1 files changed, 37 insertions, 3 deletions
diff --git a/src/cairo-clip.c b/src/cairo-clip.c index 6cdb71059..dc1e4b858 100644 --- a/src/cairo-clip.c +++ b/src/cairo-clip.c @@ -228,9 +228,8 @@ _cairo_clip_intersect_path (cairo_clip_t *clip, if (clip->path != NULL) { if (clip->path->fill_rule == fill_rule && - (path->is_rectilinear || - (tolerance == clip->path->tolerance && - antialias == clip->path->antialias)) && + (path->is_rectilinear || tolerance == clip->path->tolerance) && + antialias == clip->path->antialias && _cairo_path_fixed_equal (&clip->path->path, path)) { return CAIRO_STATUS_SUCCESS; @@ -282,6 +281,41 @@ _cairo_clip_intersect_path (cairo_clip_t *clip, return CAIRO_STATUS_SUCCESS; } +cairo_bool_t +_cairo_clip_equal (const cairo_clip_t *clip_a, + const cairo_clip_t *clip_b) +{ + const cairo_clip_path_t *clip_path_a, *clip_path_b; + + clip_path_a = clip_a->path; + clip_path_b = clip_b->path; + + while (clip_path_a && clip_path_b) { + if (clip_path_a == clip_path_b) + return TRUE; + + if (clip_path_a->is_rectilinear != clip_path_b->is_rectilinear) + return FALSE; + + if (clip_path_a->fill_rule != clip_path_b->fill_rule) + return FALSE; + + if (clip_path_a->tolerance != clip_path_b->tolerance) + return FALSE; + + if (clip_path_a->antialias != clip_path_b->antialias) + return FALSE; + + if (! _cairo_path_fixed_equal (&clip_path_a->path, &clip_path_b->path)) + return FALSE; + + clip_path_a = clip_path_a->prev; + clip_path_b = clip_path_b->prev; + } + + return clip_path_a == clip_path_b; /* ie both NULL */ +} + cairo_status_t _cairo_clip_clip (cairo_clip_t *clip, const cairo_path_fixed_t *path, |