diff options
author | Benjamin Otte <otte@redhat.com> | 2012-11-01 00:22:39 +0100 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2012-11-01 12:27:31 +0100 |
commit | 0bfbf39306203d11d04c3aac93dea1155a52ba70 (patch) | |
tree | 14e7c02f562cd2a3913cb70ca9bb4b0eeaa07dfb /gtk/gtkcssimagelinear.c | |
parent | 86ecf54139874e5e2eee8bfd55b93e28f969bf72 (diff) | |
download | gtk+-0bfbf39306203d11d04c3aac93dea1155a52ba70.tar.gz |
cssimage: Implement some equal functions
Diffstat (limited to 'gtk/gtkcssimagelinear.c')
-rw-r--r-- | gtk/gtkcssimagelinear.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/gtk/gtkcssimagelinear.c b/gtk/gtkcssimagelinear.c index b09131d423..9f94e49233 100644 --- a/gtk/gtkcssimagelinear.c +++ b/gtk/gtkcssimagelinear.c @@ -533,6 +533,34 @@ fail: return GTK_CSS_IMAGE_CLASS (_gtk_css_image_linear_parent_class)->transition (start_image, end_image, property_id, progress); } +static gboolean +gtk_css_image_linear_equal (GtkCssImage *image1, + GtkCssImage *image2) +{ + GtkCssImageLinear *linear1 = GTK_CSS_IMAGE_LINEAR (image1); + GtkCssImageLinear *linear2 = GTK_CSS_IMAGE_LINEAR (image2); + guint i; + + if (linear1->repeating != linear2->repeating || + !_gtk_css_value_equal (linear1->angle, linear2->angle) || + linear1->stops->len != linear2->stops->len) + return FALSE; + + for (i = 0; i < linear1->stops->len; i++) + { + GtkCssImageLinearColorStop *stop1, *stop2; + + stop1 = &g_array_index (linear1->stops, GtkCssImageLinearColorStop, i); + stop2 = &g_array_index (linear2->stops, GtkCssImageLinearColorStop, i); + + if (!_gtk_css_value_equal0 (stop1->offset, stop2->offset) || + !_gtk_css_value_equal (stop1->color, stop2->color)) + return FALSE; + } + + return TRUE; +} + static void gtk_css_image_linear_dispose (GObject *object) { @@ -563,6 +591,7 @@ _gtk_css_image_linear_class_init (GtkCssImageLinearClass *klass) image_class->parse = gtk_css_image_linear_parse; image_class->print = gtk_css_image_linear_print; image_class->compute = gtk_css_image_linear_compute; + image_class->equal = gtk_css_image_linear_equal; image_class->transition = gtk_css_image_linear_transition; object_class->dispose = gtk_css_image_linear_dispose; |