From 434845dbe5ae1609daad256a6285f1b9af5f0bd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= Date: Wed, 13 May 2020 11:02:56 +0200 Subject: [PATCH] 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 --- clutter/clutter/cogl/clutter-stage-cogl.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/clutter/clutter/cogl/clutter-stage-cogl.c b/clutter/clutter/cogl/clutter-stage-cogl.c index fbd1bdf3f..8bc0aba3e 100644 --- a/clutter/clutter/cogl/clutter-stage-cogl.c +++ b/clutter/clutter/cogl/clutter-stage-cogl.c @@ -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);