clutter/stage-cogl: Don't loop through region rects twice

There's no reason for using two loops to fill the rects array in
offset_scale_and_clamp_region(), we can do that using only one loop.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1113
This commit is contained in:
Jonas Dreßler 2020-05-13 11:02:56 +02:00 committed by Jonas Ådahl
parent 967511be61
commit 434845dbe5

View File

@ -450,17 +450,17 @@ offset_scale_and_clamp_region (const cairo_region_t *region,
else
rects = freeme = g_new (cairo_rectangle_int_t, n_rects);
for (i = 0; i < n_rects; i++)
cairo_region_get_rectangle (region, i, &rects[i]);
for (i = 0; i < n_rects; i++)
{
cairo_rectangle_int_t *rect = &rects[i];
graphene_rect_t tmp;
_clutter_util_rect_from_rectangle (&rects[i], &tmp);
cairo_region_get_rectangle (region, i, rect);
_clutter_util_rect_from_rectangle (rect, &tmp);
graphene_rect_offset (&tmp, offset_x, offset_y);
graphene_rect_scale (&tmp, scale, scale, &tmp);
_clutter_util_rectangle_int_extents (&tmp, &rects[i]);
_clutter_util_rectangle_int_extents (&tmp, rect);
}
return cairo_region_create_rectangles (rects, n_rects);