forked from AuroraMiddleware/gtk
cssshadows: Reengineer API
This way we have an API to query extents per shadow and I want that in the next patch.
This commit is contained in:
parent
2745c2502f
commit
c45f8b1a25
@ -320,9 +320,8 @@ _gtk_css_shadows_value_get_extents (const GtkCssValue *shadows,
|
|||||||
GtkBorder *border)
|
GtkBorder *border)
|
||||||
{
|
{
|
||||||
guint i;
|
guint i;
|
||||||
GtkBorder b = { 0 };
|
GtkBorder b = { 0 }, sb;
|
||||||
const GtkCssValue *shadow;
|
const GtkCssValue *shadow;
|
||||||
gdouble hoffset, voffset, spread, radius, clip_radius;
|
|
||||||
|
|
||||||
g_return_if_fail (shadows->class == >K_CSS_VALUE_SHADOWS);
|
g_return_if_fail (shadows->class == >K_CSS_VALUE_SHADOWS);
|
||||||
|
|
||||||
@ -335,19 +334,8 @@ _gtk_css_shadows_value_get_extents (const GtkCssValue *shadows,
|
|||||||
if (_gtk_css_shadow_value_get_inset (shadow))
|
if (_gtk_css_shadow_value_get_inset (shadow))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
_gtk_css_shadow_value_get_geometry (shadow,
|
gtk_css_shadow_value_get_extents (shadow, &sb);
|
||||||
&hoffset, &voffset,
|
|
||||||
&radius, &spread);
|
|
||||||
clip_radius = _gtk_cairo_blur_compute_pixels (radius);
|
|
||||||
|
|
||||||
b.top = MAX (0, ceil (clip_radius + spread - voffset));
|
b.top = MAX (b.top, sb.top);
|
||||||
b.right = MAX (0, ceil (clip_radius + spread + hoffset));
|
|
||||||
b.bottom = MAX (0, ceil (clip_radius + spread + voffset));
|
|
||||||
b.left = MAX (0, ceil (clip_radius + spread - hoffset));
|
|
||||||
|
|
||||||
border->top = MAX (border->top, b.top);
|
|
||||||
border->right = MAX (border->right, b.right);
|
|
||||||
border->bottom = MAX (border->bottom, b.bottom);
|
|
||||||
border->left = MAX (border->left, b.left);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -605,23 +605,21 @@ _gtk_css_shadow_value_get_inset (const GtkCssValue *shadow)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_gtk_css_shadow_value_get_geometry (const GtkCssValue *shadow,
|
gtk_css_shadow_value_get_extents (const GtkCssValue *shadow,
|
||||||
gdouble *hoffset,
|
GtkBorder *border)
|
||||||
gdouble *voffset,
|
|
||||||
gdouble *radius,
|
|
||||||
gdouble *spread)
|
|
||||||
{
|
{
|
||||||
g_return_if_fail (shadow->class == >K_CSS_VALUE_SHADOW);
|
gdouble hoffset, voffset, spread, radius, clip_radius;
|
||||||
|
|
||||||
if (hoffset != NULL)
|
spread = _gtk_css_number_value_get (shadow->spread, 0);
|
||||||
*hoffset = _gtk_css_number_value_get (shadow->hoffset, 0);
|
radius = _gtk_css_number_value_get (shadow->radius, 0);
|
||||||
if (voffset != NULL)
|
clip_radius = _gtk_cairo_blur_compute_pixels (radius);
|
||||||
*voffset = _gtk_css_number_value_get (shadow->voffset, 0);
|
hoffset = _gtk_css_number_value_get (shadow->hoffset, 0);
|
||||||
|
voffset = _gtk_css_number_value_get (shadow->voffset, 0);
|
||||||
|
|
||||||
if (radius != NULL)
|
border->top = MAX (0, ceil (clip_radius + spread - voffset));
|
||||||
*radius = _gtk_css_number_value_get (shadow->radius, 0);
|
border->right = MAX (0, ceil (clip_radius + spread + hoffset));
|
||||||
if (spread != NULL)
|
border->bottom = MAX (0, ceil (clip_radius + spread + voffset));
|
||||||
*spread = _gtk_css_number_value_get (shadow->spread, 0);
|
border->left = MAX (0, ceil (clip_radius + spread - hoffset));
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@ -37,11 +37,8 @@ GtkCssValue * _gtk_css_shadow_value_parse (GtkCssParser
|
|||||||
|
|
||||||
gboolean _gtk_css_shadow_value_get_inset (const GtkCssValue *shadow);
|
gboolean _gtk_css_shadow_value_get_inset (const GtkCssValue *shadow);
|
||||||
|
|
||||||
void _gtk_css_shadow_value_get_geometry (const GtkCssValue *shadow,
|
void gtk_css_shadow_value_get_extents (const GtkCssValue *shadow,
|
||||||
gdouble *hoffset,
|
GtkBorder *border);
|
||||||
gdouble *voffset,
|
|
||||||
gdouble *radius,
|
|
||||||
gdouble *spread);
|
|
||||||
|
|
||||||
void _gtk_css_shadow_value_paint_layout (const GtkCssValue *shadow,
|
void _gtk_css_shadow_value_paint_layout (const GtkCssValue *shadow,
|
||||||
cairo_t *cr,
|
cairo_t *cr,
|
||||||
|
Loading…
Reference in New Issue
Block a user