borderimage: No need to resolve

border-image is a shorthand, so it's unpacked unresolved and repacked
resolved.
This commit is contained in:
Benjamin Otte 2011-06-07 16:48:47 +02:00
parent 4e95e6ae21
commit c0a6b1fb90
3 changed files with 0 additions and 64 deletions

View File

@ -55,7 +55,6 @@ struct _GtkBorderImage {
GtkCssBorderImageRepeat repeat; GtkCssBorderImageRepeat repeat;
gint ref_count; gint ref_count;
gboolean resolved;
}; };
GtkBorderImage * GtkBorderImage *
@ -77,8 +76,6 @@ _gtk_border_image_new (cairo_pattern_t *pattern,
if (repeat != NULL) if (repeat != NULL)
image->repeat = *repeat; image->repeat = *repeat;
image->resolved = TRUE;
return image; return image;
} }
@ -101,38 +98,9 @@ _gtk_border_image_new_for_gradient (GtkGradient *gradient,
if (repeat != NULL) if (repeat != NULL)
image->repeat = *repeat; image->repeat = *repeat;
image->resolved = FALSE;
return image; 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 * GtkBorderImage *
_gtk_border_image_ref (GtkBorderImage *image) _gtk_border_image_ref (GtkBorderImage *image)
{ {

View File

@ -45,10 +45,6 @@ GtkBorderImage * _gtk_border_image_new_for_gradient (GtkGradient *grad
GtkBorder *slice, GtkBorder *slice,
GtkCssBorderImageRepeat *repeat); 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); GtkBorderImage * _gtk_border_image_ref (GtkBorderImage *image);
void _gtk_border_image_unref (GtkBorderImage *image); void _gtk_border_image_unref (GtkBorderImage *image);

View File

@ -1915,29 +1915,6 @@ resolve_shadow (GtkStyleProperties *props,
return TRUE; 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 void
_gtk_style_property_resolve (const GtkStyleProperty *property, _gtk_style_property_resolve (const GtkStyleProperty *property,
GtkStyleProperties *props, GtkStyleProperties *props,
@ -1970,11 +1947,6 @@ _gtk_style_property_resolve (const GtkStyleProperty *property,
if (!resolve_shadow (props, val)) if (!resolve_shadow (props, val))
_gtk_style_property_resolve (property, 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 gboolean