[mutter] clutter/stage-cogl: Don't loop through region rects twice
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] clutter/stage-cogl: Don't loop through region rects twice
- Date: Wed, 13 May 2020 11:37:10 +0000 (UTC)
commit 434845dbe5ae1609daad256a6285f1b9af5f0bd4
Author: Jonas Dreßler <verdre v0yd nl>
Date: Wed May 13 11:02:56 2020 +0200
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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]