[mutter/wip/carlosg/performance-improvements: 34/38] compositor: Ensure to clip partial shadow redraws
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/carlosg/performance-improvements: 34/38] compositor: Ensure to clip partial shadow redraws
- Date: Mon, 22 May 2017 15:44:35 +0000 (UTC)
commit fa8e4f60f66019e9bbaa2b75ee5bc6257979ce1f
Author: Carlos Garnacho <carlosg gnome org>
Date: Sat May 6 17:34:56 2017 +0200
compositor: Ensure to clip partial shadow redraws
Otherwise we end up drawing too far outside the clip area, which
brings in artifacts now that we have tighter regions instead of
an overlapping rect.
https://bugzilla.gnome.org/show_bug.cgi?id=782344
src/compositor/meta-window-actor.c | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c
index 69d39c8..3dd9d46 100644
--- a/src/compositor/meta-window-actor.c
+++ b/src/compositor/meta-window-actor.c
@@ -715,6 +715,7 @@ meta_window_actor_paint (ClutterActor *actor)
cairo_rectangle_int_t shape_bounds;
cairo_region_t *clip = priv->shadow_clip;
MetaWindow *window = priv->window;
+ gboolean partially_drawn = FALSE;
meta_window_actor_get_shape_bounds (self, &shape_bounds);
meta_window_actor_get_shadow_params (self, appears_focused, ¶ms);
@@ -732,6 +733,17 @@ meta_window_actor_paint (ClutterActor *actor)
cairo_region_subtract (clip, frame_bounds);
}
+ else if (clip)
+ {
+ cairo_rectangle_int_t shadow_bounds;
+ cairo_region_t *shadow_region;
+
+ meta_window_actor_get_shadow_bounds (self, appears_focused, &shadow_bounds);
+ shadow_region = cairo_region_create_rectangle (&shadow_bounds);
+ cairo_region_intersect (shadow_region, clip);
+ partially_drawn = !cairo_region_is_empty (shadow_region);
+ cairo_region_destroy (shadow_region);
+ }
meta_shadow_paint (shadow,
params.x_offset + shape_bounds.x,
@@ -740,7 +752,7 @@ meta_window_actor_paint (ClutterActor *actor)
shape_bounds.height,
(clutter_actor_get_paint_opacity (actor) * params.opacity * window->opacity) / (255
* 255),
clip,
- clip_shadow_under_window (self)); /* clip_strictly - not just as an optimization */
+ clip_shadow_under_window (self) || partially_drawn);
if (clip && clip != priv->shadow_clip)
cairo_region_destroy (clip);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]