diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2009-07-05 14:43:50 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2009-07-05 15:01:08 +0100 |
commit | fbd88db938bf3bb03934795da9b3d184c4f43608 (patch) | |
tree | f37f7853de5a21236ea73df1d25f7a1ae9c7cd0b /src/cairo-path-fixed.c | |
parent | 73f8019fd2afd0ad41c2515bef9877348355d246 (diff) |
[path] Don't include current-point in hash
As we don't strictly use the current-point in comparing paths, exclude it
from the hash. Similarly use the path content flags as a cheap means to
differentiate contents.
Diffstat (limited to 'src/cairo-path-fixed.c')
-rw-r--r-- | src/cairo-path-fixed.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/cairo-path-fixed.c b/src/cairo-path-fixed.c index 539e95368..0a550399c 100644 --- a/src/cairo-path-fixed.c +++ b/src/cairo-path-fixed.c @@ -163,17 +163,10 @@ _cairo_path_fixed_init_copy (cairo_path_fixed_t *path, unsigned long _cairo_path_fixed_hash (const cairo_path_fixed_t *path) { - unsigned long hash = 0; + unsigned long hash = _CAIRO_HASH_INIT_VALUE; const cairo_path_buf_t *buf; int num_points, num_ops; - hash = _cairo_hash_bytes (hash, - &path->current_point, - sizeof (path->current_point)); - hash = _cairo_hash_bytes (hash, - &path->last_move_point, - sizeof (path->last_move_point)); - num_ops = num_points = 0; cairo_path_foreach_buf_start (buf, path) { hash = _cairo_hash_bytes (hash, buf->op, @@ -220,6 +213,14 @@ _cairo_path_fixed_equal (const cairo_path_fixed_t *a, if (a == b) return TRUE; + /* use the flags to quickly differentiate based on contents */ + if (a->has_curve_to != b->has_curve_to || + a->is_region != b->is_region || + a->is_box != b->is_box) + { + return FALSE; + } + num_ops_a = num_points_a = 0; if (a != NULL) { cairo_path_foreach_buf_start (buf_a, a) { |