summaryrefslogtreecommitdiff
path: root/src/cairo-color.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2010-05-13 11:56:22 +0200
committerBenjamin Otte <otte@redhat.com>2010-05-13 12:11:09 +0200
commit18c963824ebbb0e7054e682ecb5664a282a58552 (patch)
treeacd8ad9898962f31cb84dacc63d658a922ee4303 /src/cairo-color.c
parent7bd8d0db1f4ac448c93d6d342726f64a0d6300e3 (diff)
downloadcairo-18c963824ebbb0e7054e682ecb5664a282a58552.tar.gz
Make _cairo_color_equal() work for unmultiplied colors, too
Color stop colors are unmultiplied, and we use it there.
Diffstat (limited to 'src/cairo-color.c')
-rw-r--r--src/cairo-color.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/cairo-color.c b/src/cairo-color.c
index ddba5cae8..9483c8b9a 100644
--- a/src/cairo-color.c
+++ b/src/cairo-color.c
@@ -162,6 +162,7 @@ _cairo_color_get_rgba_premultiplied (cairo_color_t *color,
*alpha = color->alpha;
}
+/* NB: This function works both for unmultiplied and premultiplied colors */
cairo_bool_t
_cairo_color_equal (const cairo_color_t *color_a,
const cairo_color_t *color_b)
@@ -169,10 +170,15 @@ _cairo_color_equal (const cairo_color_t *color_a,
if (color_a == color_b)
return TRUE;
+ if (color_a->alpha_short != color_b->alpha_short)
+ return FALSE;
+
+ if (color_a->alpha_short == 0)
+ return TRUE;
+
return color_a->red_short == color_b->red_short &&
color_a->green_short == color_b->green_short &&
- color_a->blue_short == color_b->blue_short &&
- color_a->alpha_short == color_b->alpha_short;
+ color_a->blue_short == color_b->blue_short;
}
cairo_bool_t