1
0
Fork 0

background-content: Simplify method call

It's always passing the same pipeline and texture rect, simplify
by passing the MetaBackgroundContent instance itself.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1302
This commit is contained in:
Georges Basile Stavracas Neto 2020-06-09 13:02:50 -03:00
parent 6bd382ad23
commit 6d75b4fc53

View file

@ -442,10 +442,9 @@ set_glsl_parameters (MetaBackgroundContent *self,
} }
static void static void
paint_clipped_rectangle (ClutterPaintNode *node, paint_clipped_rectangle (MetaBackgroundContent *self,
CoglPipeline *pipeline, ClutterPaintNode *node,
cairo_rectangle_int_t *rect, cairo_rectangle_int_t *rect)
cairo_rectangle_int_t *texture_area)
{ {
g_autoptr (ClutterPaintNode) pipeline_node = NULL; g_autoptr (ClutterPaintNode) pipeline_node = NULL;
float x1, y1, x2, y2; float x1, y1, x2, y2;
@ -456,12 +455,12 @@ paint_clipped_rectangle (ClutterPaintNode *node,
x2 = rect->x + rect->width; x2 = rect->x + rect->width;
y2 = rect->y + rect->height; y2 = rect->y + rect->height;
tx1 = (x1 - texture_area->x) / texture_area->width; tx1 = (x1 - self->texture_area.x) / (float)self->texture_area.width;
ty1 = (y1 - texture_area->y) / texture_area->height; ty1 = (y1 - self->texture_area.y) / (float)self->texture_area.height;
tx2 = (x2 - texture_area->x) / texture_area->width; tx2 = (x2 - self->texture_area.x) / (float)self->texture_area.width;
ty2 = (y2 - texture_area->y) / texture_area->height; ty2 = (y2 - self->texture_area.y) / (float)self->texture_area.height;
pipeline_node = clutter_pipeline_node_new (pipeline); pipeline_node = clutter_pipeline_node_new (self->pipeline);
clutter_paint_node_set_name (pipeline_node, "MetaBackgroundContent (Slice)"); clutter_paint_node_set_name (pipeline_node, "MetaBackgroundContent (Slice)");
clutter_paint_node_add_texture_rectangle (pipeline_node, clutter_paint_node_add_texture_rectangle (pipeline_node,
&(ClutterActorBox) { &(ClutterActorBox) {
@ -531,16 +530,14 @@ meta_background_content_paint_content (ClutterContent *content,
{ {
cairo_rectangle_int_t rect; cairo_rectangle_int_t rect;
cairo_region_get_rectangle (region, i, &rect); cairo_region_get_rectangle (region, i, &rect);
paint_clipped_rectangle (node, self->pipeline, &rect, paint_clipped_rectangle (self, node, &rect);
&self->texture_area);
} }
} }
else else
{ {
cairo_rectangle_int_t rect; cairo_rectangle_int_t rect;
cairo_region_get_extents (region, &rect); cairo_region_get_extents (region, &rect);
paint_clipped_rectangle (node, self->pipeline, &rect, paint_clipped_rectangle (self, node, &rect);
&self->texture_area);
} }
cairo_region_destroy (region); cairo_region_destroy (region);