texture-cache: Simplify function with g_autoptr
st_texture_cache_reset_texture() is slightly easier to read and follow by using g_autoptr, so use that.
This commit is contained in:
parent
1847a4f4cc
commit
3dcb593a71
@ -658,8 +658,8 @@ st_texture_cache_reset_texture (StTextureCachePropertyBind *bind,
|
|||||||
(cairo_image_surface_get_format (surface) == CAIRO_FORMAT_ARGB32 ||
|
(cairo_image_surface_get_format (surface) == CAIRO_FORMAT_ARGB32 ||
|
||||||
cairo_image_surface_get_format (surface) == CAIRO_FORMAT_RGB24))
|
cairo_image_surface_get_format (surface) == CAIRO_FORMAT_RGB24))
|
||||||
{
|
{
|
||||||
ClutterContent *image;
|
g_autoptr(ClutterContent) image = NULL;
|
||||||
GError *error = NULL;
|
g_autoptr(GError) error = NULL;
|
||||||
|
|
||||||
image = clutter_actor_get_content (bind->actor);
|
image = clutter_actor_get_content (bind->actor);
|
||||||
if (!image || !CLUTTER_IS_IMAGE (image))
|
if (!image || !CLUTTER_IS_IMAGE (image))
|
||||||
@ -677,15 +677,9 @@ st_texture_cache_reset_texture (StTextureCachePropertyBind *bind,
|
|||||||
&error);
|
&error);
|
||||||
|
|
||||||
if (image)
|
if (image)
|
||||||
{
|
clutter_actor_set_content (bind->actor, image);
|
||||||
clutter_actor_set_content (bind->actor, image);
|
|
||||||
g_object_unref (image);
|
|
||||||
}
|
|
||||||
else if (error)
|
else if (error)
|
||||||
{
|
g_warning ("Failed to allocate texture: %s", error->message);
|
||||||
g_warning ("Failed to allocate texture: %s", error->message);
|
|
||||||
g_error_free (error);
|
|
||||||
}
|
|
||||||
|
|
||||||
clutter_actor_set_opacity (bind->actor, 255);
|
clutter_actor_set_opacity (bind->actor, 255);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user