summaryrefslogtreecommitdiff
path: root/gtk/gtkcssimageradial.c
diff options
context:
space:
mode:
authorTimm Bäder <mail@baedert.org>2020-01-11 14:38:49 +0100
committerTimm Bäder <mail@baedert.org>2020-01-18 08:49:51 +0100
commit0b2a6e34c45774653fc030018740459d0f465f96 (patch)
tree80c52d7271e6f5e4c26b44bbe930e48538f68e84 /gtk/gtkcssimageradial.c
parent24d8c0a7dccc12edc97753049c1b7765dd4d5a27 (diff)
downloadgtk+-0b2a6e34c45774653fc030018740459d0f465f96.tar.gz
cssimage: Add is_computed vfunc
Same semantics as the is_computed field of GtkCssValue
Diffstat (limited to 'gtk/gtkcssimageradial.c')
-rw-r--r--gtk/gtkcssimageradial.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/gtk/gtkcssimageradial.c b/gtk/gtkcssimageradial.c
index 7a7b50c685..46e6da1584 100644
--- a/gtk/gtkcssimageradial.c
+++ b/gtk/gtkcssimageradial.c
@@ -710,6 +710,37 @@ gtk_css_image_radial_dispose (GObject *object)
G_OBJECT_CLASS (_gtk_css_image_radial_parent_class)->dispose (object);
}
+static gboolean
+gtk_css_image_radial_is_computed (GtkCssImage *image)
+{
+ GtkCssImageRadial *radial = GTK_CSS_IMAGE_RADIAL (image);
+ guint i;
+ gboolean computed = TRUE;
+
+ computed = computed && (!radial->position || gtk_css_value_is_computed (radial->position));
+ computed = computed && (!radial->sizes[0] || gtk_css_value_is_computed (radial->sizes[0]));
+ computed = computed && (!radial->sizes[1] || gtk_css_value_is_computed (radial->sizes[1]));
+
+ if (computed)
+ for (i = 0; i < radial->n_stops; i ++)
+ {
+ const GtkCssImageRadialColorStop *stop = &radial->color_stops[i];
+
+ if (stop->offset && !gtk_css_value_is_computed (stop->offset))
+ {
+ computed = FALSE;
+ break;
+ }
+
+ if (!gtk_css_value_is_computed (stop->color))
+ {
+ computed = FALSE;
+ break;
+ }
+ }
+
+ return computed;
+}
static void
_gtk_css_image_radial_class_init (GtkCssImageRadialClass *klass)
{
@@ -722,6 +753,7 @@ _gtk_css_image_radial_class_init (GtkCssImageRadialClass *klass)
image_class->compute = gtk_css_image_radial_compute;
image_class->transition = gtk_css_image_radial_transition;
image_class->equal = gtk_css_image_radial_equal;
+ image_class->is_computed = gtk_css_image_radial_is_computed;
object_class->dispose = gtk_css_image_radial_dispose;
}