styleproperty: Save some memory
Only create a new CssValue when we actually need one.
This commit is contained in:
@@ -400,10 +400,20 @@ css_image_value_compute (GtkCssStyleProperty *property,
|
||||
GtkStyleContext *context,
|
||||
GtkCssValue *specified)
|
||||
{
|
||||
GtkCssImage *image = _gtk_css_value_get_image (specified);
|
||||
GtkCssImage *image, *computed;
|
||||
|
||||
image = _gtk_css_value_get_image (specified);
|
||||
|
||||
if (image)
|
||||
image = _gtk_css_image_compute (image, context);
|
||||
if (image == NULL)
|
||||
return _gtk_css_value_ref (specified);
|
||||
|
||||
computed = _gtk_css_image_compute (image, context);
|
||||
|
||||
if (computed == image)
|
||||
{
|
||||
g_object_unref (computed);
|
||||
return _gtk_css_value_ref (specified);
|
||||
}
|
||||
|
||||
return _gtk_css_value_new_take_image (image);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user