mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 15:40:41 -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,65 +735,42 @@ 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;
|
||||
}
|
||||
}
|
||||
swap_region = cairo_region_copy (fb_clip_region);
|
||||
else
|
||||
{
|
||||
swap_region = cairo_region_create ();
|
||||
do_swap_buffer = TRUE;
|
||||
}
|
||||
swap_region = cairo_region_create ();
|
||||
|
||||
g_clear_pointer (&redraw_clip, cairo_region_destroy);
|
||||
g_clear_pointer (&fb_clip_region, cairo_region_destroy);
|
||||
|
||||
if (do_swap_buffer)
|
||||
COGL_TRACE_BEGIN_SCOPED (ClutterStageCoglRedrawViewSwapFramebuffer,
|
||||
"Paint (swap framebuffer)");
|
||||
|
||||
if (clutter_stage_view_get_onscreen (view) !=
|
||||
clutter_stage_view_get_framebuffer (view))
|
||||
{
|
||||
gboolean res;
|
||||
|
||||
COGL_TRACE_BEGIN_SCOPED (ClutterStageCoglRedrawViewSwapFramebuffer,
|
||||
"Paint (swap framebuffer)");
|
||||
|
||||
if (clutter_stage_view_get_onscreen (view) !=
|
||||
clutter_stage_view_get_framebuffer (view))
|
||||
{
|
||||
cairo_region_t *transformed_swap_region;
|
||||
|
||||
transformed_swap_region =
|
||||
transform_swap_region_to_onscreen (view, swap_region);
|
||||
cairo_region_destroy (swap_region);
|
||||
swap_region = transformed_swap_region;
|
||||
}
|
||||
|
||||
if (queued_redraw_clip)
|
||||
{
|
||||
paint_damage_region (stage_window, view,
|
||||
swap_region, queued_redraw_clip);
|
||||
cairo_region_destroy (queued_redraw_clip);
|
||||
}
|
||||
|
||||
res = swap_framebuffer (stage_window,
|
||||
view,
|
||||
swap_region,
|
||||
swap_with_damage);
|
||||
cairo_region_t *transformed_swap_region;
|
||||
|
||||
transformed_swap_region =
|
||||
transform_swap_region_to_onscreen (view, swap_region);
|
||||
cairo_region_destroy (swap_region);
|
||||
swap_region = transformed_swap_region;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
else
|
||||
if (queued_redraw_clip)
|
||||
{
|
||||
g_clear_pointer (&queued_redraw_clip, cairo_region_destroy);
|
||||
return FALSE;
|
||||
paint_damage_region (stage_window, view,
|
||||
swap_region, queued_redraw_clip);
|
||||
cairo_region_destroy (queued_redraw_clip);
|
||||
}
|
||||
|
||||
res = swap_framebuffer (stage_window,
|
||||
view,
|
||||
swap_region,
|
||||
swap_with_damage);
|
||||
|
||||
cairo_region_destroy (swap_region);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user