[mutter/wip/carlosg/performance-improvements: 29/38] compositor: Avoid changing pipeline/source if shadow is not being painted
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/carlosg/performance-improvements: 29/38] compositor: Avoid changing pipeline/source if shadow is not being painted
- Date: Mon, 22 May 2017 15:44:09 +0000 (UTC)
commit 060543466c4cb55557734fc03b40e09ecb086e16
Author: Carlos Garnacho <carlosg gnome org>
Date: Sun May 7 03:00:10 2017 +0200
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
src/compositor/meta-shadow-factory.c | 17 ++++++++++++-----
1 files changed, 12 insertions(+), 5 deletions(-)
---
diff --git a/src/compositor/meta-shadow-factory.c b/src/compositor/meta-shadow-factory.c
index cd00600..33b9741 100644
--- a/src/compositor/meta-shadow-factory.c
+++ b/src/compositor/meta-shadow-factory.c
@@ -220,11 +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);
-
- cogl_set_source (shadow->pipeline);
+ gboolean source_updated = FALSE;
if (shadow->scale_width)
{
@@ -300,6 +296,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]