static GtkCssImage * gtk_css_image_fallback_compute (GtkCssImage *image, guint property_id, GtkStyleProviderPrivate *provider, GtkCssStyle *style, GtkCssStyle *parent_style) { GtkCssImageFallback *fallback = GTK_CSS_IMAGE_FALLBACK (image); GtkCssImageFallback *copy; int i; if (fallback->used < 0) { copy = g_object_new (_gtk_css_image_fallback_get_type (), NULL); copy->n_images = fallback->n_images; copy->images = g_new (GtkCssImage *, fallback->n_images); for (i = 0; i < fallback->n_images; i++) { copy->images[i] = _gtk_css_image_compute (fallback->images[i], property_id, provider, style, parent_style); /* Assume that failing to load an image leaves a 0x0 surface image */ if (GTK_IS_CSS_IMAGE_SURFACE (copy->images[i]) && _gtk_css_image_get_width (copy->images[i]) == 0 && _gtk_css_image_get_height (copy->images[i]) == 0) continue; if (copy->used < 0) copy->used = i; } if (fallback->color) copy->color = _gtk_css_value_compute (fallback->color, property_id, provider, style, parent_style); else copy->color = NULL; return GTK_CSS_IMAGE (copy); }
static GtkCssImage * gtk_css_image_fallback_compute (GtkCssImage *image, guint property_id, GtkStyleProvider *provider, GtkCssStyle *style, GtkCssStyle *parent_style) { GtkCssImageFallback *fallback = GTK_CSS_IMAGE_FALLBACK (image); GtkCssImageFallback *copy; int i; if (fallback->used < 0) { copy = g_object_new (_gtk_css_image_fallback_get_type (), NULL); copy->n_images = fallback->n_images; copy->images = g_new (GtkCssImage *, fallback->n_images); for (i = 0; i < fallback->n_images; i++) { copy->images[i] = _gtk_css_image_compute (fallback->images[i], property_id, provider, style, parent_style); if (gtk_css_image_is_invalid (copy->images[i])) continue; if (copy->used < 0) copy->used = i; } if (fallback->color) copy->color = _gtk_css_value_compute (fallback->color, property_id, provider, style, parent_style); else copy->color = NULL; return GTK_CSS_IMAGE (copy); }