forked from AuroraMiddleware/gtk
borderimage: No need to resolve
border-image is a shorthand, so it's unpacked unresolved and repacked resolved.
This commit is contained in:
parent
4e95e6ae21
commit
c0a6b1fb90
@ -55,7 +55,6 @@ struct _GtkBorderImage {
|
||||
GtkCssBorderImageRepeat repeat;
|
||||
|
||||
gint ref_count;
|
||||
gboolean resolved;
|
||||
};
|
||||
|
||||
GtkBorderImage *
|
||||
@ -77,8 +76,6 @@ _gtk_border_image_new (cairo_pattern_t *pattern,
|
||||
if (repeat != NULL)
|
||||
image->repeat = *repeat;
|
||||
|
||||
image->resolved = TRUE;
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
@ -101,38 +98,9 @@ _gtk_border_image_new_for_gradient (GtkGradient *gradient,
|
||||
if (repeat != NULL)
|
||||
image->repeat = *repeat;
|
||||
|
||||
image->resolved = FALSE;
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
gboolean
|
||||
_gtk_border_image_get_resolved (GtkBorderImage *image)
|
||||
{
|
||||
return image->resolved;
|
||||
}
|
||||
|
||||
GtkBorderImage *
|
||||
_gtk_border_image_resolve (GtkBorderImage *image,
|
||||
GtkStyleProperties *props)
|
||||
{
|
||||
GtkBorderImage *resolved_image;
|
||||
cairo_pattern_t *pattern;
|
||||
|
||||
if (image->resolved)
|
||||
return _gtk_border_image_ref (image);
|
||||
|
||||
image->resolved =
|
||||
gtk_gradient_resolve (image->source_gradient, props, &pattern);
|
||||
|
||||
if (!image->resolved)
|
||||
return NULL;
|
||||
|
||||
resolved_image = _gtk_border_image_new (pattern, &image->slice, &image->repeat);
|
||||
|
||||
return resolved_image;
|
||||
}
|
||||
|
||||
GtkBorderImage *
|
||||
_gtk_border_image_ref (GtkBorderImage *image)
|
||||
{
|
||||
|
@ -45,10 +45,6 @@ GtkBorderImage * _gtk_border_image_new_for_gradient (GtkGradient *grad
|
||||
GtkBorder *slice,
|
||||
GtkCssBorderImageRepeat *repeat);
|
||||
|
||||
GtkBorderImage * _gtk_border_image_resolve (GtkBorderImage *image,
|
||||
GtkStyleProperties *props);
|
||||
gboolean _gtk_border_image_get_resolved (GtkBorderImage *image);
|
||||
|
||||
GtkBorderImage * _gtk_border_image_ref (GtkBorderImage *image);
|
||||
void _gtk_border_image_unref (GtkBorderImage *image);
|
||||
|
||||
|
@ -1915,29 +1915,6 @@ resolve_shadow (GtkStyleProperties *props,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
resolve_border_image (GtkStyleProperties *props,
|
||||
GValue *value)
|
||||
{
|
||||
GtkBorderImage *resolved, *base;
|
||||
|
||||
base = g_value_get_boxed (value);
|
||||
|
||||
if (base == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (_gtk_border_image_get_resolved (base))
|
||||
return TRUE;
|
||||
|
||||
resolved = _gtk_border_image_resolve (base, props);
|
||||
if (resolved == NULL)
|
||||
return FALSE;
|
||||
|
||||
g_value_take_boxed (value, resolved);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
_gtk_style_property_resolve (const GtkStyleProperty *property,
|
||||
GtkStyleProperties *props,
|
||||
@ -1970,11 +1947,6 @@ _gtk_style_property_resolve (const GtkStyleProperty *property,
|
||||
if (!resolve_shadow (props, val))
|
||||
_gtk_style_property_resolve (property, props, val);
|
||||
}
|
||||
else if (G_VALUE_TYPE (val) == GTK_TYPE_BORDER_IMAGE)
|
||||
{
|
||||
if (!resolve_border_image (props, val))
|
||||
_gtk_style_property_resolve (property, props, val);
|
||||
}
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
Loading…
Reference in New Issue
Block a user