[gnome-shell/gbsneto/more-clutter-content: 4/5] st: Check for ClutterImage when creating shadow pipelines



commit 397d0954d6dbdcd255933ba93b615ab1390f7840
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Tue Jan 29 12:22:26 2019 -0200

    st: Check for ClutterImage when creating shadow pipelines
    
    _st_create_shadow_pipeline_from_actor creates shadow pipelines
    from actors. This function special-cases ClutterTexture as a
    small performance improvement, since we can have access to the
    CoglTexture easily with it. However, recent commits removed all
    usage of ClutterTexture from GNOME Shell, rendering this optimization
    useless. Instead, actors now may have a ClutterImage set as
    their content, that can be used instead.
    
    Replace the check for ClutterTexture with a check for ClutterImage,
    and use the texture of the image when it is available.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/371

 src/st/st-private.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/src/st/st-private.c b/src/st/st-private.c
index cd080d611..a056d61cf 100644
--- a/src/st/st-private.c
+++ b/src/st/st-private.c
@@ -429,6 +429,7 @@ CoglPipeline *
 _st_create_shadow_pipeline_from_actor (StShadow     *shadow_spec,
                                        ClutterActor *actor)
 {
+  ClutterContent *image = NULL;
   CoglPipeline *shadow_pipeline = NULL;
   float width, height;
 
@@ -439,11 +440,12 @@ _st_create_shadow_pipeline_from_actor (StShadow     *shadow_spec,
   if (width == 0 || height == 0)
     return NULL;
 
-  if (CLUTTER_IS_TEXTURE (actor))
+  image = clutter_actor_get_content (actor);
+  if (image || CLUTTER_IS_IMAGE (image))
     {
       CoglTexture *texture;
 
-      texture = clutter_texture_get_cogl_texture (CLUTTER_TEXTURE (actor));
+      texture = clutter_image_get_texture (CLUTTER_IMAGE (image));
       if (texture &&
           cogl_texture_get_width (texture) == width &&
           cogl_texture_get_height (texture) == height)


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