forked from AuroraMiddleware/gtk
Allow passing a color matrix when rendering icons
This will be used for symbolic icons. Update all callers.
This commit is contained in:
parent
b543257e42
commit
e4cdbef092
@ -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
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user