[mutter] clutter/stage-cogl: Clamp queued_redraw_clip if in use



commit ad65de3790f1ab4e7dcc4c7ffc24dfea5bcae28b
Author: Daniel van Vugt <daniel van vugt canonical com>
Date:   Mon Nov 23 17:56:46 2020 +0800

    clutter/stage-cogl: Clamp queued_redraw_clip if in use
    
    If we are about to replace `redraw_clip` with a clamped version of itself
    then we may as well do the same for `queued_redraw_clip`, so you can see
    more precisely what the damage of the current frame is.
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1554>

 clutter/clutter/cogl/clutter-stage-cogl.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/clutter/clutter/cogl/clutter-stage-cogl.c b/clutter/clutter/cogl/clutter-stage-cogl.c
index ca0ead5e71..b79875725c 100644
--- a/clutter/clutter/cogl/clutter-stage-cogl.c
+++ b/clutter/clutter/cogl/clutter-stage-cogl.c
@@ -485,8 +485,6 @@ clutter_stage_cogl_redraw_view_primary (ClutterStageCogl *stage_cogl,
     cogl_clutter_winsys_has_feature (COGL_WINSYS_FEATURE_BUFFER_AGE);
 
   redraw_clip = clutter_stage_view_take_redraw_clip (view);
-  if (G_UNLIKELY (clutter_paint_debug_flags & CLUTTER_DEBUG_PAINT_DAMAGE_REGION))
-    queued_redraw_clip = cairo_region_copy (redraw_clip);
 
   /* NB: a NULL redraw clip == full stage redraw */
   if (!redraw_clip)
@@ -523,6 +521,16 @@ clutter_stage_cogl_redraw_view_primary (ClutterStageCogl *stage_cogl,
                                                       -view_rect.x,
                                                       -view_rect.y,
                                                       fb_scale);
+
+      if (G_UNLIKELY (clutter_paint_debug_flags &
+                      CLUTTER_DEBUG_PAINT_DAMAGE_REGION))
+        {
+          queued_redraw_clip =
+            scale_offset_and_clamp_region (fb_clip_region,
+                                           1.0 / fb_scale,
+                                           view_rect.x,
+                                           view_rect.y);
+        }
     }
   else
     {
@@ -534,6 +542,10 @@ clutter_stage_cogl_redraw_view_primary (ClutterStageCogl *stage_cogl,
       };
       fb_clip_region = cairo_region_create_rectangle (&fb_rect);
 
+      if (G_UNLIKELY (clutter_paint_debug_flags &
+                      CLUTTER_DEBUG_PAINT_DAMAGE_REGION))
+        queued_redraw_clip = cairo_region_reference (redraw_clip);
+
       g_clear_pointer (&redraw_clip, cairo_region_destroy);
       redraw_clip = cairo_region_create_rectangle (&view_rect);
     }


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