summaryrefslogtreecommitdiff
path: root/gtk/gtkrendericon.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2016-12-19 00:45:35 +0100
committerBenjamin Otte <otte@redhat.com>2016-12-20 18:01:12 +0100
commit2480e0d57530b72a8efa4fefeff98971b61e16da (patch)
treed3cfc00d1b527c4a87c5745389ce98e61d90870a /gtk/gtkrendericon.c
parent071c9a8221b53ab3e3586349187119221621d00a (diff)
downloadgtk+-2480e0d57530b72a8efa4fefeff98971b61e16da.tar.gz
gsk: Add GskShadowNode
... and make the icon rendering code use it. This requires moving even more shadow renering code into GSK, but so be it. At least the "shadows not implemented" warning is now gone!
Diffstat (limited to 'gtk/gtkrendericon.c')
-rw-r--r--gtk/gtkrendericon.c42
1 files changed, 26 insertions, 16 deletions
diff --git a/gtk/gtkrendericon.c b/gtk/gtkrendericon.c
index 3af2613b76..15f8397d3c 100644
--- a/gtk/gtkrendericon.c
+++ b/gtk/gtkrendericon.c
@@ -95,10 +95,11 @@ gtk_css_style_snapshot_icon (GtkCssStyle *style,
double height,
GtkCssImageBuiltinType builtin_type)
{
- const GtkCssValue *shadows, *transform;
- static gboolean shadow_warning;
+ const GtkCssValue *shadows_value, *transform;
graphene_matrix_t transform_matrix;
GtkCssImage *image;
+ GskShadow *shadows;
+ gsize n_shadows;
g_return_if_fail (GTK_IS_CSS_STYLE (style));
g_return_if_fail (snapshot != NULL);
@@ -107,17 +108,15 @@ gtk_css_style_snapshot_icon (GtkCssStyle *style,
if (image == NULL)
return;
- shadows = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_ICON_SHADOW);
+ 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);
if (!gtk_css_transform_value_get_matrix (transform, &transform_matrix))
return;
- if (!_gtk_css_shadows_value_is_none (shadows) && !shadow_warning)
- {
- g_warning ("Painting shadows not implemented for textures yet.");
- shadow_warning = TRUE;
- }
+ 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);
if (graphene_matrix_is_identity (&transform_matrix))
{
@@ -139,6 +138,12 @@ gtk_css_style_snapshot_icon (GtkCssStyle *style,
gtk_snapshot_pop_and_append (snapshot);
}
+
+ if (shadows)
+ {
+ gtk_snapshot_pop_and_append (snapshot);
+ g_free (shadows);
+ }
}
static gboolean
@@ -261,18 +266,19 @@ gtk_css_style_snapshot_icon_texture (GtkCssStyle *style,
GskTexture *texture,
double texture_scale)
{
- const GtkCssValue *shadows, *transform;
+ const GtkCssValue *shadows_value, *transform;
graphene_matrix_t transform_matrix;
graphene_rect_t bounds;
double width, height;
- static gboolean shadow_warning;
+ GskShadow *shadows;
+ gsize n_shadows;
g_return_if_fail (GTK_IS_CSS_STYLE (style));
g_return_if_fail (snapshot != NULL);
g_return_if_fail (GSK_IS_TEXTURE (texture));
g_return_if_fail (texture_scale > 0);
- shadows = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_ICON_SHADOW);
+ 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);
width = gsk_texture_get_width (texture) / texture_scale;
height = gsk_texture_get_height (texture) / texture_scale;
@@ -280,11 +286,9 @@ gtk_css_style_snapshot_icon_texture (GtkCssStyle *style,
if (!gtk_css_transform_value_get_matrix (transform, &transform_matrix))
return;
- if (!_gtk_css_shadows_value_is_none (shadows) && !shadow_warning)
- {
- g_warning ("Painting shadows not implemented for textures yet.");
- shadow_warning = TRUE;
- }
+ 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);
if (graphene_matrix_is_identity (&transform_matrix))
{
@@ -311,4 +315,10 @@ gtk_css_style_snapshot_icon_texture (GtkCssStyle *style,
gtk_snapshot_pop_and_append (snapshot);
}
+
+ if (shadows)
+ {
+ gtk_snapshot_pop_and_append (snapshot);
+ g_free (shadows);
+ }
}