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 use_clipped_redraw;
|
||||||
gboolean can_blit_sub_buffer;
|
gboolean can_blit_sub_buffer;
|
||||||
gboolean has_buffer_age;
|
gboolean has_buffer_age;
|
||||||
gboolean do_swap_buffer;
|
|
||||||
gboolean swap_with_damage;
|
gboolean swap_with_damage;
|
||||||
cairo_region_t *redraw_clip;
|
cairo_region_t *redraw_clip;
|
||||||
cairo_region_t *queued_redraw_clip = NULL;
|
cairo_region_t *queued_redraw_clip = NULL;
|
||||||
cairo_region_t *fb_clip_region;
|
cairo_region_t *fb_clip_region;
|
||||||
cairo_region_t *swap_region;
|
cairo_region_t *swap_region;
|
||||||
gboolean clip_region_empty;
|
|
||||||
float fb_scale;
|
float fb_scale;
|
||||||
int fb_width, fb_height;
|
int fb_width, fb_height;
|
||||||
int buffer_age;
|
int buffer_age;
|
||||||
|
gboolean res;
|
||||||
|
|
||||||
clutter_stage_view_get_layout (view, &view_rect);
|
clutter_stage_view_get_layout (view, &view_rect);
|
||||||
fb_scale = clutter_stage_view_get_scale (view);
|
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);
|
redraw_clip = cairo_region_create_rectangle (&view_rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
clip_region_empty = (use_clipped_redraw &&
|
g_return_val_if_fail (!cairo_region_is_empty (fb_clip_region), FALSE);
|
||||||
cairo_region_is_empty (fb_clip_region));
|
|
||||||
|
|
||||||
swap_with_damage = FALSE;
|
swap_with_damage = FALSE;
|
||||||
if (has_buffer_age)
|
if (has_buffer_age)
|
||||||
{
|
{
|
||||||
if (use_clipped_redraw && !clip_region_empty)
|
if (use_clipped_redraw)
|
||||||
{
|
{
|
||||||
cairo_region_t *fb_damage;
|
cairo_region_t *fb_damage;
|
||||||
cairo_region_t *view_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)
|
if (use_clipped_redraw)
|
||||||
{
|
|
||||||
CLUTTER_NOTE (CLIPPING, "Empty stage output paint\n");
|
|
||||||
}
|
|
||||||
else if (use_clipped_redraw)
|
|
||||||
{
|
{
|
||||||
cogl_framebuffer_push_region_clip (fb, fb_clip_region);
|
cogl_framebuffer_push_region_clip (fb, fb_clip_region);
|
||||||
|
|
||||||
@ -741,30 +735,13 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
|
|||||||
* artefacts.
|
* artefacts.
|
||||||
*/
|
*/
|
||||||
if (use_clipped_redraw)
|
if (use_clipped_redraw)
|
||||||
{
|
|
||||||
if (clip_region_empty)
|
|
||||||
{
|
|
||||||
do_swap_buffer = FALSE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
swap_region = cairo_region_copy (fb_clip_region);
|
swap_region = cairo_region_copy (fb_clip_region);
|
||||||
do_swap_buffer = TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
swap_region = cairo_region_create ();
|
swap_region = cairo_region_create ();
|
||||||
do_swap_buffer = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_clear_pointer (&redraw_clip, cairo_region_destroy);
|
g_clear_pointer (&redraw_clip, cairo_region_destroy);
|
||||||
g_clear_pointer (&fb_clip_region, cairo_region_destroy);
|
g_clear_pointer (&fb_clip_region, cairo_region_destroy);
|
||||||
|
|
||||||
if (do_swap_buffer)
|
|
||||||
{
|
|
||||||
gboolean res;
|
|
||||||
|
|
||||||
COGL_TRACE_BEGIN_SCOPED (ClutterStageCoglRedrawViewSwapFramebuffer,
|
COGL_TRACE_BEGIN_SCOPED (ClutterStageCoglRedrawViewSwapFramebuffer,
|
||||||
"Paint (swap framebuffer)");
|
"Paint (swap framebuffer)");
|
||||||
|
|
||||||
@ -794,12 +771,6 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
|
|||||||
cairo_region_destroy (swap_region);
|
cairo_region_destroy (swap_region);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
g_clear_pointer (&queued_redraw_clip, cairo_region_destroy);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user