[mutter/gnome-3-28] compositor: Avoid changing pipeline/source if shadow is not being painted



commit 4af8d9d4752a94612a98d619e65828f0070a7b0e
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sun May 7 01:00:10 2017 +0000

    compositor: Avoid changing pipeline/source if shadow is not being painted
    
    Avoids some context invalidations in cogl.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=782344
    
    
    (cherry picked from commit 3c6a518d40d0ed8d04343f0780100e88f8519ed1)

 src/compositor/meta-shadow-factory.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/src/compositor/meta-shadow-factory.c b/src/compositor/meta-shadow-factory.c
index cd006008b..19147ca9f 100644
--- a/src/compositor/meta-shadow-factory.c
+++ b/src/compositor/meta-shadow-factory.c
@@ -220,9 +220,7 @@ meta_shadow_paint (MetaShadow     *shadow,
   int dest_x[4];
   int dest_y[4];
   int n_x, n_y;
-
-  cogl_pipeline_set_color4ub (shadow->pipeline,
-                              opacity, opacity, opacity, opacity);
+  gboolean source_updated = FALSE;
 
   cogl_set_source (shadow->pipeline);
 
@@ -300,6 +298,17 @@ meta_shadow_paint (MetaShadow     *shadow,
           else
             overlap = CAIRO_REGION_OVERLAP_IN;
 
+          if (overlap == CAIRO_REGION_OVERLAP_OUT)
+            continue;
+
+          if (!source_updated)
+            {
+              cogl_pipeline_set_color4ub (shadow->pipeline,
+                                          opacity, opacity, opacity, opacity);
+              cogl_set_source (shadow->pipeline);
+              source_updated = TRUE;
+            }
+
           /* There's quite a bit of overhead from allocating a new
            * region in order to find an exact intersection and
            * generating more geometry - we make the assumption that


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