summaryrefslogtreecommitdiff
path: root/gtk/gtkcssshadowvalue.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2016-11-19 20:13:54 +0100
committerBenjamin Otte <otte@redhat.com>2016-11-19 20:58:36 +0100
commitc45f8b1a25c4ef06773c06d30c30199097d29d96 (patch)
treeed3dc2590df5dfe147a6481d9a67042aa27e3903 /gtk/gtkcssshadowvalue.c
parent2745c2502f3ce4a7120f7168dc26b75d7e5d0ccc (diff)
downloadgtk+-c45f8b1a25c4ef06773c06d30c30199097d29d96.tar.gz
cssshadows: Reengineer API
This way we have an API to query extents per shadow and I want that in the next patch.
Diffstat (limited to 'gtk/gtkcssshadowvalue.c')
-rw-r--r--gtk/gtkcssshadowvalue.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/gtk/gtkcssshadowvalue.c b/gtk/gtkcssshadowvalue.c
index eb8fc9e658..a17b213e3d 100644
--- a/gtk/gtkcssshadowvalue.c
+++ b/gtk/gtkcssshadowvalue.c
@@ -605,23 +605,21 @@ _gtk_css_shadow_value_get_inset (const GtkCssValue *shadow)
}
void
-_gtk_css_shadow_value_get_geometry (const GtkCssValue *shadow,
- gdouble *hoffset,
- gdouble *voffset,
- gdouble *radius,
- gdouble *spread)
+gtk_css_shadow_value_get_extents (const GtkCssValue *shadow,
+ GtkBorder *border)
{
- g_return_if_fail (shadow->class == &GTK_CSS_VALUE_SHADOW);
+ gdouble hoffset, voffset, spread, radius, clip_radius;
- if (hoffset != NULL)
- *hoffset = _gtk_css_number_value_get (shadow->hoffset, 0);
- if (voffset != NULL)
- *voffset = _gtk_css_number_value_get (shadow->voffset, 0);
+ spread = _gtk_css_number_value_get (shadow->spread, 0);
+ radius = _gtk_css_number_value_get (shadow->radius, 0);
+ clip_radius = _gtk_cairo_blur_compute_pixels (radius);
+ hoffset = _gtk_css_number_value_get (shadow->hoffset, 0);
+ voffset = _gtk_css_number_value_get (shadow->voffset, 0);
- if (radius != NULL)
- *radius = _gtk_css_number_value_get (shadow->radius, 0);
- if (spread != NULL)
- *spread = _gtk_css_number_value_get (shadow->spread, 0);
+ border->top = MAX (0, ceil (clip_radius + spread - voffset));
+ border->right = MAX (0, ceil (clip_radius + spread + hoffset));
+ border->bottom = MAX (0, ceil (clip_radius + spread + voffset));
+ border->left = MAX (0, ceil (clip_radius + spread - hoffset));
}
static gboolean