diff --git a/src/compositor/meta-background-content.c b/src/compositor/meta-background-content.c index 1d926ee95..13c9e85c5 100644 --- a/src/compositor/meta-background-content.c +++ b/src/compositor/meta-background-content.c @@ -444,21 +444,26 @@ set_glsl_parameters (MetaBackgroundContent *self, static void paint_clipped_rectangle (MetaBackgroundContent *self, ClutterPaintNode *node, + ClutterActorBox *actor_box, cairo_rectangle_int_t *rect) { g_autoptr (ClutterPaintNode) pipeline_node = NULL; + float h_scale, v_scale; float x1, y1, x2, y2; float tx1, ty1, tx2, ty2; + h_scale = self->texture_area.width / clutter_actor_box_get_width (actor_box); + v_scale = self->texture_area.height / clutter_actor_box_get_height (actor_box); + x1 = rect->x; y1 = rect->y; x2 = rect->x + rect->width; y2 = rect->y + rect->height; - tx1 = (x1 - self->texture_area.x) / (float)self->texture_area.width; - ty1 = (y1 - self->texture_area.y) / (float)self->texture_area.height; - tx2 = (x2 - self->texture_area.x) / (float)self->texture_area.width; - ty2 = (y2 - self->texture_area.y) / (float)self->texture_area.height; + tx1 = (x1 * h_scale - self->texture_area.x) / (float)self->texture_area.width; + ty1 = (y1 * v_scale - self->texture_area.y) / (float)self->texture_area.height; + tx2 = (x2 * h_scale - self->texture_area.x) / (float)self->texture_area.width; + ty2 = (y2 * v_scale - self->texture_area.y) / (float)self->texture_area.height; pipeline_node = clutter_pipeline_node_new (self->pipeline); clutter_paint_node_set_name (pipeline_node, "MetaBackgroundContent (Slice)"); @@ -530,14 +535,14 @@ meta_background_content_paint_content (ClutterContent *content, { cairo_rectangle_int_t rect; cairo_region_get_rectangle (region, i, &rect); - paint_clipped_rectangle (self, node, &rect); + paint_clipped_rectangle (self, node, &actor_box, &rect); } } else { cairo_rectangle_int_t rect; cairo_region_get_extents (region, &rect); - paint_clipped_rectangle (self, node, &rect); + paint_clipped_rectangle (self, node, &actor_box, &rect); } cairo_region_destroy (region);