[mutter/gnome-3-34] shaped-texture: Minor clean up



commit 81b7196ad9df3db651354fa4f045b4813ba1ca97
Author: Jonas Ådahl <jadahl gmail com>
Date:   Fri Dec 6 18:38:46 2019 +0100

    shaped-texture: Minor clean up
    
    Use cogl_clear_object(), add reference to texture when setting, and
    remove redundant runtime type check.
    
    https://gitlab.gnome.org/GNOME/mutter/merge_requests/961
    (cherry picked from commit 60ebf19c9ed3d340330f643d9ebdaa20838f5ebd)

 src/compositor/meta-shaped-texture.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
---
diff --git a/src/compositor/meta-shaped-texture.c b/src/compositor/meta-shaped-texture.c
index 0d26e2283..f22c3b65c 100644
--- a/src/compositor/meta-shaped-texture.c
+++ b/src/compositor/meta-shaped-texture.c
@@ -458,16 +458,11 @@ set_cogl_texture (MetaShapedTexture *stex,
 {
   int width, height;
 
-  g_return_if_fail (META_IS_SHAPED_TEXTURE (stex));
-
-  if (stex->texture)
-    cogl_object_unref (stex->texture);
-
-  stex->texture = cogl_tex;
+  cogl_clear_object (&stex->texture);
 
   if (cogl_tex != NULL)
     {
-      cogl_object_ref (cogl_tex);
+      stex->texture = cogl_object_ref (cogl_tex);
       width = cogl_texture_get_width (COGL_TEXTURE (cogl_tex));
       height = cogl_texture_get_height (COGL_TEXTURE (cogl_tex));
     }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]