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>
This commit is contained in:
Daniel van Vugt 2020-11-23 17:56:46 +08:00
parent 456f80022a
commit ad65de3790

View File

@ -485,8 +485,6 @@ clutter_stage_cogl_redraw_view_primary (ClutterStageCogl *stage_cogl,
cogl_clutter_winsys_has_feature (COGL_WINSYS_FEATURE_BUFFER_AGE); cogl_clutter_winsys_has_feature (COGL_WINSYS_FEATURE_BUFFER_AGE);
redraw_clip = clutter_stage_view_take_redraw_clip (view); 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 */ /* NB: a NULL redraw clip == full stage redraw */
if (!redraw_clip) if (!redraw_clip)
@ -523,6 +521,16 @@ clutter_stage_cogl_redraw_view_primary (ClutterStageCogl *stage_cogl,
-view_rect.x, -view_rect.x,
-view_rect.y, -view_rect.y,
fb_scale); 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 else
{ {
@ -534,6 +542,10 @@ clutter_stage_cogl_redraw_view_primary (ClutterStageCogl *stage_cogl,
}; };
fb_clip_region = cairo_region_create_rectangle (&fb_rect); 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); g_clear_pointer (&redraw_clip, cairo_region_destroy);
redraw_clip = cairo_region_create_rectangle (&view_rect); redraw_clip = cairo_region_create_rectangle (&view_rect);
} }