From 005b195f062d896d76a87d608ce313b169f99201 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Tue, 11 Aug 2009 22:07:12 +0100 Subject: [PATCH] [pattern] Ignore matrix/filter/extend when comparing solids Solid patterns do not use their matrices, filter or extend properties so ignore them for the purposes of comparing and hashing. --- src/cairo-pattern.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/src/cairo-pattern.c b/src/cairo-pattern.c index 430310634..e6210589c 100644 --- a/src/cairo-pattern.c +++ b/src/cairo-pattern.c @@ -2586,9 +2586,14 @@ _cairo_pattern_hash (const cairo_pattern_t *pattern) return 0; hash = _cairo_hash_bytes (hash, &pattern->type, sizeof (pattern->type)); - hash = _cairo_hash_bytes (hash, &pattern->matrix, sizeof (pattern->matrix)); - hash = _cairo_hash_bytes (hash, &pattern->filter, sizeof (pattern->filter)); - hash = _cairo_hash_bytes (hash, &pattern->extend, sizeof (pattern->extend)); + if (pattern->type != CAIRO_PATTERN_TYPE_SOLID) { + hash = _cairo_hash_bytes (hash, + &pattern->matrix, sizeof (pattern->matrix)); + hash = _cairo_hash_bytes (hash, + &pattern->filter, sizeof (pattern->filter)); + hash = _cairo_hash_bytes (hash, + &pattern->extend, sizeof (pattern->extend)); + } switch (pattern->type) { case CAIRO_PATTERN_TYPE_SOLID: @@ -2745,14 +2750,16 @@ _cairo_pattern_equal (const cairo_pattern_t *a, const cairo_pattern_t *b) if (a->type != b->type) return FALSE; - if (memcmp (&a->matrix, &b->matrix, sizeof (cairo_matrix_t))) - return FALSE; + if (a->type != CAIRO_PATTERN_TYPE_SOLID) { + if (memcmp (&a->matrix, &b->matrix, sizeof (cairo_matrix_t))) + return FALSE; - if (a->filter != b->filter) - return FALSE; + if (a->filter != b->filter) + return FALSE; - if (a->extend != b->extend) - return FALSE; + if (a->extend != b->extend) + return FALSE; + } switch (a->type) { case CAIRO_PATTERN_TYPE_SOLID: