summaryrefslogtreecommitdiff
path: root/gtk/gtkrendericon.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2016-12-31 01:15:52 +0100
committerBenjamin Otte <otte@redhat.com>2016-12-31 02:49:47 +0100
commit2645b5a7d755e6b58f84215072bf1f0b7ded8cf0 (patch)
tree79100ce0989d14be3597eb9332fa4a8670bc26b5 /gtk/gtkrendericon.c
parent8973191278c191728b7f71239871c1cd55bfbc80 (diff)
downloadgtk+-2645b5a7d755e6b58f84215072bf1f0b7ded8cf0.tar.gz
gtk: Implement -gtk-icon-filter
This uses the new GskColorMatrixNode to implement a filter that applies to icons. It's meant to replace -gtk-icon-effect.
Diffstat (limited to 'gtk/gtkrendericon.c')
-rw-r--r--gtk/gtkrendericon.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/gtk/gtkrendericon.c b/gtk/gtkrendericon.c
index 15f8397d3c..9cf0b6efba 100644
--- a/gtk/gtkrendericon.c
+++ b/gtk/gtkrendericon.c
@@ -21,6 +21,7 @@
#include "gtkrendericonprivate.h"
+#include "gtkcssfiltervalueprivate.h"
#include "gtkcssimagebuiltinprivate.h"
#include "gtkcssimagevalueprivate.h"
#include "gtkcssshadowsvalueprivate.h"
@@ -95,7 +96,7 @@ gtk_css_style_snapshot_icon (GtkCssStyle *style,
double height,
GtkCssImageBuiltinType builtin_type)
{
- const GtkCssValue *shadows_value, *transform;
+ const GtkCssValue *shadows_value, *transform_value, *filter_value;
graphene_matrix_t transform_matrix;
GtkCssImage *image;
GskShadow *shadows;
@@ -109,11 +110,14 @@ gtk_css_style_snapshot_icon (GtkCssStyle *style,
return;
shadows_value = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_ICON_SHADOW);
- transform = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_ICON_TRANSFORM);
+ transform_value = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_ICON_TRANSFORM);
+ filter_value = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_ICON_FILTER);
- if (!gtk_css_transform_value_get_matrix (transform, &transform_matrix))
+ if (!gtk_css_transform_value_get_matrix (transform_value, &transform_matrix))
return;
+ gtk_css_filter_value_push_snapshot (filter_value, snapshot);
+
shadows = gtk_css_shadows_value_get_shadows (shadows_value, &n_shadows);
if (shadows)
gtk_snapshot_push_shadow (snapshot, shadows, n_shadows, "IconShadow<%zu>", n_shadows);
@@ -144,6 +148,8 @@ gtk_css_style_snapshot_icon (GtkCssStyle *style,
gtk_snapshot_pop_and_append (snapshot);
g_free (shadows);
}
+
+ gtk_css_filter_value_pop_snapshot (filter_value, snapshot);
}
static gboolean
@@ -266,7 +272,7 @@ gtk_css_style_snapshot_icon_texture (GtkCssStyle *style,
GskTexture *texture,
double texture_scale)
{
- const GtkCssValue *shadows_value, *transform;
+ const GtkCssValue *shadows_value, *transform_value, *filter_value;
graphene_matrix_t transform_matrix;
graphene_rect_t bounds;
double width, height;
@@ -279,13 +285,16 @@ gtk_css_style_snapshot_icon_texture (GtkCssStyle *style,
g_return_if_fail (texture_scale > 0);
shadows_value = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_ICON_SHADOW);
- transform = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_ICON_TRANSFORM);
+ transform_value = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_ICON_TRANSFORM);
+ filter_value = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_ICON_FILTER);
width = gsk_texture_get_width (texture) / texture_scale;
height = gsk_texture_get_height (texture) / texture_scale;
- if (!gtk_css_transform_value_get_matrix (transform, &transform_matrix))
+ if (!gtk_css_transform_value_get_matrix (transform_value, &transform_matrix))
return;
+ gtk_css_filter_value_push_snapshot (filter_value, snapshot);
+
shadows = gtk_css_shadows_value_get_shadows (shadows_value, &n_shadows);
if (shadows)
gtk_snapshot_push_shadow (snapshot, shadows, n_shadows, "IconShadow<%zu>", n_shadows);
@@ -321,4 +330,6 @@ gtk_css_style_snapshot_icon_texture (GtkCssStyle *style,
gtk_snapshot_pop_and_append (snapshot);
g_free (shadows);
}
+
+ gtk_css_filter_value_pop_snapshot (filter_value, snapshot);
}