diff --git a/gtk/gtkiconhelper.c b/gtk/gtkiconhelper.c index 4ea8428cdb..5d47954536 100644 --- a/gtk/gtkiconhelper.c +++ b/gtk/gtkiconhelper.c @@ -802,7 +802,8 @@ gtk_icon_helper_snapshot (GtkIconHelper *self, gtk_css_style_snapshot_icon_texture (style, snapshot, texture, - gtk_widget_get_scale_factor (self->owner)); + gtk_widget_get_scale_factor (self->owner), + NULL, NULL); } gboolean diff --git a/gtk/gtkrendericon.c b/gtk/gtkrendericon.c index e38c2aa92d..b028d7722e 100644 --- a/gtk/gtkrendericon.c +++ b/gtk/gtkrendericon.c @@ -271,10 +271,12 @@ gtk_css_style_render_icon_get_extents (GtkCssStyle *style, } void -gtk_css_style_snapshot_icon_texture (GtkCssStyle *style, - GtkSnapshot *snapshot, - GskTexture *texture, - double texture_scale) +gtk_css_style_snapshot_icon_texture (GtkCssStyle *style, + GtkSnapshot *snapshot, + GskTexture *texture, + double texture_scale, + graphene_matrix_t *color_matrix, + graphene_vec4_t * color_offset) { const GtkCssValue *shadows_value, *transform_value, *filter_value; graphene_matrix_t transform_matrix; @@ -307,6 +309,9 @@ gtk_css_style_snapshot_icon_texture (GtkCssStyle *style, gtk_snapshot_push_shadow (snapshot, shadows, n_shadows, "IconShadow<%zu>", n_shadows); } + if (color_matrix) + gtk_snapshot_push_color_matrix (snapshot, color_matrix, color_offset, "Recoloring Icon"); + if (graphene_matrix_is_identity (&transform_matrix)) { graphene_rect_init (&bounds, 0, 0, width, height); @@ -331,6 +336,9 @@ gtk_css_style_snapshot_icon_texture (GtkCssStyle *style, gtk_snapshot_pop (snapshot); } + if (color_matrix) + gtk_snapshot_pop (snapshot); + if (n_shadows > 0) gtk_snapshot_pop (snapshot); diff --git a/gtk/gtkrendericonprivate.h b/gtk/gtkrendericonprivate.h index 2ab38f7699..29b81c4dbb 100644 --- a/gtk/gtkrendericonprivate.h +++ b/gtk/gtkrendericonprivate.h @@ -50,7 +50,9 @@ void gtk_css_style_render_icon_surface (GtkCssStyle *style, void gtk_css_style_snapshot_icon_texture (GtkCssStyle *style, GtkSnapshot *snapshot, GskTexture *texture, - double texture_scale); + double texture_scale, + graphene_matrix_t * color_matrix, + graphene_vec4_t * color_offset); void gtk_css_style_render_icon_get_extents (GtkCssStyle *style, GdkRectangle *extents, diff --git a/gtk/gtksnapshot.c b/gtk/gtksnapshot.c index 4413667912..d9d463a99c 100644 --- a/gtk/gtksnapshot.c +++ b/gtk/gtksnapshot.c @@ -1517,7 +1517,8 @@ gtk_snapshot_render_icon (GtkSnapshot *snapshot, gtk_css_style_snapshot_icon_texture (gtk_style_context_lookup_style (context), snapshot, texture, - 1); + 1, + NULL, NULL); gtk_snapshot_offset (snapshot, -x, -y); g_object_unref (texture); }