background-content: Don't set up pipeline unless it's needed

There was still a possibility we might return and not paint anything
so there's no need to set up the pipeline before that.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1363
This commit is contained in:
Daniel van Vugt 2020-07-09 16:19:29 +08:00 committed by Robert Mader
parent a1dd3c43fb
commit 0efecc1dc5

View File

@ -514,13 +514,6 @@ meta_background_content_paint_content (ClutterContent *content,
actor_pixel_rect.width = actor_box.x2 - actor_box.x1;
actor_pixel_rect.height = actor_box.y2 - actor_box.y1;
setup_pipeline (self, actor, paint_context, &actor_pixel_rect);
set_glsl_parameters (self, &actor_pixel_rect);
/* Limit to how many separate rectangles we'll draw; beyond this just
* fall back and draw the whole thing */
#define MAX_RECTS 64
/* Now figure out what to actually paint */
if (self->clip_region)
{
@ -541,6 +534,13 @@ meta_background_content_paint_content (ClutterContent *content,
return;
}
setup_pipeline (self, actor, paint_context, &actor_pixel_rect);
set_glsl_parameters (self, &actor_pixel_rect);
/* Limit to how many separate rectangles we'll draw; beyond this just
* fall back and draw the whole thing */
#define MAX_RECTS 64
n_rects = cairo_region_num_rectangles (region);
if (n_rects <= MAX_RECTS)
{