clutter/stage-cogl: Only construct damage array if it'll be used

It's only used when we actually swap buffers, which we only do if the
target framebuffer is an onscreen.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1237
This commit is contained in:
Jonas Ådahl 2020-05-13 17:18:50 +02:00 committed by Georges Basile Stavracas Neto
parent 258f859e8d
commit 9e34028742

View File

@ -378,6 +378,10 @@ swap_framebuffer (ClutterStageWindow *stage_window,
gboolean swap_with_damage) gboolean swap_with_damage)
{ {
CoglFramebuffer *framebuffer = clutter_stage_view_get_onscreen (view); CoglFramebuffer *framebuffer = clutter_stage_view_get_onscreen (view);
if (cogl_is_onscreen (framebuffer))
{
CoglOnscreen *onscreen = COGL_ONSCREEN (framebuffer);
int *damage, n_rects, i; int *damage, n_rects, i;
n_rects = cairo_region_num_rectangles (swap_region); n_rects = cairo_region_num_rectangles (swap_region);
@ -393,10 +397,6 @@ swap_framebuffer (ClutterStageWindow *stage_window,
damage[i * 4 + 3] = rect.height; damage[i * 4 + 3] = rect.height;
} }
if (cogl_is_onscreen (framebuffer))
{
CoglOnscreen *onscreen = COGL_ONSCREEN (framebuffer);
/* push on the screen */ /* push on the screen */
if (n_rects > 0 && !swap_with_damage) if (n_rects > 0 && !swap_with_damage)
{ {