mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 01:20:42 -05:00
clutter/stage-cogl: Warn if the fb_clip_region is empty
Since a NULL redraw_clip means that a full view redraw should be done and an empty redraw clip may never be set (see the width/height checks in clutter_stage_view_add_redraw_clip()), the fb_clip_region should always be set to a reasonable region that's either the whole view or individual regions inside the view. So make sure that's actually the case by warning and that the fb_clip_region isn't empty, which allows dropping another few lines of code. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1113
This commit is contained in:
parent
08f47fee16
commit
066e78c9b3
@ -578,16 +578,15 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
|
||||
gboolean use_clipped_redraw;
|
||||
gboolean can_blit_sub_buffer;
|
||||
gboolean has_buffer_age;
|
||||
gboolean do_swap_buffer;
|
||||
gboolean swap_with_damage;
|
||||
cairo_region_t *redraw_clip;
|
||||
cairo_region_t *queued_redraw_clip = NULL;
|
||||
cairo_region_t *fb_clip_region;
|
||||
cairo_region_t *swap_region;
|
||||
gboolean clip_region_empty;
|
||||
float fb_scale;
|
||||
int fb_width, fb_height;
|
||||
int buffer_age;
|
||||
gboolean res;
|
||||
|
||||
clutter_stage_view_get_layout (view, &view_rect);
|
||||
fb_scale = clutter_stage_view_get_scale (view);
|
||||
@ -653,13 +652,12 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
|
||||
redraw_clip = cairo_region_create_rectangle (&view_rect);
|
||||
}
|
||||
|
||||
clip_region_empty = (use_clipped_redraw &&
|
||||
cairo_region_is_empty (fb_clip_region));
|
||||
g_return_val_if_fail (!cairo_region_is_empty (fb_clip_region), FALSE);
|
||||
|
||||
swap_with_damage = FALSE;
|
||||
if (has_buffer_age)
|
||||
{
|
||||
if (use_clipped_redraw && !clip_region_empty)
|
||||
if (use_clipped_redraw)
|
||||
{
|
||||
cairo_region_t *fb_damage;
|
||||
cairo_region_t *view_damage;
|
||||
@ -713,11 +711,7 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
|
||||
}
|
||||
}
|
||||
|
||||
if (use_clipped_redraw && clip_region_empty)
|
||||
{
|
||||
CLUTTER_NOTE (CLIPPING, "Empty stage output paint\n");
|
||||
}
|
||||
else if (use_clipped_redraw)
|
||||
if (use_clipped_redraw)
|
||||
{
|
||||
cogl_framebuffer_push_region_clip (fb, fb_clip_region);
|
||||
|
||||
@ -741,30 +735,13 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
|
||||
* artefacts.
|
||||
*/
|
||||
if (use_clipped_redraw)
|
||||
{
|
||||
if (clip_region_empty)
|
||||
{
|
||||
do_swap_buffer = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
swap_region = cairo_region_copy (fb_clip_region);
|
||||
do_swap_buffer = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
swap_region = cairo_region_create ();
|
||||
do_swap_buffer = TRUE;
|
||||
}
|
||||
|
||||
g_clear_pointer (&redraw_clip, cairo_region_destroy);
|
||||
g_clear_pointer (&fb_clip_region, cairo_region_destroy);
|
||||
|
||||
if (do_swap_buffer)
|
||||
{
|
||||
gboolean res;
|
||||
|
||||
COGL_TRACE_BEGIN_SCOPED (ClutterStageCoglRedrawViewSwapFramebuffer,
|
||||
"Paint (swap framebuffer)");
|
||||
|
||||
@ -795,12 +772,6 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
|
||||
|
||||
return res;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_clear_pointer (&queued_redraw_clip, cairo_region_destroy);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_cogl_scanout_view (ClutterStageCogl *stage_cogl,
|
||||
|
Loading…
Reference in New Issue
Block a user