GdkPixbuf *scaled;
GdkPixbuf *stated;
GdkPixbuf *base_pixbuf;
- GtkStateFlags state;
gint width = 1;
gint height = 1;
cairo_t *cr;
base_pixbuf = gtk_icon_source_get_pixbuf (source);
G_GNUC_END_IGNORE_DEPRECATIONS;
- state = gtk_style_context_get_state (context);
-
g_return_val_if_fail (base_pixbuf != NULL, NULL);
if (size != (GtkIconSize) -1 &&
image_effect = _gtk_css_image_effect_value_get
(_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_GTK_IMAGE_EFFECT));
- if (image_effect == GTK_CSS_IMAGE_EFFECT_DIM ||
- state & GTK_STATE_FLAG_INSENSITIVE)
+ switch (image_effect)
{
+ case GTK_CSS_IMAGE_EFFECT_DIM:
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
gdk_pixbuf_get_width (scaled),
gdk_pixbuf_get_height (scaled));
cairo_image_surface_get_width (surface),
cairo_image_surface_get_height (surface));
cairo_surface_destroy (surface);
- }
- else if (image_effect == GTK_CSS_IMAGE_EFFECT_HIGHLIGHT ||
- state & GTK_STATE_FLAG_PRELIGHT)
- {
+ break;
+
+ case GTK_CSS_IMAGE_EFFECT_HIGHLIGHT:
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
gdk_pixbuf_get_width (scaled),
gdk_pixbuf_get_height (scaled));
cairo_image_surface_get_width (surface),
cairo_image_surface_get_height (surface));
cairo_surface_destroy (surface);
+ break;
+
+ default:
+ g_warn_if_reached ();
+ /* fall through */
+ case GTK_CSS_IMAGE_EFFECT_NONE:
+ stated = scaled;
+ break;
}
- else
- stated = scaled;
return stated;
}